diff options
author | Riley Bruins <ribru17@hotmail.com> | 2024-05-21 09:25:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-21 09:25:54 -0700 |
commit | a108852b008b2cb1fe38b1f66cffd78b33bd9a70 (patch) | |
tree | 7d1eca4970775fb1c0d4e197e3df6b07c452d0fb /test/functional/plugin/lsp/semantic_tokens_spec.lua | |
parent | d9a2acdab3bfd33584ad468f4d559b0e94f84471 (diff) | |
download | rneovim-a108852b008b2cb1fe38b1f66cffd78b33bd9a70.tar.gz rneovim-a108852b008b2cb1fe38b1f66cffd78b33bd9a70.tar.bz2 rneovim-a108852b008b2cb1fe38b1f66cffd78b33bd9a70.zip |
fix(lsp): semantic token functions allow "0" bufnr #28849
aligns with ":help dev-patterns"
Diffstat (limited to 'test/functional/plugin/lsp/semantic_tokens_spec.lua')
-rw-r--r-- | test/functional/plugin/lsp/semantic_tokens_spec.lua | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp/semantic_tokens_spec.lua b/test/functional/plugin/lsp/semantic_tokens_spec.lua index 013393095e..60f02b0521 100644 --- a/test/functional/plugin/lsp/semantic_tokens_spec.lua +++ b/test/functional/plugin/lsp/semantic_tokens_spec.lua @@ -273,6 +273,63 @@ describe('semantic token highlighting', function() end ) + it('highlights start and stop when using "0" for current buffer', function() + exec_lua([[ + bufnr = vim.api.nvim_get_current_buf() + vim.api.nvim_win_set_buf(0, bufnr) + client_id = vim.lsp.start({ name = 'dummy', cmd = server.cmd }) + ]]) + + insert(text) + + exec_lua([[ + vim.notify = function() end + vim.lsp.semantic_tokens.stop(0, client_id) + ]]) + + screen:expect { + grid = [[ + #include <iostream> | + | + int main() | + { | + int x; | + #ifdef __cplusplus | + std::cout << x << "\n"; | + #else | + printf("%d\n", x); | + #endif | + } | + ^} | + {1:~ }|*3 + | + ]], + } + + exec_lua([[ + vim.lsp.semantic_tokens.start(0, client_id) + ]]) + + screen:expect { + grid = [[ + #include <iostream> | + | + int {8:main}() | + { | + int {7:x}; | + #ifdef {5:__cplusplus} | + {4:std}::{2:cout} << {2:x} << "\n"; | + {6:#else} | + {6: printf("%d\n", x);} | + {6:#endif} | + } | + ^} | + {1:~ }|*3 + | + ]], + } + end) + it('buffer is re-highlighted when force refreshed', function() exec_lua([[ bufnr = vim.api.nvim_get_current_buf() |