aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/util.lua
Commit message (Collapse)AuthorAge
* 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
* 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
* 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): 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.
* refactor: use `vim._with` where possibledundargoc2024-06-28
| | | | | This mostly means replacing `nvim_buf_call` and `nvim_win_call` with `vim._with`.
* 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>
* 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
|
* fix(lsp): fix reverse sorting of same position text edits (#29212)Al Colmenar2024-06-07
| | | | | | | | Problem: Text edits with the same position (both line and character) were being reverse sorted prior to being applied which differs from the lsp spec Solution: Change the sort order for just the same position edits
* 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.
* fix(lsp): account for changedtick version gap on modified reset (#29170)Mathias Fußenegger2024-06-04
| | | | Follow up to https://github.com/neovim/neovim/pull/28943 Fixes https://github.com/neovim/neovim/issues/29163
* refactor(lsp): use predefined types in util function signatures (#29095)Ilia Choly2024-05-31
|
* 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.
* refactor: fix luals type warningsdundargoc2024-05-27
|
* feat: remove deprecated featuresdundargoc2024-05-16
| | | | | | | | | | | | | | | | | | | Remove following functions: - vim.lsp.util.extract_completion_items - vim.lsp.util.get_progress_messages - vim.lsp.util.parse_snippet() - vim.lsp.util.text_document_completion_list_to_complete_items - LanguageTree:for_each_child - health#report_error - health#report_info - health#report_ok - health#report_start - health#report_warn - vim.health.report_error - vim.health.report_info - vim.health.report_ok - vim.health.report_start - vim.health.report_warn
* docs: small fixes (#27364)dundargoc2024-03-12
| | | | | | | | Co-authored-by: C.D. MacEachern <craig.daniel.maceachern@gmail.com> Co-authored-by: Ynda Jas <yndajas@gmail.com> Co-authored-by: Owen Hines <TheOdd@users.noreply.github.com> Co-authored-by: Wanten <41904684+WantenMN@users.noreply.github.com> Co-authored-by: lukasvrenner <118417051+lukasvrenner@users.noreply.github.com> Co-authored-by: cuinix <915115094@qq.com>
* 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.