mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 03:15:39 +00:00
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`.
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user