]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Use shiftwidth() as tabSize
authorTim Pope <code@tpope.net>
Thu, 31 Mar 2022 03:47:41 +0000 (23:47 -0400)
committerTim Pope <code@tpope.net>
Thu, 31 Mar 2022 03:56:16 +0000 (23:56 -0400)
The tabSize field in the LSP spec is poorly named, as it's not used for
anything tab related but rather the indent size when formatting.  This
corresponds to shiftwidth() in Vim.

autoload/lsp/lspserver.vim

index 86d94fe219e63b3f89abf5d3b555a7cff5c90195..ae7a4707088f9b6d809c9593644f67bd11a6f617 100644 (file)
@@ -718,17 +718,9 @@ def TextDocFormat(lspserver: dict<any>, fname: string, rangeFormat: bool,
 
   # interface DocumentFormattingParams
   # interface TextDocumentIdentifier
-  var tabsz: number
-  if &sts > 0
-    tabsz = &sts
-  elseif &sts < 0
-    tabsz = &shiftwidth
-  else
-    tabsz = &tabstop
-  endif
   # interface FormattingOptions
   var fmtopts: dict<any> = {
-    tabSize: tabsz,
+    tabSize: shiftwidth(),
     insertSpaces: &expandtab ? true : false,
   }
   #req.params->extend({textDocument: {uri: util.LspFileToUri(fname)},