diff options
author | Gregory Anders <greg@gpanders.com> | 2023-06-01 11:15:33 -0500 |
---|---|---|
committer | Gregory Anders <greg@gpanders.com> | 2023-06-01 11:34:23 -0500 |
commit | fb54e6980ea6fec218a11f118e97ef65f250395a (patch) | |
tree | 8279755b38e3772d3e39010b47034591fb402453 /test/functional/plugin/lsp_spec.lua | |
parent | afb70eba8cdfc44b3633bdb91a1554b86b06a5d0 (diff) | |
download | rneovim-fb54e6980ea6fec218a11f118e97ef65f250395a.tar.gz rneovim-fb54e6980ea6fec218a11f118e97ef65f250395a.tar.bz2 rneovim-fb54e6980ea6fec218a11f118e97ef65f250395a.zip |
feat(lsp): set client offset_encoding if server supports positionEncoding
If the server sends the positionEncoding capability in its
initialization response, automatically set the client's offset_encoding
to use the value provided.
Diffstat (limited to 'test/functional/plugin/lsp_spec.lua')
-rw-r--r-- | test/functional/plugin/lsp_spec.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index e0ce62c0db..dac49345d0 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -218,6 +218,34 @@ describe('LSP', function() }) end) + it("should set the client's offset_encoding when positionEncoding capability is supported", function() + clear() + exec_lua(create_server_definition) + local result = exec_lua([[ + local server = _create_server({ + capabilities = { + positionEncoding = "utf-8" + }, + }) + + local client_id = vim.lsp.start({ + name = 'dummy', + cmd = server.cmd, + }) + + if not client_id then + return 'vim.lsp.start did not return client_id' + end + + local client = vim.lsp.get_client_by_id(client_id) + if not client then + return 'No client found with id ' .. client_id + end + return client.offset_encoding + ]]) + eq('utf-8', result) + end) + it('should succeed with manual shutdown', function() if is_ci() then pending('hangs the build on CI #14028, re-enable with freeze timeout #14204') |