diff options
author | Yi Ming <ofseed@foxmail.com> | 2024-11-26 00:06:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-25 08:06:05 -0800 |
commit | 165b099fa38c5f4a9855cda3d13575bf63767647 (patch) | |
tree | 543a209711e32e98f37883d77eb8de883a128bef /runtime/lua/vim/lsp/_changetracking.lua | |
parent | a811d4babd22e21a3cd598b097fa0824fcff7fc6 (diff) | |
download | rneovim-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/_changetracking.lua')
-rw-r--r-- | runtime/lua/vim/lsp/_changetracking.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/runtime/lua/vim/lsp/_changetracking.lua b/runtime/lua/vim/lsp/_changetracking.lua index 8588502697..c2ff66b90e 100644 --- a/runtime/lua/vim/lsp/_changetracking.lua +++ b/runtime/lua/vim/lsp/_changetracking.lua @@ -18,14 +18,14 @@ local M = {} --- --- None: One group for all clients --- Full: One group for all clients ---- Incremental: One group per `offset_encoding` +--- Incremental: One group per `position_encoding` --- --- Sending changes can be debounced per buffer. To simplify the implementation the --- smallest debounce interval is used and we don't group clients by different intervals. --- --- @class vim.lsp.CTGroup --- @field sync_kind integer TextDocumentSyncKind, considers config.flags.allow_incremental_sync ---- @field offset_encoding "utf-8"|"utf-16"|"utf-32" +--- @field position_encoding "utf-8"|"utf-16"|"utf-32" --- --- @class vim.lsp.CTBufferState --- @field name string name of the buffer @@ -46,7 +46,7 @@ local M = {} ---@return string local function group_key(group) if group.sync_kind == protocol.TextDocumentSyncKind.Incremental then - return tostring(group.sync_kind) .. '\0' .. group.offset_encoding + return tostring(group.sync_kind) .. '\0' .. group.position_encoding end return tostring(group.sync_kind) end @@ -72,7 +72,7 @@ local function get_group(client) end return { sync_kind = sync_kind, - offset_encoding = client.offset_encoding, + position_encoding = client.offset_encoding, } end @@ -310,7 +310,7 @@ local function send_changes_for_group(bufnr, firstline, lastline, new_lastline, -- The contents would further change and startline/endline may no longer fit local changes = incremental_changes( buf_state, - group.offset_encoding, + group.position_encoding, bufnr, firstline, lastline, |