aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Anders <greg@gpanders.com>2023-06-01 11:39:51 -0500
committerGregory Anders <greg@gpanders.com>2023-06-01 11:46:37 -0500
commit15641f38cf4b489a7c83e2c3aa6efc4c63009f00 (patch)
tree94f503464e247241b81bf2cd5dc28b99e7c2ef60
parentfb54e6980ea6fec218a11f118e97ef65f250395a (diff)
downloadrneovim-15641f38cf4b489a7c83e2c3aa6efc4c63009f00.tar.gz
rneovim-15641f38cf4b489a7c83e2c3aa6efc4c63009f00.tar.bz2
rneovim-15641f38cf4b489a7c83e2c3aa6efc4c63009f00.zip
feat(lsp): include positionEncodings in default client capabilities
-rw-r--r--runtime/doc/news.txt6
-rw-r--r--runtime/lua/vim/lsp/protocol.lua7
2 files changed, 13 insertions, 0 deletions
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 72eb182fa5..3fd2d4d40e 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -39,6 +39,12 @@ ADDED FEATURES *news-added*
The following new APIs or features were added.
+• Nvim's LSP client now advertises the general.positionEncodings client
+ capability to indicate to servers that it supports utf-8, utf-16, and utf-32
+ encodings. If the server responds with the positionEncoding capability in
+ its initialization response, Nvim automatically sets the client's
+ `offset_encoding` field.
+
• Dynamic registration of LSP capabilities. An implication of this change is that checking a client's `server_capabilities` is no longer a sufficient indicator to see if a server supports a feature. Instead use `client.supports_method(<method>)`. It considers both the dynamic capabilities and static `server_capabilities`.
• |vim.iter()| provides a generic iterator interface for tables and Lua
iterators |luaref-in|.
diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua
index a28ff407b7..7e49a572e7 100644
--- a/runtime/lua/vim/lsp/protocol.lua
+++ b/runtime/lua/vim/lsp/protocol.lua
@@ -634,6 +634,13 @@ export interface WorkspaceClientCapabilities {
--- capabilities.
function protocol.make_client_capabilities()
return {
+ general = {
+ positionEncodings = {
+ 'utf-8',
+ 'utf-16',
+ 'utf-32',
+ },
+ },
textDocument = {
semanticTokens = {
dynamicRegistration = false,