| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
| |
Follow up to https://github.com/neovim/neovim/pull/32072
If there is no prefix (e.g. at the start of word boundary or a line), it
always used the `filterText` because the `match` function always
returned false.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
With language servers like lemminx, completing xml tags like `<mo` first
shows the right candidates (`modules`) but after typing `d` the
candidates disappear.
This is because the server returns:
[...]
filterText = "<module",
label = "module",
textEdit = {
newText = "<module>$1</module>$0",
Which resulted in `module` being used as `word`, and `module` doesn't
match the prefix `<mo`. Typing `d` causes the `complete()` filtering
mechanism to kick in and remove the entry.
Solution:
Use `<module` from the `filterText` as `word` if the textEdit/label
heuristic doesn't match.
|
|
|
|
|
| |
Problem: open_floating_preview() may be hidden behind current window if
that is floating and has a higher zindex.
Solution: Open floating preview with zindex higher than current window.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
An LSP configuration that creates client with no root_dir or
workspace_folders can result in vim.lsp.enable attaching to it multiple
times.
Solution:
When checking existing clients, reuse a client if it wasn't initially
configured have any workspace_folders. This more closely matches the
behaviour we had prior to d9235ef
|
|
|
|
| |
Not used anywhere.
|
|
|
|
|
|
|
|
| |
Problem:
LSP module has multiple "start" interfaces.
Solution:
- Enhance vim.lsp.start
- Deprecate vim.lsp.start_client
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* refactor(shared): extract `vim._list_insert` and `vim._list_remove`
* feat(lsp): add `vim.lsp.foldexpr()`
* docs(lsp): add a todo for state management
* feat(lsp): add `vim.lsp.folding_range.foldclose()`
* feat(lsp): schedule `foldclose()` if the buffer is not up-to-date
* feat(lsp): add `vim.lsp.foldtext()`
* feat(lsp): support multiple folding range providers
* refactor(lsp): expose all folding related functions under `vim.lsp.*`
* perf(lsp): add `lsp.MultiHandler` for do `foldupdate()` only once
|
|
|
| |
Co-authored-by: Jesse <github@jessebakker.com>
|
|
|
|
|
|
|
|
| |
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`.
|
|
|
|
|
|
|
|
| |
Problem: floaing preview window can be closed by some
ex commands like `only` `fclose` which will not clean the bufvar
Solution: use WinClosed event with floating_winnr for clean
bufnr, and add test cases for vim.lsp.util.open_floating_preview
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Deprecated:
- `client.request()` -> `client:request()`
- `client.request_sync()` -> `client:request_sync()`
- `client.notify()` -> `client:notify()`
- `client.cancel_request()` -> `client:cancel_request()`
- `client.stop()` -> `client:stop()`
- `client.is_stopped()` `client:is_stopped()`
- `client.supports_method()` -> `client:supports_method()`
- `client.on_attach()` -> `client:on_attach()`
Fixed docgen to link class fields to the full function doc.
|
|
|
|
|
|
|
|
|
|
| |
Before calling "attach" a screen object is just a dummy container for
(row, col) values whose purpose is to be sent as part of the "attach"
function call anyway.
Just create the screen in an attached state directly. Keep the complete
(row, col, options) config together. It is still completely valid to
later detach and re-attach as needed, including to another session.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
- Partition the handlers in vim.lsp.handlers as:
- client to server response handlers (RCS)
- server to client request handlers (RSC)
- server to client notification handlers (NSC)
Note use string indexes instead of protocol.methods for improved
typing in LuaLS (tip: use hover on RCS, RSC or NSC).
|
|
|
|
|
| |
* deprecate old signatures
* move to new str_byteindex/str_utfindex signature
* use single-underscore name (double-underscore is reserved for Lua itself)
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: on `CompleteDone` cursor can jump to the end of line instead of
the end of the completed word.
Solution: remove only inserted word for snippet expansion instead of everything
until eol.
Fixes #30656
Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: Currently completion attribute hl_group is combined with
all items, which is redundant and confusing with kind_hlgroup
Solution: Renamed to abbr_hlgroup and combine it only with the abbr item
(glepnir).
closes: vim/vim#15818
https://github.com/vim/vim/commit/0fe17f8ffbd2588ecd2bf42dced556897bc64f89
Co-authored-by: glepnir <glephunter@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
- Some servers like LuaLS add unwanted blank lines after multiline
`@param` description.
- List items do not wrap nicely.
Solution:
- When rendering the LSP doc hover, remove blank lines in each `@param`
or `@return`.
- But ensure exactly one empty line before each.
- Set 'breakindent'.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Updated the `rpc.connect` function to support connecting to LSP servers
using hostnames, not just IP addresses. This change includes updates to
the documentation and additional test cases to verify the new
functionality.
- Modified `connect` function to resolve hostnames.
- Updated documentation to reflect the change.
- Added test case for connecting using hostname.
Added a TCP echo server utility function to the LSP test suite. This
server echoes the first message it receives and is used in tests to
verify LSP server connections via both IP address and hostname.
Refactored existing tests to use the new utility function.
|
| |
|
|
|
|
|
|
|
| |
Problem: prefix can be a symbol like period, the fuzzy matching can't
handle it correctly.
Solution: when prefix is empty or a symbol add all lsp completion
result into matches.
|
|
|
|
|
|
|
| |
Problem: Some items of completion results include function signatures that can
cause the pum to be very long when a function has many params, because pum
scales with the longest word/abbr.
Solution: add custom covert function that can customise abbr to remove params.
|
|
|
|
|
|
|
| |
- Merge all the top level 'LSP' describe blocks
- Refactor text edit tests
- Fix typing errors
- Add linebreaks between tests
|
|
|
|
|
|
|
|
| |
See https://github.com/microsoft/language-server-protocol/pull/1978
If the severity is not specified by the server, error should be used.
This was already the case because it matches the vim.diagnostic default.
This only adds a test case for it.
|
|
|
|
|
|
|
| |
`buf.code_action` always included diagnostics on a given line from all
clients. Servers should only receive diagnostics they published, and in
the exact same format they sent it.
Should fix https://github.com/neovim/neovim/issues/29500
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
Some language servers (e.g., rust-analyzer, texlab) are desynced when
the user deletes the entire contents of the buffer. This is due to the
discrepancy between how nvim computes diff and how nvim treats empty
buffer.
* diff: If the buffer became empty, then the diff includes the last
line's eol.
* empty buffer: Even if the buffer is empty, nvim regards it as having
a single empty line with eol.
Solution:
Add special case for diff computation when the buffer becomes empty so
that it does not include the eol of the last line.
|
|
|
|
|
|
| |
Problem: CompletionItem in lsp spec mentioned the deprecated attribute
Solution: when item has deprecated attribute set hl_group to DiagnosticDeprecated
in complete function
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
When there are multiple inlay hints present at the same position, they
should be rendered in the order they are received in the response from
LSP as per the LSP spec. Currently, this is not respected.
Solution:
Gather all hints for a given position, and then set it in a single
extmark call instead of multiple set_extmark calls. This leads to fewer
extmark calls and correct inlay hints being rendered.
|
|
|
|
| |
(#29522)
|
|
|
|
|
|
|
|
|
|
|
| |
Although the built-in pum completion mechanism will filter anyway on the
next input it is odd if the initial popup shows entries which don't
match the current prefix.
Using fuzzy match on the label/prefix is compatible with
`completeopt+=fuzzy` and also doesn't seem to break postfix snippet
cases
Closes https://github.com/neovim/neovim/issues/29287
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
For snippets lsp.completion prefers the label if it is shorter than the
insertText or textEdit to support postfix completion cases but clangd
adds decoration characters to labels. E.g.: `•INT16_C(c)`
Solution:
Use parse_snippet on insertText/textEdit before checking if it is
shorter than the label.
Fixes https://github.com/neovim/neovim/issues/29301
|
|
|
|
|
|
| |
This reduces the number of nil checks around buf_versions usage
Test changes were lifted from 5c33815
Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
|
|
|
|
|
|
|
|
|
| |
* Revert "fix(lsp): account for changedtick version gap on modified reset (#29170)"
This reverts commit 2e6d295f799c27372e5c0c44727fa613c81717fd.
* Revert "refactor(lsp): replace util.buf_versions with changedtick (#28943)"
This reverts commit 5c33815448e11b514678f39cecc74e68131d4628.
|
| |
|
|
|
|
|
| |
the `complete()` mechanism doesn't play nicely with trailing newlines or
tabs. A newline causes it to insert a null character, showing up as
`^@`.
|
|
|
|
|
|
|
| |
`lsp.util.buf_versions` was already derived from changedtick (`on_lines`
from `buf_attach` synced the version)
As far as I can tell there is no need to keep track of the state in a
separate table.
|
| |
|
|
|
|
|
|
|
|
| |
The `complete()` mechanism matches completion candidates against
the typed text, so strict pre-filtering isn't necessary.
This is a first step towards supporting postfix snippets (like
`items@insert` in luals)
|
| |
|
| |
|
|
|
| |
Co-authored-by: Jongwook Choi <wookayin@gmail.com>
|
|
|
| |
aligns with ":help dev-patterns"
|
| |
|
|
|
| |
vim.diagnostic.enable and vim.diagnostic.is_enabled() use the same pattern.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
Inlay hints `enable()` does not fully implement the `:help dev-lua` guidelines:
Interface conventions ~
- When accepting a buffer id, etc., 0 means "current buffer", nil means "all
buffers". Likewise for window id, tabpage id, etc.
- Examples: |vim.lsp.codelens.clear()| |vim.diagnostic.enable()|
Solution:
Implement globally enabling inlay hints.
* refactor(lsp): do not rely on `enable` to create autocmds
* refactor(lsp): make `bufstates` a defaulttable
* refactor(lsp): make `bufstate` inherit values from `globalstate`
* feat(lsp): `vim.lsp.inlay_hints` now take effect on all buffers by default
* test(lsp): add basic tests for enable inlay hints for all buffers
* test(lsp): add test cases cover more than one buffer
|
|
|
|
|
|
|
|
|
| |
Specifically, functions that are run in the context of the test runner
are put in module `test/testutil.lua` while the functions that are run
in the context of the test session are put in
`test/functional/testnvim.lua`.
Closes https://github.com/neovim/neovim/issues/27004.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
We need to establish a pattern for `enable()`.
Solution:
- First `enable()` parameter is always `enable:boolean`.
- Update `vim.diagnostic.enable()`
- Update `vim.lsp.inlay_hint.enable()`.
- It was not released yet, so no deprecation is needed. But to help
HEAD users, it will show an informative error.
- vim.deprecate():
- Improve message when the "removal version" is a *current or older* version.
|
| |
|
| |
|