diff options
author | Yi Ming <ofseed@foxmail.com> | 2024-11-21 04:19:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 12:19:07 -0800 |
commit | 629483e24eed3f2c07e55e0540c553361e0345a2 (patch) | |
tree | 0ac4969929cef4cdc272362bf8e6d01c40669179 /runtime/lua/vim/_meta/options.lua | |
parent | 1b6442034f6a821d357fe59cd75fdae47a7f7cff (diff) | |
download | rneovim-629483e24eed3f2c07e55e0540c553361e0345a2.tar.gz rneovim-629483e24eed3f2c07e55e0540c553361e0345a2.tar.bz2 rneovim-629483e24eed3f2c07e55e0540c553361e0345a2.zip |
feat(lsp): require `offset_encoding` param #31249
Problem:
Since [version 3.17](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocuments),
LSP supports specifying the position encoding (aka offset encoding) supported by
the client through `positionEncoding`. Since #31209, Nvim fully supports
`utf-8`, `utf-16`, and `utf-32` encodings.
Previously, nvim assumed all clients for a buffer had the same
`offset_encoding`, so:
* Nvim provides `vim.lsp._get_offset_encoding()` to get `offset_encoding`, but
this function is incorrect because `offset_encoding` is per-client, not
per-buffer.
* Based on the strategy of `vim.lsp._get_offset_encoding()`,
`vim.lsp.util.make_position_params()`, `vim.lsp.util.make_range_params()`, and
`vim.lsp.util.make_given_range_params()` do not require the caller to pass
`offset_encoding`, which is invalid.
* https://github.com/neovim/neovim/issues/25272
Solution:
* Mark `vim.lsp._get_offset_encoding()` as `@deprecated`.
* Change the type annotations of `vim.lsp.util.make_position_params()`,
`vim.lsp.util.make_range_params()`, `vim.lsp.util.make_given_range_params()`
to require the `offset_encoding` param.
Diffstat (limited to 'runtime/lua/vim/_meta/options.lua')
0 files changed, 0 insertions, 0 deletions