aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/completion.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/completion.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/completion.lua')
-rw-r--r--runtime/lua/vim/lsp/completion.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/runtime/lua/vim/lsp/completion.lua b/runtime/lua/vim/lsp/completion.lua
index 0f388a88fd..1e950f625e 100644
--- a/runtime/lua/vim/lsp/completion.lua
+++ b/runtime/lua/vim/lsp/completion.lua
@@ -550,7 +550,7 @@ local function on_complete_done()
return
end
- local offset_encoding = client.offset_encoding or 'utf-16'
+ local position_encoding = client.offset_encoding or 'utf-16'
local resolve_provider = (client.server_capabilities.completionProvider or {}).resolveProvider
local function clear_word()
@@ -576,7 +576,7 @@ local function on_complete_done()
if completion_item.additionalTextEdits and next(completion_item.additionalTextEdits) then
clear_word()
- lsp.util.apply_text_edits(completion_item.additionalTextEdits, bufnr, offset_encoding)
+ lsp.util.apply_text_edits(completion_item.additionalTextEdits, bufnr, position_encoding)
apply_snippet_and_command()
elseif resolve_provider and type(completion_item) == 'table' then
local changedtick = vim.b[bufnr].changedtick
@@ -591,7 +591,7 @@ local function on_complete_done()
if err then
vim.notify_once(err.message, vim.log.levels.WARN)
elseif result and result.additionalTextEdits then
- lsp.util.apply_text_edits(result.additionalTextEdits, bufnr, offset_encoding)
+ lsp.util.apply_text_edits(result.additionalTextEdits, bufnr, position_encoding)
if result.command then
completion_item.command = result.command
end