neovim/runtime/lua/vim/lsp
Yi Ming 629483e24e
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.
2024-11-20 12:19:07 -08:00
..
_meta docs(lsp): annotate with vim.lsp.protocol.Methods enum #29521 2024-08-20 05:52:14 -07:00
_changetracking.lua feat(lsp): deprecate non-method client functions 2024-11-20 08:51:45 +00:00
_meta.lua feat(lsp)!: remove client-server handlers from vim.lsp.handlers 2024-11-01 09:17:39 +00:00
_snippet_grammar.lua feat(lsp): add snippet API (#25301) 2023-10-21 08:51:26 +02:00
_tagfunc.lua feat(lsp): deprecate non-method client functions 2024-11-20 08:51:45 +00:00
_watchfiles.lua feat(lsp): deprecate non-method client functions 2024-11-20 08:51:45 +00:00
buf.lua feat(lsp): deprecate non-method client functions 2024-11-20 08:51:45 +00:00
client.lua feat(lsp): deprecate non-method client functions 2024-11-20 08:51:45 +00:00
codelens.lua feat(lsp): deprecate non-method client functions 2024-11-20 08:51:45 +00:00
completion.lua feat(lsp): deprecate non-method client functions 2024-11-20 08:51:45 +00:00
diagnostic.lua feat(lsp)!: remove client-server handlers from vim.lsp.handlers 2024-11-01 09:17:39 +00:00
handlers.lua refactor(lsp): fold in dynamic_registration code into the client 2024-11-18 17:09:53 +00:00
health.lua fix(lsp): list all workspace folders in healthcheck #30966 2024-10-28 06:14:56 -07:00
inlay_hint.lua feat(lsp): deprecate non-method client functions 2024-11-20 08:51:45 +00:00
log.lua fix(lsp): type-errors, other nits in vim.lsp.log #31235 2024-11-16 18:32:09 -08:00
protocol.lua feat(lsp): support utf-8 and utf-32 position encodings 2024-11-14 15:32:49 +00:00
rpc.lua refactor(lsp): avoid redundant function wrapping 2024-11-12 16:10:16 +00:00
semantic_tokens.lua feat(lsp): deprecate non-method client functions 2024-11-20 08:51:45 +00:00
sync.lua refactor(lsp): drop str_byteindex/str_utfindex wrappers #30915 2024-10-26 07:38:25 -07:00
util.lua feat(lsp): require offset_encoding param #31249 2024-11-20 12:19:07 -08:00