aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin
Commit message (Collapse)AuthorAge
...
* 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
* test: allow exec_lua to handle functionsLewis Russell2024-08-02
| | | | | | | | | | | Problem: Tests have lots of exec_lua calls which input blocks of code provided as unformatted strings. Solution: Teach exec_lua how to handle functions.
* 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): 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(tohtml): support ranges againaltermo2024-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`.
* Merge pull request #29483 from bfredl/nonbinarybfredl2024-06-27
|\ | | | | refactor(typval)!: remove binary distinction of binary and nonbinary strings
| * refactor(typval)!: remove distinction of binary and nonbinary stringsbfredl2024-06-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a breaking change which will make refactor of typval and shada code a lot easier. In particular, code that would use or check for v:msgpack_types.binary in the wild would be broken. This appears to be rarely used in existing plugins. Also some cases where v:msgpack_type.string would be used to represent a binary string of "string" type, we use a BLOB instead, which is vimscripts native type for binary blobs, and already was used for BIN formats when necessary. msgpackdump(msgpackparse(data)) no longer preserves the distinction of BIN and STR strings. This is very common behavior for language-specific msgpack bindings. Nvim uses msgpack as a tool to serialize its data. Nvim is not a tool to bit-perfectly manipulate arbitrary msgpack data out in the wild. The changed tests should indicate how behavior changes in various edge cases.
* | 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
* 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>
* feat(lsp): include end_col, end_lnum in vim.lsp.buf.locations_to_items #29164Tom Praschan2024-06-09
|
* fix(man): filter OSC 8 hyperlink markup #29171Lennard Hofmann2024-06-07
| | | | | Problem: `man cmake` shows "8;;https://cmake.orghttps://cmake.org8;;" Solution: Remove noise so that it shows as "https://cmake.org". See also: https://en.wikipedia.org/wiki/ANSI_escape_code#OSC
* 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.
* feat(editorconfig): add support for spelling_language (#28638)sus-domesticus2024-06-06
|
* 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(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)
* Merge pull request #27339 from MariaSolOs/completionGregory Anders2024-05-28
|\ | | | | feat(lsp): completion side effects
| * test(lsp): add completion testsMaria José Solano2024-05-27
| |
| * feat(lsp): completion side effectsMaria José Solano2024-05-27
| |
* | fix(lsp): do not detach from buffer if there are uninitialized clients (#29029)Ilia Choly2024-05-27
| | | | | | | | | | Problem: if on_lines is called before the LSP is initialized, the buffer is detached. Solution: check for uninitialized clients before detaching.
* | fix(tohtml): properly handle multiple hl groups #29012Riley Bruins2024-05-26
|/ | | | | | | | | Problem: :TOhtml doesn't properly handle virtual text when it has multiple highlight groups. It also improperly calculates position offset for multi-byte virt_text characters. Solution: Apply the `vim.api.nvim_strwidth` broadly to properly calculate character offset, and handle the cases where the `hl` argument can be a table of multiple hl groups.
* fix: change deprecation presentationdundargoc2024-05-24
| | | | | | | | | | | | | | Deprecation with vim.deprecate is currently too noisy. Show the following warning instead: [function] is deprecated. Run ":checkhealth vim.deprecated" for more information. The important part is that the full message needs to be short enough to fit in one line in order to not trigger the "Press ENTER or type command to continue" prompt. The full information and stack trace for the deprecated functions will be shown in the new healthcheck `vim.deprecated`.
* 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): trigger LspDetach on buffer delete (#28795)Andre Toerien2024-05-23
| | | Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
* fix: merge all provider healthchecks into a single health.luadundargoc2024-05-22
| | | | | | | | | | | | | | | | | | | | | | | | | This will help manage the overly granular checkhealth completion to go from ``` vim.health vim.lsp vim.provider.clipboard vim.provider.node vim.provider.perl vim.provider.python vim.provider.ruby vim.treesitter ``` to ``` vim.health vim.lsp vim.provider vim.treesitter ```
* fix(lsp): semantic token functions allow "0" bufnr #28849Riley Bruins2024-05-21
| | | aligns with ":help dev-patterns"
* refactor!: remove `nvim` and `provider` module for checkhealthdundargoc2024-05-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The namespacing for healthchecks for neovim modules is inconsistent and confusing. The completion for `:checkhealth` with `--clean` gives ``` nvim provider.clipboard provider.node provider.perl provider.python provider.ruby vim.lsp vim.treesitter ``` There are now three top-level module names for nvim: `nvim`, `provider` and `vim` with no signs of stopping. The `nvim` name is especially confusing as it does not contain all neovim checkhealths, which makes it almost a decoy healthcheck. The confusion only worsens if you add plugins to the mix: ``` lazy mason nvim nvim-treesitter provider.clipboard provider.node provider.perl provider.python provider.ruby telescope vim.lsp vim.treesitter ``` Another problem with the current approach is that it's not easy to run nvim-only healthchecks since they don't share the same namespace. The current approach would be to run `:che nvim vim.* provider.*` and would also require the user to know these are the neovim modules. Instead, use this alternative structure: ``` vim.health vim.lsp vim.provider.clipboard vim.provider.node vim.provider.perl vim.provider.python vim.provider.ruby vim.treesitter ``` and ``` lazy mason nvim-treesitter telescope vim.health vim.lsp vim.provider.clipboard vim.provider.node vim.provider.perl vim.provider.python vim.provider.ruby vim.treesitter ``` Now, the entries are properly sorted and running nvim-only healthchecks requires running only `:che vim.*`.
* refactor(lua): remove deprecated features #28725Justin M. Keyes2024-05-13
|
* fix(lsp): disable didChangeWatchedFiles on LinuxLewis Russell2024-05-10
| | | | | | | | | | | | | Problem: The file watcher backends for Linux have too many limitations and doesn't work reliably. Solution: disable didChangeWatchedFiles on Linux Ref: #27807, #28058, #23291, #26520
* 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
* fix(man.vim): q quits after jump to different tag in MANPAGER modified (#28495)Brian Cao2024-04-26
|
* refactor(lsp): merge subtypes and supertypes into typehierarchy (#28467)Mathias Fußenegger2024-04-23
| | | | Both methods had pretty much the same documentation and shared the implementation.
* 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.
* fix(completion): check that healthcheck name is string (#28458)zeertzjq2024-04-22
|
* feat(lsp): add vim.lsp.buf.subtypes(), vim.lsp.buf.supertypes() (#28388)Yinzuo Jiang2024-04-20
| | | | Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com> Co-authored-by: Maria José Solano <majosolano99@gmail.com>
* 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.