diff options
author | Tim Pope <code@tpope.net> | 2022-03-20 13:41:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-20 10:41:46 -0700 |
commit | af427dedf663b1987fa54c5f885409ad51824a20 (patch) | |
tree | 4bea1496d3652d7104671fbb2f135271b7507bce /test/functional/plugin/lsp_spec.lua | |
parent | 463738938d2f3ec4cff6f016937c3c02daae1184 (diff) | |
download | rneovim-af427dedf663b1987fa54c5f885409ad51824a20.tar.gz rneovim-af427dedf663b1987fa54c5f885409ad51824a20.tar.bz2 rneovim-af427dedf663b1987fa54c5f885409ad51824a20.zip |
fix(lsp): set tabSize from 'shiftwidth', not 'softtabstop' (#17787)
The use of 'softtabstop' to set tabSize was introduced in 5d5b068,
replacing 'tabstop'. If we look past the name tabSize and at the actual
purpose of the field, it's the indentation width used when formatting.
This corresponds to the Vim option 'shiftwidth', not 'softtabstop'.
The latter has the comparatively mundane purpose of controlling what
happens when you hit the tab key (and even this is incomplete, as it
fails to account for 'smarttab').
Diffstat (limited to 'test/functional/plugin/lsp_spec.lua')
-rw-r--r-- | test/functional/plugin/lsp_spec.lua | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index eab520948f..6cda9af0f4 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -2374,18 +2374,16 @@ describe('LSP', function() end) describe('lsp.util.get_effective_tabstop', function() - local function test_tabstop(tabsize, softtabstop) + local function test_tabstop(tabsize, shiftwidth) exec_lua(string.format([[ - vim.api.nvim_buf_set_option(0, 'softtabstop', %d) + vim.api.nvim_buf_set_option(0, 'shiftwidth', %d) vim.api.nvim_buf_set_option(0, 'tabstop', 2) - vim.api.nvim_buf_set_option(0, 'shiftwidth', 3) - ]], softtabstop)) + ]], shiftwidth)) eq(tabsize, exec_lua('return vim.lsp.util.get_effective_tabstop()')) end - it('with softtabstop = 1', function() test_tabstop(1, 1) end) - it('with softtabstop = 0', function() test_tabstop(2, 0) end) - it('with softtabstop = -1', function() test_tabstop(3, -1) end) + it('with shiftwidth = 1', function() test_tabstop(1, 1) end) + it('with shiftwidth = 0', function() test_tabstop(2, 0) end) end) describe('vim.lsp.buf.outgoing_calls', function() |