aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/util.lua
Commit message (Collapse)AuthorAge
* fix: resolve all remaining LuaLS diagnosticsLewis Russell2025-01-27
|
* fix(lsp): set floating window filetype after setup #32112Guilherme Soares2025-01-20
| | | | | | | | | Problem: The filetype for the floating window buffer is being set before its context is fully initialized. This results in `FileType` events not receiving the correct context. Solution: Set the filetype after the floating preview window and its buffer variables are fully configured to ensure proper context is provided.
* refactor: use nvim.foo.bar format for autocommand groupsMaria José Solano2025-01-14
|
* refactor: use nvim.foo.bar format for namespacesMaria José Solano2025-01-14
|
* fix(lsp): minimum height for floating popup #31990Xuyuan Pang2025-01-13
| | | | | | | | | Problem: The floating window for hover and signature help always cuts off a few lines, because the `_make_floating_popup_size` function counts empty lines as having zero height. Solution: Ensure the height is at least 1.
* docs: misc #31867Justin M. Keyes2025-01-09
|
* feat(health): show :checkhealth in floating window #31086glepnir2025-01-07
| | | | Problem: health can not shown in a floating window Solution: add g:health variable
* 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.
* refactor: add vim._resolve_bufnrLewis Russell2024-12-07
|
* fix(lsp): cancel pending requests before refreshingtris2032024-12-07
| | | | | | | | | | | Problem: Diagnostics and inlay hints can be expensive to calculate, and we shouldn't stack them as this can cause noticeable lag. Solution: Check for duplicate inflight requests and cancel them before issuing a new one. This ensures that only the latest request is processed, improving performance and preventing potential conflicts.
* fix(lsp): mention function name in warning #31301glepnir2024-11-27
| | | | | | Problem: The warning message is the same in different functions. It is not convenient to locate the specific function name Solution: add function name in warning message
* 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
* fix(lsp): delete b:lsp_floating_preview buf var after win closeglepnir2024-11-22
| | | | | | Problem: After floating preview window closed the buf var still exist Solution: delete after floating window closed.
* feat(lsp): require `offset_encoding` param #31249Yi Ming2024-11-20
| | | | | | | | | | | | | | | | | | | | | | | | Problem: Since [version 3.17](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocuments), LSP supports specifying the position encoding (aka offset encoding) supported by the client through `positionEncoding`. Since #31209, Nvim fully supports `utf-8`, `utf-16`, and `utf-32` encodings. Previously, nvim assumed all clients for a buffer had the same `offset_encoding`, so: * Nvim provides `vim.lsp._get_offset_encoding()` to get `offset_encoding`, but this function is incorrect because `offset_encoding` is per-client, not per-buffer. * Based on the strategy of `vim.lsp._get_offset_encoding()`, `vim.lsp.util.make_position_params()`, `vim.lsp.util.make_range_params()`, and `vim.lsp.util.make_given_range_params()` do not require the caller to pass `offset_encoding`, which is invalid. * https://github.com/neovim/neovim/issues/25272 Solution: * Mark `vim.lsp._get_offset_encoding()` as `@deprecated`. * Change the type annotations of `vim.lsp.util.make_position_params()`, `vim.lsp.util.make_range_params()`, `vim.lsp.util.make_given_range_params()` to require the `offset_encoding` param.
* 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.
* refactor(lsp): simplify reference range logicRiley Bruins2024-11-10
|
* feat(lsp): multi-client support for signature_helpLewis Russell2024-11-04
| | | | | Signatures can be cycled using `<C-s>` when the user enters the floating window.
* fix(lsp): hover border type can be string (#31013)nikolightsaber2024-11-01
| | | | | Border type can also be a string as defined in `api-win_config` Co-authored-by: Nikolai Devolder <nikolai.devolder@yamabiko.eu>
* docs(lsp): document alternative for vim.lsp.util.jump_to_locationMaria José Solano2024-10-27
|
* 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)
* refactor: rename vim.highlight => vim.hlJustin M. Keyes2024-10-21
| | | | | | | | | | | | Problem: - `vim.highlight` module does not follow `:help dev-name-common`, which documents the name for "highlight" as "hl". - Shorter names are usually preferred. Solution: Rename `vim.highlight` to `vim.hl`. This is not a breaking change until 2.0 (or maybe never).
* feat(lsp)!: support multiple clients in goto methods (#30877)Mathias Fußenegger2024-10-20
| | | | | | | | | | | | | | | Relates to: - https://github.com/neovim/neovim/issues/30034 - https://github.com/neovim/neovim/issues/17712 - https://github.com/neovim/neovim/issues/16363 Closes: - https://github.com/neovim/neovim/issues/26936 (but only provides bufnr and method) - https://github.com/neovim/neovim/issues/22318 Might fix: https://github.com/neovim/neovim/issues/30737
* fix(lsp.util): wrong arguments to 'validate' functiontemhelk2024-10-18
|
* Merge pull request #30825 from lewis6991/refactor/lsputilLewis Russell2024-10-17
|\
| * feat(lsp.util): minor codestyleLewis Russell2024-10-17
| |
| * feat(lsp.util): improve offset_encoding type annotationsLewis Russell2024-10-17
| |
| * feat(lsp.util): remove some variablesLewis Russell2024-10-17
| |
| * feat(lsp.util): use vim.w/bLewis Russell2024-10-17
| |
| * feat(lsp.util): remove some aliasesLewis Russell2024-10-17
| |
| * feat(lsp.util): remove unneeded tableLewis Russell2024-10-17
| |
| * fix(lsp.util): inconsistent handling of offset_encodingLewis Russell2024-10-17
| |
| * feat(lsp.util): get_bufs_with_prefix -> get_writeable_bufsLewis Russell2024-10-17
| |
| * feat(lsp.util): refactor get_border_size()Lewis Russell2024-10-17
| |
| * feat(lsp.util): simplify some bounds checkingLewis Russell2024-10-17
| |
| * feat(lsp.util): remove metatable in locations_to_itemsLewis Russell2024-10-17
| |
| * feat(lsp.util): refactor symbols_to_items()Lewis Russell2024-10-17
| | | | | | | | | | - Remove the trivial function vim.lsp.util._get_symbol_kind_name() and its tests.
| * feat(lsp.util): remove uneeded do-endLewis Russell2024-10-17
| |
| * feat(lsp.util): use vim.api aliasLewis Russell2024-10-17
| |
| * feat(lsp.util): fix type errorsLewis Russell2024-10-17
| |
| * feat(lsp.util): remove lsp spec extractLewis Russell2024-10-16
| |
| * feat(lsp.util): use faster version of vim.validateLewis Russell2024-10-16
| |
* | fix(lsp): str_byteindex_enc bounds checking #30747Tristan Knight2024-10-16
|/ | | | | | | | | Problem: Previously the index was only checked against the UTF8 length. This could cause unexpected behaviours for strings containing multibyte chars Solution: Check indicies correctly against their max value before returning the fallback length
* fix(lsp): handle multiline signature help labels #30460Maria José Solano2024-10-15
|
* fix(lsp): set 'smoothscroll' in docs hover #30748Justin M. Keyes2024-10-11
|
* 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'.
* feat(fs.lua): add vim.fs.rm()Lewis Russell2024-09-22
| | | | Analogous to the shell `rm` command.
* 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 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