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/diagnostic.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/diagnostic.lua')
-rw-r--r-- | runtime/lua/vim/lsp/diagnostic.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua index 8fd30c7668..12984f8c26 100644 --- a/runtime/lua/vim/lsp/diagnostic.lua +++ b/runtime/lua/vim/lsp/diagnostic.lua @@ -77,7 +77,7 @@ end local function diagnostic_lsp_to_vim(diagnostics, bufnr, client_id) local buf_lines = get_buf_lines(bufnr) local client = vim.lsp.get_client_by_id(client_id) - local offset_encoding = client and client.offset_encoding or 'utf-16' + local position_encoding = client and client.offset_encoding or 'utf-16' --- @param diagnostic lsp.Diagnostic --- @return vim.Diagnostic return vim.tbl_map(function(diagnostic) @@ -95,9 +95,9 @@ local function diagnostic_lsp_to_vim(diagnostics, bufnr, client_id) --- @type vim.Diagnostic return { lnum = start.line, - col = vim.str_byteindex(line, offset_encoding, start.character, false), + col = vim.str_byteindex(line, position_encoding, start.character, false), end_lnum = _end.line, - end_col = vim.str_byteindex(line, offset_encoding, _end.character, false), + end_col = vim.str_byteindex(line, position_encoding, _end.character, false), severity = severity_lsp_to_vim(diagnostic.severity), message = message, source = diagnostic.source, |