From 912ff2486fc1c92fa12ed99f939977f2afa96860 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 30 Mar 2022 23:47:41 -0400 Subject: [PATCH] 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. --- autoload/lsp/lspserver.vim | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) 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)}, -- 2.48.1