aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/lsp_spec.lua
Commit message (Collapse)AuthorAge
...
* refactor(lsp): simplify client trackingLewis Russell2024-03-25
| | | | | | | | | | | - Remove: - uninitialized_clients - active_clients - all_buffer_active_clients - Add: - all_clients - Use `lsp.get_clients()` to get buffer clients.
* test(lsp): fix flaky basic_finish test (#27899)zeertzjq2024-03-18
| | | | | | | | | | Problem: As mentioned in #23002 on_setup and on_init are run concurrently. However, in basic_finish tests on_setup must attach the client before on_init finishes. The other basic_finish test isn't flaky because it makes an RPC request in on_init. Solution: Don't use on_setup in basic_finish tests.
* fix(lsp): create codelens request parameters for each buffer (#27699)Takuya Tokuda2024-03-17
|
* test: correct order of arguments to eq() (#27816)zeertzjq2024-03-11
|
* fix(lsp): directly rename the existing buffers when renaming (#27690)Jaehwang Jung2024-03-02
| | | | | | | | | | | | | | | | Problem: `vim.lsp.util.rename()` deletes the buffers that are affected by renaming. This has undesireable side effects. For example, when renaming a directory, all buffers under that directory are deleted and windows displaying those buffers are closed. Also, buffer options may change after renaming. Solution: Rename the buffers with :saveas. An alternative approach is to record all the relevant states and restore it after renaming, but that seems to be more complex. In fact, the older version was attempting to restore the states but only partially and incorrectly.
* feat(lsp): add fswatch watchfunc backendLewis Russell2024-03-01
| | | | | | | | | | | Problem: vim._watch.watchdirs has terrible performance. Solution: - On linux use fswatch as a watcher backend if available. - Add File watcher section to health:vim.lsp. Warn if watchfunc is libuv-poll.
* fix(lsp): cancel watchers when closing a clientLewis Russell2024-03-01
|
* refactor(watch): general tidy upLewis Russell2024-03-01
| | | | | | - Rename watch.poll to watch.watchdirs - Unify how include and exclude is applied - Improve type hints
* fix(lsp): rename undofile when renaming (#27684)Jaehwang Jung2024-03-01
| | | | | | | Problem: After `rename()`, the undo information for the renamed file(s) are lost. Solution: Rename the undofile as well.
* fix(lsp): remove unnecessary file load/write when renaming (#27621)Jaehwang Jung2024-02-28
| | | | | | | | | Previously rename would unconditionally read the to-be-renamed file from the disk and write it to the disk. This is redundant in some cases If the file is not already loaded, it's not attached to lsp client, so nvim doesn't need to care about this file. If the file is loaded but has no change, it doesn't need to be written.
* fix(lsp): when renaming directory, check path prefix of buffer names (#27603)Jaehwang Jung2024-02-24
| | | | | For example, when renaming /path/to/dir, buffers like fern://drawer/file:///path/to/dir, /path/to/dir123 should not be matched.
* fix(lsp): rename: load and list new buffer if attached to window (#27408)Tomasz N2024-02-14
|
* refactor(lsp): resolve the config-client entanglementLewis Russell2024-02-13
| | | | | | | | | | | | | | | | | | | | | Previously the LSP-Client object contained some fields that are also in the client config, but for a lot of other fields, the config was used directly making the two objects vaguely entangled with either not having a clear role. Now the config object is treated purely as config (read-only) from the client, and any fields the client needs from the config are now copied in as additional fields. This means: - the config object is no longet normalised and is left as the user provided it. - the client only reads the config on creation of the client and all other implementations now read the clients version of the fields. In addition, internal support for multiple callbacks has been added to the client so the client tracking logic (done in lua.lsp) can be done more robustly instead of wrapping the user callbacks which may error.
* refactor(lsp): move more code to client.luaLewis Russell2024-02-11
| | | | | | | | | | | | The dispatchers used by the RPC client should be defined in the client, so they have been moved there. Due to this, it also made sense to move all code related to client configuration and the creation of the RPC client there too. Now vim.lsp.start_client is significantly simplified and now mostly contains logic for tracking open clients. - Renamed client.new -> client.start
* test(lsp): add test cases for vim.lsp.tagfuncJongwook Choi2024-02-03
| | | | | | | Problem: There is no test case for vim.lsp.tagfunc; so CI was unable to catch the infinite loop bug (#27325). Solution: Add test cases for vim.lsp.tagfunc().
* docs: various #25289Justin M. Keyes2024-01-18
| | | | | | Co-authored-by: Jongwook Choi <wookayin@gmail.com> Co-authored-by: Oliver Marriott <hello@omarriott.com> Co-authored-by: Benoit de Chezelles <bew@users.noreply.github.com> Co-authored-by: Jongwook Choi <wookayin@gmail.com>
* test: rename (meths, funcs) -> (api, fn)Lewis Russell2024-01-12
|
* test: typing for helpers.methsLewis Russell2024-01-12
|
* test: do not inject vim module into global helpersLewis Russell2024-01-12
|
* refactor: format test/*Justin M. Keyes2024-01-03
|
* feat(lsp): support connect via named pipes/unix domain sockets (#26032)TheLeoP2024-01-02
| | | | | Closes https://github.com/neovim/neovim/issues/26031 Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
* fix(lsp): filetype matching to documentSelector in dynamic capabilities (#25425)Michal Liszcz2023-12-22
| | | | | | | Use the get_language_id client option to resolve the filetype when matching the document selector in a dynamic capability. Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
* test: skip failing watch file tests on freebsd (#26110)Mathias Fußenegger2023-11-19
| | | | | | | | | Quick fix as follow up to https://github.com/neovim/neovim/pull/26108 kqueue only reports events on a watched folder itself, not for files created or deleted within. So the approach the PR took doesn't work on FreeBSD. We'll either need to bring back polling for it, combine watching with manual file tracking, or disable LSP file watching on FreeBSD
* feat(lsp)!: vim.lsp.inlay_hint.get(), enable(), is_enabled() #25512LW2023-11-12
| | | | | | | | | | | | | | | | | | refactor!: `vim.lsp.inlay_hint()` -> `vim.lsp.inlay_hint.enable()` Problem: The LSP specification allows inlay hints to include tooltips, clickable label parts, and code actions; but Neovim provides no API to query for these. Solution: Add minimal viable extension point from which plugins can query for inlay hints in a range, in order to build functionality on top of. Possible Next Steps --- - Add `virt_text_idx` field to `vim.fn.getmousepos()` return value, for usage in mappings of `<LeftMouse>`, `<C-LeftMouse>`, etc
* fix(lsp): fix off-by-one error for omnifunc word boundaryMathias Fussenegger2023-10-23
| | | | | | | | Fixes https://github.com/neovim/neovim/issues/25177 I initially wanted to split this into a refactor commit to make it more testable, but it appears that already accidentally fixed the issue by normalizing lnum/col to 0-indexing
* refactor(lsp): deprecate completion util methodsMathias Fussenegger2023-10-21
| | | | Relates to https://github.com/neovim/neovim/issues/25272
* fix(lsp): handle NUL bytes in popup text (#25612)zeertzjq2023-10-12
| | | Fix #25610
* feat(lsp)!: replace snippet parser by lpeg grammarMaria José Solano2023-10-02
|
* feat(lsp): fallback to code-action command on resolve failure (#25464)Mathias Fußenegger2023-10-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The haskell-language-server supports resolve only for a subset of code actions. For many code actions trying to resolve the `edit` property results in an error, but the unresolved action already contains a command that can be executed without issue. The protocol specification is unfortunately a bit vague about this, and what the haskell-language-server does seems to be valid. Example: newtype Dummy = Dummy Int instance Num Dummy where Triggering code actions on "Num Dummy" and choosing "Add placeholders for all missing methods" resulted in: -32601: No plugin enabled for SMethod_CodeActionResolve, potentially available: explicit-fields, importLens, hlint, overloaded-record-dot With this change it will insert the missing methods: instance Num Dummy where (+) = _ (-) = _ (*) = _ negate = _ abs = _ signum = _ fromInteger = _
* fix(lsp): handle absence of a trailing newline #25194Sergey Slipchenko2023-09-21
| | | | | | | | | | | | Fixes #24339 rust-analyzer sends "Invalid offset" error in such cases. Some other servers handle it specially. LSP spec mentions that "A range is comparable to a selection in an editor". Most editors don't handle trailing newlines the same way Neovim/Vim does, it's clearly visible if it's present or not. With that in mind it's understandable why sending end position as simply the start of the line after the last one is considered invalid in such cases.
* feat(lsp): use treesitter for stylize markdownMaria José Solano2023-09-19
|
* fix(api): more intuitive cursor updates in nvim_buf_set_textSergey Slipchenko2023-09-11
| | | | Fixes #22526
* feat(lsp): add original LSP Location as item's user_data in ↵Tom Praschan2023-09-07
| | | | locations_to_items (#23743)
* fix(lsp): do not assume client capability exists in watchfiles check (#24550)Sean Dewar2023-08-04
| | | | | | | | | | | | | | | | | | | | | PR #23689 assumes `client.config.capabilities.workspace.didChangeWatchedFiles` exists when checking `dynamicRegistration`, but thats's true only if it was passed to `vim.lsp.start{_client}`. This caused #23806 (still an issue in v0.9.1; needs manual backport), but #23681 fixed it by defaulting `config.capabilities` to `make_client_capabilities` if not passed to `vim.lsp.start{_client}`. However, the bug resurfaces on HEAD if you provide a non-nil `capabilities` to `vim.lsp.start{_client}` with missing fields (e.g: not made via `make_client_capabilities`). From what I see, the spec says such missing fields should be interpreted as an absence of the capability (including those indicated by missing sub-fields): https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#clientCapabilities Also, suggest `vim.empty_dict()` for an empty dict in `:h vim.lsp.start_client()` (`{[vim.type_idx]=vim.types.dictionary}` no longer works anyway, probably since the cjson switch).
* fix(lsp): SignatureHelp docstring is not escaped #16702Christoph Hasse2023-07-25
| | | | | | | | | | | | | Problem: Nvim LSP client always treats signature.documentation as markdown, even if the server returns a plain string. Per https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#signatureInformation in a SignatureInformation response, the documentation field can be either "string" or "MarkupContent". Solution: If signature.documentation is a string, treat it as "plaintext". Closes #16563
* feat(lsp)!: rename vim.lsp.get_active_clients to get_clients (#24113)Mathias Fußenegger2023-07-17
|
* feat(lsp): map K to hover by default #24331Mathias Fußenegger2023-07-14
| | | Related: https://github.com/neovim/neovim/issues/24252
* fix(lsp): always return boolean in lsp.buf_client_attach (#24077)Sooryakiran Ponnath2023-06-20
| | | Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
* fix(lsp): allow Lua pattern chars in code action filter (#24041)Jonas Strittmatter2023-06-17
| | | | | | | Previously, filtering code actions with the "only" option failed if the code action kind contained special Lua pattern chars such as "-" (e.g. the ocaml language server supports a "type-annotate" code action). Solution: use string comparison instead of string.find
* feat(lsp): add handlers for inlay hints (#23736)Chinmay Dalal2023-06-11
| | | initial support; public API left for a follow-up PR
* fix(lsp): set extra info only when it has a value (#23868)Raphael2023-06-05
|
* fix(lsp): restore marks after apply_text_edits() #14630Folke Lemaitre2023-06-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | PROBLEM: Whenever any text edits are applied to the buffer, the `marks` part of those lines will be lost. This is mostly problematic for code formatters that format the whole buffer like `prettier`, `luafmt`, ... When doing atomic changes inside a vim doc, vim keeps track of those changes and can update the positions of marks accordingly, but in this case we have a whole doc that changed. There's no simple way to update the positions of all marks from the previous document state to the new document state. SOLUTION: * save marks right before `nvim_buf_set_lines` is called inside `apply_text_edits` * check if any marks were lost after doing `nvim_buf_set_lines` * restore those marks to the previous positions TEST CASE: * have a formatter enabled * open any file * create a couple of marks * indent the whole file to the right * save the file Before this change: all marks will be removed. After this change: they will be preserved. Fixes #14307
* feat(lua): rename vim.loop -> vim.uv (#22846)Lewis Russell2023-06-03
|
* feat(lsp): set client offset_encoding if server supports positionEncodingGregory Anders2023-06-01
| | | | | | If the server sends the positionEncoding capability in its initialization response, automatically set the client's offset_encoding to use the value provided.
* feat(lsp)!: promote LspRequest to a full autocmd and enrich with additional ↵jdrouhard2023-05-30
| | | | | | | | | | | | | | | | | | | | | data (#23694) BREAKING CHANGE: LspRequest is no longer a User autocmd but is now a first class citizen. LspRequest as a User autocmd had limited functionality. Namely, the only thing you could do was use the notification to do a lookup on all the clients' requests tables to figure out what changed. Promoting the autocmd to a full autocmd lets us set the buffer the request was initiated on (so people can set buffer-local autocmds for listening to these events). Additionally, when used from Lua, we can pass additional metadata about the request along with the notification, including the client ID, the request ID, and the actual request object stored on the client's requests table. Users can now listen for these events and act on them proactively instead of polling all of the requests tables and looking for changes.
* feat(lsp): initial support for dynamic capabilities (#23681)Folke Lemaitre2023-05-28
| | | | | | | | | | | | - `client.dynamic_capabilities` is an object that tracks client register/unregister - `client.supports_method` will additionally check if a dynamic capability supports the method, taking document filters into account. But only if the client enabled `dynamicRegistration` for the capability - updated the default client capabilities to include dynamicRegistration for: - formatting - rangeFormatting - hover - codeAction - hover - rename
* refactor(options): deprecate nvim[_buf|_win]_[gs]et_optionLewis Russell2023-05-21
| | | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: famiu <famiuhaque@protonmail.com>
* fix(lsp): don't register didChangeWatchedFiles when capability not set (#23689)Jon Huhn2023-05-20
| | | | | | | Some LSP servers (tailwindcss, rome) are known to request registration for `workspace/didChangeWatchedFiles` even when the corresponding client capability does not advertise support. This change adds an extra check in the `client/registerCapability` handler not to start a watch unless the client capability is set appropriately.
* fix(lsp): fix relative patterns for `workspace/didChangeWatchedFiles` (#23548)Jon Huhn2023-05-09
|
* test(lsp): fix unstable tests for set_defaults (#23002)Michal Liszcz2023-04-11
| | | | | | | | | | In the `test_rpc_server` procedure, both `on_setup` and `on_init` callbacks can run concurrently in some scenarios. This caused some CI failures in tests for the LSP set_defaults feature. This commit attempts to fix this by merging those two callbacks in the impacted tests. See: https://github.com/neovim/neovim/actions/runs/4553550710/attempts/1