diff options
author | David Lukes <dafydd.lukes@gmail.com> | 2020-05-05 17:23:45 +0200 |
---|---|---|
committer | David Lukes <dafydd.lukes@gmail.com> | 2020-06-22 09:48:41 +0200 |
commit | ebee9ebe2be2bd584efefc4064a8b3a07e0505e0 (patch) | |
tree | 54fe1520a078341c073c20c8c5b4e28404cbac59 /test | |
parent | 4496628c181e456d57e9257e14d8582d8dc548eb (diff) | |
download | rneovim-ebee9ebe2be2bd584efefc4064a8b3a07e0505e0.tar.gz rneovim-ebee9ebe2be2bd584efefc4064a8b3a07e0505e0.tar.bz2 rneovim-ebee9ebe2be2bd584efefc4064a8b3a07e0505e0.zip |
lsp: Add sync variant of LSP formatting
Also, factor out a `vim.lsp.util.get_effective_tabstop()` helper and add
tests for it.
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/plugin/lsp_spec.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index c74ed6bf3b..4b12ea2557 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -1424,4 +1424,19 @@ describe('LSP', function() eq({15,5}, exec_lua[[ return {vim.lsp.util._make_floating_popup_size(contents,{width = 15, wrap_at = 14})} ]]) end) end) + + describe('lsp.util.get_effective_tabstop', function() + local function test_tabstop(tabsize, softtabstop) + exec_lua(string.format([[ + vim.api.nvim_buf_set_option(0, 'softtabstop', %d) + vim.api.nvim_buf_set_option(0, 'tabstop', 2) + vim.api.nvim_buf_set_option(0, 'shiftwidth', 3) + ]], softtabstop)) + 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) + end) end) |