aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/lsp
Commit message (Collapse)AuthorAge
* fix(lsp): don't use completion filterText if prefix is emptyMathias Fussenegger2025-01-19
| | | | | | | | 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.
* fix(lsp): use filterText as word if textEdit/label doesn't matchMathias Fussenegger2025-01-17
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* fix(lsp): open_floating_preview() zindex relative to current window #31886luukvbaal2025-01-06
| | | | | 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.
* fix(lsp): reuse client if configs match and no root dirLewis Russell2024-12-13
| | | | | | | | | | | | 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
* fix: remove vim.lsp._with_extendLewis Russell2024-12-07
| | | | Not used anywhere.
* feat(lsp): deprecate vim.lsp.start_client #31341Maria José Solano2024-12-04
| | | | | | | | Problem: LSP module has multiple "start" interfaces. Solution: - Enhance vim.lsp.start - Deprecate vim.lsp.start_client
* feat(lsp): support `textDocument/foldingRange` (#31311)Yi Ming2024-11-29
| | | | | | | | | | | | | | | | | | | * 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
* fix(lsp): retrigger diagnostics request on server cancellation (#31345)Gregory Anders2024-11-25
| | | Co-authored-by: Jesse <github@jessebakker.com>
* refactor(lsp): rename `offset_encoding` to `position_encoding` #31286Yi Ming2024-11-25
| | | | | | | | 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`.
* fix(lsp): delete bufvar inside WinClosed eventglepnir2024-11-24
| | | | | | | | 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
* feat(lsp): deprecate non-method client functionsLewis Russell2024-11-20
| | | | | | | | | | | | | | 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.
* fix(tests): needing two calls to setup a screen is cringebfredl2024-11-14
| | | | | | | | | | 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.
* fix(lsp): filter completion candidates based on completeopt (#30945)Kristijan Husak2024-11-13
|
* feat(lsp)!: remove client-server handlers from vim.lsp.handlersLewis Russell2024-11-01
| | | | | | | | | | - 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).
* refactor(lsp): drop str_byteindex/str_utfindex wrappers #30915Tristan Knight2024-10-26
| | | | | * deprecate old signatures * move to new str_byteindex/str_utfindex signature * use single-underscore name (double-underscore is reserved for Lua itself)
* fix(lsp): fix cursor position after snippet expansion (#30659)Tomasz N2024-10-10
| | | | | | | | | | | | 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>
* vim-patch:9.1.0771: completion attribute hl_group is confusingzeertzjq2024-10-10
| | | | | | | | | | | | | 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>
* feat(lsp): improve LSP doc hover rendering #30695Justin M. Keyes2024-10-06
| | | | | | | | | | | | 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'.
* test: support upvalues in exec_luaLewis Russell2024-09-21
|
* feat(lsp): support hostname in rpc.connect #30238Tristan Knight2024-09-03
| | | | | | | | | | | | | | | 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.
* docs: misc #28970Justin M. Keyes2024-09-01
|
* fix(lsp): when prefix is non word add all result into matches (#30044)glepnir2024-08-30
| | | | | | | 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.
* feat(lsp): completion opts support custom item conversion (#30060)glepnir2024-08-22
| | | | | | | 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.
* test(lsp): refactor and tidyLewis Russell2024-08-11
| | | | | | | - Merge all the top level 'LSP' describe blocks - Refactor text edit tests - Fix typing errors - Add linebreaks between tests
* refactor(lsp): add test case for default diagnostic severityMathias Fussenegger2024-08-02
| | | | | | | | 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.
* fix(lsp): don't send foreign diagnostics to servers in buf.code_action (#29501)Mathias Fußenegger2024-08-01
| | | | | | | `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
* fix(lsp): prevent desync due to empty buffer (#29904)Jaehwang Jung2024-07-31
| | | | | | | | | | | | | | | 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.
* feat(lsp): lsp.completion support set deprecated (#29882)glepnir2024-07-31
| | | | | | Problem: CompletionItem in lsp spec mentioned the deprecated attribute Solution: when item has deprecated attribute set hl_group to DiagnosticDeprecated in complete function
* fix(lsp): inlay hints are rendered in the correct order (#29707)Amit Singh2024-07-17
| | | | | | | | | | | 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.
* fix(lsp): fallback to `label` for completion items if all others are missing ↵Sebastian Lyng Johansen2024-07-02
| | | | (#29522)
* fix(lsp): pre-filter matches on label if filterText is missing (#29491)Mathias Fußenegger2024-06-27
| | | | | | | | | | | 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
* fix(lsp): tune completion word extraction for decorated labels (#29331)Mathias Fußenegger2024-06-14
| | | | | | | | | | | | | | 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
* refactor(lsp): use metatable for buf_versions (#29304)Ilia Choly2024-06-14
| | | | | | 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>
* fix(lsp): revert buf_versions deprecation/replacement (#29217)Mathias Fußenegger2024-06-07
| | | | | | | | | * 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.
* refactor(lua): use tuple syntax everywhere #29111Ilia Choly2024-06-04
|
* fix(lsp): trim trailing whitespace from completion words (#29122)Mathias Fußenegger2024-06-02
| | | | | the `complete()` mechanism doesn't play nicely with trailing newlines or tabs. A newline causes it to insert a null character, showing up as `^@`.
* refactor(lsp): replace util.buf_versions with changedtick (#28943)Mathias Fußenegger2024-05-30
| | | | | | | `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.
* feat(lsp): support postfix snippets in completionMathias Fussenegger2024-05-30
|
* feat(lsp): use fuzzy match on filterText instead of prefix matchMathias Fussenegger2024-05-30
| | | | | | | | 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)
* test(lsp): add completion testsMaria José Solano2024-05-27
|
* feat(lsp): completion side effectsMaria José Solano2024-05-27
|
* fix(lsp): check if buffer was detached in on_init callback (#28914)Ilia Choly2024-05-23
| | | Co-authored-by: Jongwook Choi <wookayin@gmail.com>
* fix(lsp): semantic token functions allow "0" bufnr #28849Riley Bruins2024-05-21
| | | aligns with ":help dev-patterns"
* refactor(lua): remove deprecated features #28725Justin M. Keyes2024-05-13
|
* feat(lsp): inlay_hint.is_enabled({filter}) #28523Yi Ming2024-05-02
| | | vim.diagnostic.enable and vim.diagnostic.is_enabled() use the same pattern.
* feat(lsp): vim.lsp.inlay_hint.enable(nil) applies to all buffers #28543Yi Ming2024-05-02
| | | | | | | | | | | | | | | | | | 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
* test: improve test conventionsdundargoc2024-04-23
| | | | | | | | | 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.
* feat(lua): enable(enable:boolean, filter:table) #28374Justin M. Keyes2024-04-18
| | | | | | | | | | | | | 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.
* test: remove unnecessary nil argument to testutil (#28270)zeertzjq2024-04-11
|
* refactor(test): inject after_each differentlyLewis Russell2024-04-10
|