aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/client.lua
diff options
context:
space:
mode:
authorYi Ming <ofseed@foxmail.com>2024-11-26 00:06:05 +0800
committerGitHub <noreply@github.com>2024-11-25 08:06:05 -0800
commit165b099fa38c5f4a9855cda3d13575bf63767647 (patch)
tree543a209711e32e98f37883d77eb8de883a128bef /runtime/lua/vim/lsp/client.lua
parenta811d4babd22e21a3cd598b097fa0824fcff7fc6 (diff)
downloadrneovim-165b099fa38c5f4a9855cda3d13575bf63767647.tar.gz
rneovim-165b099fa38c5f4a9855cda3d13575bf63767647.tar.bz2
rneovim-165b099fa38c5f4a9855cda3d13575bf63767647.zip
refactor(lsp): rename `offset_encoding` to `position_encoding` #31286
Problem: LSP spec uses the term "position encoding" where we say "offset encoding". Solution: - Rename it everywhere except `vim.lsp.Client.offset_encoding` (which would be breaking). - Mention "position encoding" in the documentation for `vim.lsp.Client.offset_encoding`.
Diffstat (limited to 'runtime/lua/vim/lsp/client.lua')
-rw-r--r--runtime/lua/vim/lsp/client.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/runtime/lua/vim/lsp/client.lua b/runtime/lua/vim/lsp/client.lua
index 3b79da99ea..7c2b7192f5 100644
--- a/runtime/lua/vim/lsp/client.lua
+++ b/runtime/lua/vim/lsp/client.lua
@@ -94,7 +94,8 @@ local validate = vim.validate
--- Language ID as string. Defaults to the buffer filetype.
--- @field get_language_id? fun(bufnr: integer, filetype: string): string
---
---- The encoding that the LSP server expects. Client does not verify this is correct.
+--- Called "position encoding" in LSP spec, the encoding that the LSP server expects.
+--- Client does not verify this is correct.
--- @field offset_encoding? 'utf-8'|'utf-16'|'utf-32'
---
--- Callback invoked when the client operation throws an error. `code` is a number describing the error.
@@ -148,8 +149,10 @@ local validate = vim.validate
--- See |vim.lsp.rpc.start()|.
--- @field rpc vim.lsp.rpc.PublicClient
---
---- The encoding used for communicating with the server. You can modify this in
---- the `config`'s `on_init` method before text is sent to the server.
+--- Called "position encoding" in LSP spec,
+--- the encoding used for communicating with the server.
+--- You can modify this in the `config`'s `on_init` method
+--- before text is sent to the server.
--- @field offset_encoding string
---
--- The handlers used by the client as described in |lsp-handler|.
@@ -278,7 +281,7 @@ local function validate_encoding(encoding)
return valid_encodings[encoding:lower()]
or error(
string.format(
- "Invalid offset encoding %q. Must be one of: 'utf-8', 'utf-16', 'utf-32'",
+ "Invalid position encoding %q. Must be one of: 'utf-8', 'utf-16', 'utf-32'",
encoding
)
)