Problem:
`lsp.buf_request` send the same params to all servers and many
calls to this pass PositionalParams which depends on the clients
offset_encoding. This can result with incorrect params being sent
to a server.
Solution:
`lsp.buf_request` `params` argument can now be passed as a function
which takes the client as the first argument. This is used in
lsp/buf.lua to construct correct params for each client request.
PROBLEM:
There are several limitations to vim.str_byteindex, vim.str_utfindex:
1. They throw given out-of-range indexes. An invalid (often user/lsp-provided)
index doesn't feel exceptional and should be handled by the caller.
`:help dev-error-patterns` suggests that `retval, errmsg` is the preferred
way to handle this kind of failure.
2. They cannot accept an encoding. So LSP needs wrapper functions. #25272
3. The current signatures are not extensible.
* Calling: The function currently uses a fairly opaque boolean value to
indicate to identify the encoding.
* Returns: The fact it can throw requires wrapping in pcall.
4. The current name doesn't follow suggestions in `:h dev-naming` and I think
`get` would be suitable.
SOLUTION:
- Because these are performance-sensitive, don't introduce `opts`.
- Introduce an "overload" that accepts `encoding:string` and
`strict_indexing:bool` params.
```lua
local col = vim.str_utfindex(line, encoding, [index, [no_out_of_range]])
```
Support the old versions by dispatching on the type of argument 2, and
deprecate that form.
```lua
vim.str_utfindex(line) -- (utf-32 length, utf-16 length), deprecated
vim.str_utfindex(line, index) -- (utf-32 index, utf-16 index), deprecated
vim.str_utfindex(line, 'utf-16') -- utf-16 length
vim.str_utfindex(line, 'utf-16', index) -- utf-16 index
vim.str_utfindex(line, 'utf-16', math.huge) -- error: index out of range
vim.str_utfindex(line, 'utf-16', math.huge, false) -- utf-16 length
```
Co-authored-by: David Pedersen <limero@me.com>
Co-authored-by: Gregory Anders <greg@gpanders.com>
Co-authored-by: Leo Schlosser <Leo.Schlosser@Student.HTW-Berlin.de>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Problem:
Hidden options are documented despite being no-ops.
Solution:
Remove docs for hidden options.
Move tags for options that we plan to restore, to ":help nvim-missing".
Move tags for permanently removed options, to ":help nvim-removed".
Problem:
`vim.validate()` takes two forms when it only needs one.
Solution:
- Teach the fast form all the features of the spec form.
- Deprecate the spec form.
- General optimizations for both forms.
- Add a `message` argument which can be used alongside or in place
of the `optional` argument.
Problem:
- `vim.highlight` module does not follow `:help dev-name-common`, which
documents the name for "highlight" as "hl".
- Shorter names are usually preferred.
Solution:
Rename `vim.highlight` to `vim.hl`.
This is not a breaking change until 2.0 (or maybe never).
vim-patch:8.2.4744: a terminal window can't use the bell
vim-patch:8.2.4745: using wrong flag for using bell in the terminal
BREAKING CHANGE: Bells from :terminal are now silent by default, unless
'belloff' option doesn't contain "term" or "all".
Problem:
If there are multiple LSP clients, it's not clear which actions are provided by which servers. #30710
Solution:
Show the server name next to each action (only if there are multiple clients).
This commit makaes the following changes to the vim help syntax:
- fix excessive URL detection in help, because `file:{filename}` in
doc/options.txt is determined to be a URL.
- update highlighting N for :resize in help
- split Italian-specific syntax into separate help script
- highlight `Note` in parentheses in help
- update 'titlestring' behaviour in documentation for invalid '%' format
closes: vim/vim#158836c2fc377bf
Co-authored-by: Milly <milly.ca@gmail.com>
Problem:
Previously the index was only checked against the UTF8 length. This
could cause unexpected behaviours for strings containing multibyte chars
Solution:
Check indicies correctly against their max value before returning the
fallback length