aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp
Commit message (Collapse)AuthorAge
...
* fix(lsp): set 'smoothscroll' in docs hover #30748Justin M. Keyes2024-10-11
|
* 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>
* fix(lsp): tagfunc fails in unusual buffer #30700Justin M. Keyes2024-10-07
| | | | | | | | | | | | | | | | Problem: tagfunc failed in a weird buffer (either a directory or some other non-file buffer, I don't remember): E987: Invalid return value from tagfunc E5108: Error executing lua …/runtime/lua/vim/lsp/util.lua:311: EISDIR: illegal operation on a directory stack traceback: at this line: local data = assert(uv.fs_read(fd, stat.size, 0)) Solution: Check for directory.
* 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'.
* fix(lsp): enable `additionalPropertiesSupport`Yi Ming2024-10-04
|
* docs: improve luacats support #30580James Trew2024-10-03
| | | | | | | Some composite/compound types even as basic as `(string|number)[]` are not currently supported by the luacats LPEG grammar used by gen_vimdoc. It would be parsed & rendered as just `string|number`. Changeset adds better support for these types.
* Merge #30435 refactor: rename "Dictionary" => "Dict"Justin M. Keyes2024-09-23
|\
| * refactor(api)!: rename Dictionary => DictJustin M. Keyes2024-09-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In the api_info() output: :new|put =map(filter(api_info().functions, '!has_key(v:val,''deprecated_since'')'), 'v:val') ... {'return_type': 'ArrayOf(Integer, 2)', 'name': 'nvim_win_get_position', 'method': v:true, 'parameters': [['Window', 'window']], 'since': 1} The `ArrayOf(Integer, 2)` return type didn't break clients when we added it, which is evidence that clients don't use the `return_type` field, thus renaming Dictionary => Dict in api_info() is not (in practice) a breaking change.
* | fix(vim.fs): dirname() returns "." on mingw/msys2 #30480Justin M. Keyes2024-09-23
|/ | | | | | | | | | Problem: `vim.fs.dirname([[C:\User\XXX\AppData\Local]])` returns "." on mingw/msys2. Solution: - Check for "mingw" when deciding `iswin`. - Use `has("win32")` where possible, it works in "fast" contexts since b02eeb6a7281df0561a021d7ae595c84be9a01be.
* feat(fs.lua): add vim.fs.rm()Lewis Russell2024-09-22
| | | | Analogous to the shell `rm` command.
* docs(lsp): hover window controls #30347Tristan Knight2024-09-19
|
* fix(lsp): handle nil bytes in stringsMathias Fussenegger2024-09-13
| | | | | | | | | | | | | | | | | | | | | Problem: The LSP omnifunc can insert nil bytes, which when read in other places (like semantic token) could cause an error: semantic_tokens.lua:304: Vim:E976: Using a Blob as a String Solution: Use `#line` instead of `vim.fn.strlen(line)`. Both return UTF-8 bytes but the latter can't handle nil bytes. Completion candidates can currently insert nil bytes, if other parts of Alternative fix to https://github.com/neovim/neovim/pull/30359 Note that https://github.com/neovim/neovim/pull/30315 will avoid the insertion of nil bytes from the LSP omnifunc, but the change of this PR can more easily be backported.
* fix(lsp): handle empty call hierarchy items #30349James Trew2024-09-13
| | | | | Ensure that the function `pick_call_hierarchy_item` correctly handles the case where `call_hierarchy_items` is nil or an empty table. This prevents potential errors when the function is called with no items.
* fix(lsp): check buffer is loaded and valid #30330glepnir2024-09-11
| | | | | Problem: buffer mabye not valid when callback handler invoke. Soliton: check buffer is valid and loaded in handler.
* fix(lsp): handle encoding bounds in str_utfindex_enctris2032024-09-10
| | | | | | | | | | Problem: str_utfindex_enc could return an error if the index was longer than the line length. This was handled in each of the calls to it individually Solution: * Fix the call at the source level so that if the index is higher than the line length, utf length is returned
* fix(lsp): handle out-of-bounds character positions #30288Tristan Knight2024-09-08
| | | | | | | | | | | Problem: str_byteindex_enc could return an error if the index was longer than the lline length. This was handled in each of the calls to it individually Solution: * Fix the call at the source level so that if the index is higher than the line length, line length is returned as per LSP specification * Remove pcalls on str_byteindex_enc calls. No longer needed now that str_byteindex_enc has a bounds check.
* fix(lsp): handle locations exceeding line length #30253Tristan Knight2024-09-05
| | | | | | | | | | | Problem: LSP spec [states](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#position) that "if the character value is greater than the line length it defaults back to the line length", but `locations_to_items` fails in that case. Solution: Adjust locations_to_items to follow the spec. closes #28281
* 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: vim.lsp.rpc.connect() TCP requires IP address #30219Tristan Knight2024-09-01
| | | | | | "localhost" would work if we used [tcp_connect](https://github.com/luvit/luv/blob/ae0387742b460bc89ebddce33214ad65fffddba2/examples/echo-server-client.lua#L42), but that will require changes to [vim.lsp.rpc.connect](https://github.com/neovim/neovim/blob/318c0415d5b10b44fee4afa06994734f1beb7e71/runtime/lua/vim/lsp/rpc.lua#L638).
* 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): export diagnostic conversion functions (#30064)Maria José Solano2024-08-27
|
* fix(lsp): return call hierarchy item, not the index (#30145)Maria José Solano2024-08-26
|
* fix(lsp): log when receiving markup messages (#30065)Maria José Solano2024-08-26
|
* fix(lsp): fix isIncomplete condition in completion trigger (#30130)Mathias Fußenegger2024-08-26
| | | Follow up to https://github.com/neovim/neovim/pull/30028#discussion_r1726539370
* 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.
* fix(lsp): suppress completion request if completion is active (#30028)glepnir2024-08-22
| | | | | | | Problem: the autotrigger mechanism could fire completion requests despite completion already being active from another completion mechanism or manual trigger Solution: add a condition to avoid an additional request.
* docs(lsp): annotate with `vim.lsp.protocol.Methods` enum #29521Ricardo Casía2024-08-20
| | | Added the enum type annotation `vim.lsp.protocol.Methods` to provide some intellisense support.
* 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
* fix(lsp): avoid reusing diagnostics from different servers in actions (#30002)Grzegorz Rozdzialik2024-08-07
| | | | | | | | | | | | | | | | Problem: When preparing the parameters for a code actions LSP request, the code set `context.diagnostics` when processing the first LSP client, and then reused those `context.diagnostics` for subsequent LSP clients. This meant that the second and next LSP clients got diagnostics that did not originate from them, and they did not get the diagnostics that they sent. Solution: Avoid setting `context.diagnostics` (which is referenced by all clients). Instead, set `params.context.diagnostics` directly, which is specific to a single client. Fixes #30001 Caused by #29501
* fix(lsp): redundant spaces in lsp log (#29970)Jaehwang Jung2024-08-03
|
* feat(lsp): announce codeLens resolveSupport (#29956)Mathias Fußenegger2024-08-03
| | | | | | | The codelens implementation can resolve command via `codeLens/resolve`. The spec added client capabilities for that: https://github.com/microsoft/language-server-protocol/pull/1979
* 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): revert text edit application order change (#29877)Mathias Fußenegger2024-07-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reverts https://github.com/neovim/neovim/pull/29212 and adds a few additional test cases From the spec > All text edits ranges refer to positions in the document they are > computed on. They therefore move a document from state S1 to S2 without > describing any intermediate state. Text edits ranges must never overlap, > that means no part of the original document must be manipulated by more > than one edit. However, it is possible that multiple edits have the same > start position: multiple inserts, or any number of inserts followed by a > single remove or replace edit. If multiple inserts have the same > position, the order in the array defines the order in which the inserted > strings appear in the resulting text. The previous fix seems wrong. The important part: > If multiple inserts have the same position, the order in the array > defines the order in which the inserted strings appear in the > resulting text. Emphasis on _appear in the resulting text_ Which means that in: local edits1 = { make_edit(0, 3, 0, 3, { 'World' }), make_edit(0, 3, 0, 3, { 'Hello' }), } `World` must appear before `Hello` in the final text. That means the old logic was correct, and the fix was wrong.
* 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): don't show codelens for buffers that don't support it (#29690)Riley Bruins2024-07-16
|
* feat(lsp): drop fswatch, use inotifywait (#29374)Andreas Schneider2024-07-06
| | | | | | | | | | | | | | This patch replaces fswatch with inotifywait from inotify-toools: https://github.com/inotify-tools/inotify-tools fswatch takes ~1min to set up recursively for the Samba source code directory. inotifywait needs less than a second to do the same thing. https://github.com/emcrisostomo/fswatch/issues/321 Also it fswatch seems to be unmaintained in the meantime. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
* fix(lsp): fallback to `label` for completion items if all others are missing ↵Sebastian Lyng Johansen2024-07-02
| | | | (#29522)
* refactor: use `vim._with` where possibledundargoc2024-06-28
| | | | | This mostly means replacing `nvim_buf_call` and `nvim_win_call` with `vim._with`.
* 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
* feat(lsp): vim.lsp.buf.format() supports textDocument/rangesFormatting #27323Tom Praschan2024-06-24
| | | | | | | | | | While this relies on a proposed LSP 3.18 feature, it's fully backwards compatible, so IMO there's no harm in adding this already. Looks like some servers already support for this e.g. - gopls: https://go-review.googlesource.com/c/tools/+/510235 - clangd: https://github.com/llvm/llvm-project/pull/80180 Fixes #27293
* docs: misc (#29229)dundargoc2024-06-15
| | | | | | Co-authored-by: Ilia Choly <ilia.choly@gmail.com> Co-authored-by: Jose Pedro Oliveira <jose.p.oliveira.oss@gmail.com> Co-authored-by: Maria José Solano <majosolano99@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* 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): check for nil response from server (#29196)Tama McGlinn2024-06-14
| | | | | | | | this only changes the error message, so that it is clear that the error is with the LSP server, rather than being a crash inside nvim runtime scripts. We are already doing a lot of validation, it's just that nil was being overlooked here. This fixes issue #27395
* refactor(lua): improve type annotationsLewis Russell2024-06-11
|
* feat(lsp): include end_col, end_lnum in vim.lsp.buf.locations_to_items #29164Tom Praschan2024-06-09
|