Refactor capability checks in Client:_supports_registration and
Client:supports_method to properly handle dynamicRegistration and unknown
methods. Now, dynamic capabilities are checked before assuming support for
unknown methods, ensuring more accurate LSP feature detection.
Problem:
`vim.system()` doesn't invoke a shell, while the Vimscript function
`system()` does.
Solution:
Revert the change from 35af766de6 and use `vim.fn.system()` again to
actually invoke a shell.
Problem:
If the last visible line in a window is not fully displayed, this line
may not get injection highlighting. This happens because line('w$')
actually means the last *completely displayed* line.
Solution:
Use line('w$') + 1 for the botline.
This reverts 4244a96774
"test: fix failing lsp/utils_spec #36609",
which changed the test based on the wrong behavior.
- Add leading "$" to match other environment variable tags.
- Clarify :help $NoDefaultCurrentDirectoryInExePath.
closes: vim/vim#18895bfb9f5c40e
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem:
When using the Nvim appimage, `~/.cache/nvim/luac` directory can grow to
250,000+ files.
Example of 2 identical files in `./luac/`:
%2ftmp%2f.mount_nvim.a65Rja0%2fusr%2fshare%2fnvim%2fruntime%2flua%2fvim%2ftreesitter.luac
%2ftmp%2f.mount_nvim.aNpxXgo%2fusr%2fshare%2fnvim%2fruntime%2flua%2fvim%2ftreesitter.luac
Analysis:
The `nvim.appimage` mounts nvim at a different temporary path each time
it is invoked. The naming scheme of these cache files is random, which
defats the purpose of the cache creates N new files on every launch of
nvim.
Steps to reproduce:
1. install `nvim.appimage`
2. `mv ~/.cache/nvim/luac ~/.cache/nvim/luac.backup`
3. `nvim`
4. Observe contents of `~/.cache/nvim/luac/`
5. Close nvim and run `nvim` again
6. Observe contents of `~/.cache/nvim/luac/` and see that new identical
files have been added with a different mount prefix
Solution:
When running from an appimage, trim the random part of the filepaths.
Problem:
After bc0635a9fc `vim.wait()` rejects floats
and NaN values.
Solution:
Restore the prior behavior, while still supporting `math.huge`. Update
tests to cover float case.
Problem:
Current options for powershell and pwsh had mistakes and rationale
behind them was not clear.
Solution:
Update the suggested options by splitting up powershell and pwsh, as
well as ensuring that all options work and rationale is documented and
discussed.
Problem: diff: missing diff size limit for xdiff
Solution: Impose file size limit for internal diff (xdiff)
(Yee Cheng Chin).
Git imposes a hard cap on file size for content that it passes to xdiff
(added to Git in dcd1742e56e, defined in xdiff-interface.h), due to
integer overflow concerns in xdiff. Vim doesn't specify such a limit
right now, which means it's possible for a user to diff a large file
(1GB+) and trigger these overflow issues.
Add the same size limit (1GB minus 1MB) to Vim and simply throws an
error when Vim encounters files larger than said limit. For now, reuse
the same error message regarding internal diff failures. There is no
need to add the same limit for external diff as it's up to each tool to
error check their input to decide what is appropriate or not.
closes: vim/vim#188914af6d9755c
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Problem:
The execution of startup scripts in parent directories are too late
compared to scripts in current direcctory.
Solution:
Execute all startup scripts with `lua/_core/exrc.lua`.
closes: #35147
Problem:
Our LSP type system didnt have a concept of RegistrationMethods, this is where the method to dynamically register for a capability is sent to a different method endpoint then is used to call it. Eg `textDocument/semanticTokens` rather than the specific full/range/delta methods
Solution:
Extended generator to create `vim.lsp.protocol.Methods.Registration` with these registration methods. Also extend `_request_name_to_client_capability` to cover these methods. Adjust typing to suit
Problem:
If a `vim.lsp.config` explicitly sets `exit_timeout`, that indicates the
config wants that behavior for most usages of `:stop()`.
Solution:
Update `:stop()` to use `force=exit_timeout` if `force` was not
explicitly passed.
Problem: gewininfo() does not return if statusline is visible
Solution: Add status_height to the dict items returned by
getwininfo() (Hirohito Higashi)
closes: vim/vim#18841a04ab5f04c
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Problem: Windows: Vim always adds the current directory to search path.
This should only happen when using cmd.exe as 'shell'. For
example, powershell won't run binaries from the current
directory.
Solution: Only add current directory to system path, when using cmd.exe
as 'shell'.
related: vim/vim#10341
related: 083ec6d9a3b7
4d87c9742a
Co-authored-by: Christian Brabandt <cb@256bit.org>
Also, don't start the timer at all when a previous shutdown failed, as
in this case a forced shutdown is used and no timer is needed.
This fixes most of the delays caused by #36750.
The delays caused by #36378 still seem to remain.
Problem:
Version check failed because of "equality" comparison, so a version
string of "123abc" would not match "123abcdef".
Solution:
- Adjust verison check.
- Improve bug-report formatting.
Allow the `request` parameter in `tokens_to_ranges` to be `nil` and
update version checking logic accordingly. This prevents errors when
the request is not present and improves robustness of semantic token
handling.
Problem:
The `flags` field calls its sub-fields "experimental".
But `exit_timeout` is now used for multiple purposes.
Solution:
Graduate `exit_timeout` to a top-level ClientConfig field.
Problem: filetype: Erlang lexical files are not recognized
Solution: Detect *.xrl files as leex filetype, include syntax and
filetype plugins (Jon Parise).
leex is the lexical analyzer generator for Erlang. Its input file format
follows a section-based structure and uses the `.xrl` file extension.
This initial work includes file detection, an ftplugin (which inherits
the Erlang configuration), and a syntax definition.
Reference:
- https://www.erlang.org/doc/apps/parsetools/leex.html
related: vim/vim#18819closes: vim/vim#18832b087c5452b
Co-authored-by: Jon Parise <jon@indelible.org>
Problem: filetype: not all Erlang files are recognized
Solution: Detect *.app.src and rebar.config files as erlang filetype
(John Parise).
*.app.src files contain Erlang application definitions. (There are also
*.app files, which are similar but more often build artifacts, and that
file extension is too ambiguous to be recognized by default.)
Reference:
- https://www.erlang.org/doc/system/applications.html
Rebar is the Erlang build tool. rebar.config uses Erlang syntax.
Reference:
- https://rebar3.org/docs/configuration/configuration/closes: vim/vim#188352b2580e61a
Co-authored-by: Jon Parise <jon@indelible.org>
Problem:
Nvim supports `textDocument/semanticTokens/full` and `…/full/delta`
already, but most servers don't support `…/full/delta` and Nvim will try
to request and process full semantic tokens response on every buffer
change. Even though the request is debounced, there is noticeable lag if
the token response is large (in a big file).
Solution:
Support `textDocument/semanticTokens/range`, which requests semantic
tokens for visible screen only.
Problem:
The rundll32 utility is a leftover from Windows 95, and it has
been deprecated since at least Windows Vista.
Solution:
Use the start command through Command Prompt instead.
Problem:
LSP server may not exit even after the client was stopped/disabled via enable(false).
Solution:
Automatically force-stop after a timeout, unless `client.flags.exit_timeout = false`.