aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/lsp_spec.lua
Commit message (Collapse)AuthorAge
...
| * lsp: add incremental text synchronizationMichael Lingelbach2021-03-09
| | | | | | | | | | * Implementation derived from and validated by vim-lsc authored by Nate Bosch
* | state: throttle batched event processing when input is availableBjörn Linse2021-03-08
|/ | | | | | | before, calling vim.schedule() from inside an event would execute the scheduled callback immediately after this event without checking for user input in between. Break event processing whenever user input or an interrupt is available.
* LSP: Resolve text_document_save capability according to specMathias Fussenegger2021-02-25
| | | | | Fixes https://github.com/neovim/neovim/issues/13989 See https://github.com/microsoft/language-server-protocol/issues/288
* lsp: remove deprecated references to 'callbacks' (#13945)Matthieu Coudron2021-02-23
| | | | | vim.lsp.callbacks was deprecated a few months ago. This is a cleanup before the release. Use vim.lsp.handlers instead.
* lsp: Fix text edits operating on the last line of a document (#13677)Mathias Fußenegger2021-02-19
| | | | | | `lines` can be empty, in which case `#lines[#lines]` failed with an error: lsp/util.lua:214: attempt to get length of a nil value
* lsp/tests: Ensure client is stopped in basic_init tests (#13798)Mathias Fußenegger2021-01-27
|
* LSP: Fix nil settings handling in workspace/configuration (#13708)Mathias Fußenegger2021-01-18
| | | | | | | | | The `workspace/configuration` handler could fail with the following error if `config.settings` is nil: runtime/lua/vim/lsp/util.lua:1432: attempt to index local 'settings' (a nil value)" This ensures that `config.settings` is always initialized to an empty table.
* fix(lsp): Allow subsequent text document edits to pass (#13534)TJ DeVries2021-01-11
| | | | | | | * fix: Allow subsequent text document edits to pass * fixup: cleaner code * add tests
* LSP: add test for workspace/configuration handlerMichael Lingelbach2021-01-01
|
* lsp: Fix "unsupported_method" error when the buffer does not have an LSP ↵eightpigs2020-12-03
| | | | Server (#13175)
* lsp: vim.lsp.diagnostic (#12655)TJ DeVries2020-11-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Breaking Changes: - Deprecated all `vim.lsp.util.{*diagnostics*}()` functions. - Instead, all functions must be found in vim.lsp.diagnostic - For now, they issue a warning ONCE per neovim session. In a "little while" we will remove them completely. - `vim.lsp.callbacks` has moved to `vim.lsp.handlers`. - For a "little while" we will just redirect `vim.lsp.callbacks` to `vim.lsp.handlers`. However, we will remove this at some point, so it is recommended that you change all of your references to `callbacks` into `handlers`. - This also means that for functions like |vim.lsp.start_client()| and similar, keyword style arguments have moved from "callbacks" to "handlers". Once again, these are currently being forward, but will cease to be forwarded in a "little while". - Changed the highlight groups for LspDiagnostic highlight as they were inconsistently named. - For more information, see |lsp-highlight-diagnostics| - Changed the sign group names as well, to be consistent with |lsp-highlight-diagnostics| General Enhancements: - Rewrote much of the getting started help document for lsp. It also provides a much nicer configuration strategy, so as to not recommend globally overwriting builtin neovim mappings. LSP Enhancements: - Introduced the concept of |lsp-handlers| which will allow much better customization for users without having to copy & paste entire files / functions / etc. Diagnostic Enhancements: - "goto next diagnostic" |vim.lsp.diagnostic.goto_next()| - "goto prev diagnostic" |vim.lsp.diagnostic.goto_prev()| - For each of the gotos, auto open diagnostics is available as a configuration option - Configurable diagnostic handling: - See |vim.lsp.diagnostic.on_publish_diagnostics()| - Delay display until after insert mode - Configure signs - Configure virtual text - Configure underline - Set the location list with the buffers diagnostics. - See |vim.lsp.diagnostic.set_loclist()| - Better performance for getting counts and line diagnostics - They are now cached on save, to enhance lookups. - Particularly useful for checking in statusline, etc. - Actual testing :) - See ./test/functional/plugin/lsp/diagnostic_spec.lua - Added `guisp` for underline highlighting NOTE: "a little while" means enough time to feel like most plugins and plugin authors have had a chance to refactor their code to use the updated calls. Then we will remove them completely. There is no need to keep them, because we don't have any released version of neovim that exposes these APIs. I'm trying to be nice to people following HEAD :) Co-authored: [Twitch Chat 2020](https://twitch.tv/teej_dv)
* lua: make vim.inspect available early so it can be used for path debuggingBjörn Linse2020-11-05
|
* lsp: fix fallback for callback in method_unsupportedfrancisco souza2020-10-25
| | | | Missed this #12764. My bad :((
* lsp: only send buf requests to servers that support the request (#12764)francisco souza2020-10-25
| | | | | | | | | | | | | Refactors how required capabilities are detected and validated, and make sure requests are only sent to clients that support it (and only fail if no clients support the provided method). The validation happens at the buf_request level, because we assume that if someone is sending the request directly through the client, they know what they're doing. Also, let unknown methods go through. This is extracted from #12518 and closes #12755. Co-authored-by: francisco souza <fsouza@users.noreply.github.com>
* test/vim.validate(): assert normalized stacktraceJustin M. Keyes2020-10-05
| | | | | | | - The previous commit lost information in the tests. Instead, add some more "normalization" substitutions in pcall_err(), so that the general shape of the stacktrace is included in the asserted text. - Eliminate contains(), it is redundant with matches()
* vim.validate(): include stacktrace in messageTJ DeVries2020-10-05
|
* lsp: Fix bad sortText comparison (#12485)Anmol Sethi2020-08-30
| | | | | | The spec indicates we have to fallback to comparing by label if sortText is falsy. Closes #12431
* Revert "lsp: Fix text edits with the same start position (#12434)" (#12564)Andreas Johansson2020-07-30
| | | This reverts commit 44fe8828f06a22bc9aa3617a6fd8aae447a838de.
* lsp: Add support for call hierarchies (#12556)cbarrete2020-07-18
| | | | | | | | | | | | | | | | | | * LSP: Add support for call hierarchies * LSP: Add support for call hierarchies * LSP: Add support for call hierarchies * LSP: Jump to call location Jump to the call site instead of jumping to the definition of the caller/callee. * LSP: add tests for the call hierarchy callbacks * Fix linting error Co-authored-by: Cédric Barreteau <>
* lsp: Use nvim_buf_get_lines in locations_to_items and add more tests (#12357)Mathias Fußenegger2020-06-30
| | | | | | | | | | | | | | | * LSP: Add tests & use nvim_buf_get_lines in locations_to_items This is to add support for cases where the server returns a URI in the locations that does not have a file scheme but needs to be loaded via a BufReadCmd event. * LSP: Don't iterate through all lines in locations_to_items * fixup! LSP: Don't iterate through all lines in locations_to_items * fixup! fixup! LSP: Don't iterate through all lines in locations_to_items * fixup! fixup! fixup! LSP: Don't iterate through all lines in locations_to_items
* lsp: Add sync variant of LSP formattingDavid Lukes2020-06-22
| | | | | Also, factor out a `vim.lsp.util.get_effective_tabstop()` helper and add tests for it.
* lsp: Add new highlight groups used in show_line_diagnostics (#12473)francisco souza2020-06-18
| | | | | | | | | * lsp: support custom hl groups in show_line_diagnostics Closes #12472. * runtime: add docs for the new lsp highlight groups Co-authored-by: francisco souza <fsouza@users.noreply.github.com>
* lsp: Fix text edits with the same start position (#12434)Andreas Johansson2020-06-14
| | | | | | | | | | According to the LSP spec[1], multiple edits can have the same starting position, and if that is the case, they should be applied in the order as they come in the array. The implementation uses a reverse sort to not interfere with non applied edits, but failed to take into account the spec. [1] https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/#textedit
* test: Fix ignored LSP tests (#12470)David Lukes2020-06-11
| | | | | | | | | * Fix ignored LSP tests * Restructure _make_floating_popup_size tests Co-authored-by: Christian Clason <christian.clason@uni-due.de> Co-authored-by: Christian Clason <christian.clason@uni-due.de>
* lsp: compute height of floating preview correctly for wrapped lines (#12380)Christian Clason2020-06-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | * take wrapping into account when computing float height * factor out size calculation * add test * accept and pass through opts.wrap_at in floating_preview * make padding configurable * slightly refactor fancy_floating_markdown to make use of make_position * padding using string.format * move trim and pad to separate function * nit Co-authored-by: Hirokazu Hata <h.hata.ai.t@gmail.com> * remove mention of backward compat * make lint happy Co-authored-by: Hirokazu Hata <h.hata.ai.t@gmail.com>
* lua: fix behavior when split empty string (#12429)notomo2020-06-04
| | | | | * lua: fix behavior when split empty string * test: lsp.util.apply_text_edits with an empty edit
* Merge pull request #12343 from ndreas/fix/lsp-multibyte-indexingHirokazu Hata2020-06-04
|\ | | | | Fix LSP multibyte indexing
| * Add tests for jump_to_locationAndreas Johansson2020-05-19
| |
* | lua: simple snippet support in the completion items (#12118)Viktor Kojouharov2020-05-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Old behavior is: foo(${placeholder: bar, ...) with lots of random garbage you'd never want inserted. New behavior is: foo(bar, baz) (which maybe is good, maybe is bad [depends on user], but definitely better than it was). ----- * Implement rudimentary snippet parsing Add support for parsing and discarding snippet tokens from the completion items. Fixes #11982 * Enable snippet support * Functional tests for snippet parsing Add simplified real-world snippet text examples to the completion items test * Add a test for nested snippet tokens * Remove TODO comment * Return the unmodified item if the format is plain text * Add a plain text completion item
* | lsp: make the command error message more detailed (#11633)Hirokazu Hata2020-05-26
|/ | | | | * lsp.lua: make the error message more detailed * test: add lsp._cmd_part test
* lsp: Handle end lines in apply_text_edits (#12314)Andreas Johansson2020-05-17
| | | | | | If the LSP sends an end line that is larger than what nvim considers to be the last line, you get an Index out of bounds error when fetching the line from nvim, a change that was introduced in #12223. This change removes the strict indexing and checks the return value from nvim_buf_get_lines.
* lsp: fix bug when documentEdit version=null for unattached buffer (#12272)landerlo2020-05-13
|
* LSP: Make applyEdit return a response (#12270)Mathias Fußenegger2020-05-11
| | | | | | | | According to the specification workspace/applyEdit needs to respond with a `ApplyWorkspaceEditResponse` See https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_applyEdit This is a subset of https://github.com/neovim/neovim/pull/11607
* lsp: Make apply_text_edits non-ASCII safe (#12223)Christian Clason2020-05-08
| | | | | | | | | | | | | | | * Make apply_text_edits non-ASCII safe Use `vim.str_byteindex` to correct starting and ending positions for text edits if the line contains non-ASCII characters. Fixes #12221 * text_edit may be applied to other buffers * make sure the buffer is loaded * add comments * add test for non-ASCII edits
* lsp: Handle unknown CompletionItemKind and SymbolKind (#12257)Hirokazu Hata2020-05-07
| | | | | | | | | | | * lsp: handle kinds not specified in protocol fix: #12200 If the client set "symbolKind.valueSet", the client must handle it properly even if it receives a value outside the specification. * test: add lsp.util.{get_completion_item_kind_name, get_symbol_kind_name} test case * lsp: make lsp.util.{get_completion_item_kind_name, get_symbol_kind_name} private
* Merge pull request #12237 from h-michael/vim-nilMatthieu Coudron2020-05-04
|\ | | | | lsp: text_document.version may be vim.NIL not nil
| * lsp: add a lsp.util.apply_text_edits test(pending)Hirokazu Hata2020-05-04
| | | | | | | | | | We don't handle non-ASCII characters well in UTF-16. So I add a non-ASCII characters test case.
| * lsp: fix apply_text_document_edit testHirokazu Hata2020-05-04
| | | | | | | | | | | | lsp.util.buf_versions must be set in advance. Use helper.insert to create an anonymous buffer, so create a named buffer for testing without using insert.
| * [LSP] check for vim.NIL and add apply_text_document_edit testsckipp012020-05-01
| |
* | lsp: add lsp.util.symbols_to_items testHirokazu Hata2020-05-02
|/
* Merge pull request #12204 from archseer/lsp-user-dataMatthieu Coudron2020-04-30
|\ | | | | lsp/completion: Expose completion_item under completed_items.user_data + vim-patch:8.2.0084
| * lsp/completion: Expose completion_item under completed_items.user_data.Blaž Hrastnik2020-04-29
| | | | | | | | | | By passing through completion_item it's now possible for snippet plugins to add LSP snippet support.
* | LSP: enable using different highlighting rules for LSP signs (#12176)Ghjuvan Lacambre2020-04-29
|/ | | | | | | | | | | | | This commit creates 4 new highlight groups: - LspDiagnosticsErrorSign - LspDiagnosticsWarningSign - LspDiagnosticsInformationSign - LspDiagnosticsHintSign These highlight groups are linked to their corresponding LspDiagnostics highlight groups by default. This lets users choose a different color for their sign columns and virtualtext diagnostics.
* LSP: Fix show_line_diagnostics #12186Mathias Fußenegger2020-04-26
| | | Messed this up in ef0398fe88e6cc74f33fb20519997774168d7832
* LSP: Expose diagnostics grouped by bufnr (#11932)Mathias Fußenegger2020-04-25
| | | | | | | | | Expose `vim.lsp.buf.diagnostics_by_buf` This makes it easier to customize the diagnostics behavior. For example to defer the update they can override the `textDocument/publishDiagnostics` callback to only call `buf_diagnostics_save_positions` and then defer the other actions to a autocmd event.
* test: add docs for get_completion_word testAndrey Avramenko2020-04-20
|
* test: add get_completion_word test for text_doc...Andrey Avramenko2020-04-20
| | | | ...ument_completion_list_to_complete_items
* lsp: add 'textDocument/documentSymbol’ callbackHirokazu Hata2020-03-01
| | | | Spec: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentSymbol
* test: always dump logs on failure #11886Justin M. Keyes2020-02-16
| | | | | Whenever `eq()`, `ok()`, etc. fails, include log tail in the failure message. This helps to correlate log messages with a particular test failure.
* test/LSP: assert contents of log fileJustin M. Keyes2020-02-16
|