From: Tim Pope Date: Thu, 31 Mar 2022 03:47:41 +0000 (-0400) Subject: Use shiftwidth() as tabSize X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=912ff2486fc1c92fa12ed99f939977f2afa96860;p=vim-lsp.git Use shiftwidth() as tabSize 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. --- diff --git a/autoload/lsp/lspserver.vim b/autoload/lsp/lspserver.vim index 86d94fe..ae7a470 100644 --- a/autoload/lsp/lspserver.vim +++ b/autoload/lsp/lspserver.vim @@ -718,17 +718,9 @@ def TextDocFormat(lspserver: dict, 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 = { - tabSize: tabsz, + tabSize: shiftwidth(), insertSpaces: &expandtab ? true : false, } #req.params->extend({textDocument: {uri: util.LspFileToUri(fname)},