aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/lsp_spec.lua
Commit message (Collapse)AuthorAge
...
* test: replace lfs with luv and vim.fsdundargoc2023-04-04
| | | | | | test: replace lfs with luv luv already pretty much does everything lfs does, so this duplication of dependencies isn't needed.
* docs: fix typosdundargoc2023-04-04
| | | | | | Co-authored-by: Gregory Anders <greg@gpanders.com> Co-authored-by: Raphael <glephunter@gmail.com> Co-authored-by: C.D. MacEachern <craig.daniel.maceachern@gmail.com> Co-authored-by: himanoa <matsunoappy@gmail.com>
* test: fix flaky watchfiles tests (#22637)Jon Huhn2023-03-26
|
* fix(lsp): kill buffers after renaming a directory #22618Ivan2023-03-14
| | | | | | | | | | | | | | | Problem: When LSP client renames a directory, opened buffers in the edfitor are not renamed or closed. Then `:wall` shows errors. https://github.com/neovim/neovim/blob/master/runtime/lua/vim/lsp/util.lua#L776 works correctly if you try to rename a single file, but doesn't delete old buffers with `old_fname` is a dir. Solution: Update the logic in runtime/lua/vim/lsp/util.lua:rename() Fixes #22617
* fix(lsp): vim.lsp.util.apply_text_edits cursor validation #22636hrsh7th2023-03-14
| | | | | | | | Problem Using wrong variable when checking the cursor position is valid or not in vim.lsp.util.apply_text_edits. Solution Use the correct variable.
* fix(lsp): use line start/end for visual line selection (#22632)Mathias Fußenegger2023-03-12
| | | Fixes https://github.com/neovim/neovim/issues/22629
* fix(lsp): prevent lsp tests from picking up local user config (#22606)Mathias Fußenegger2023-03-10
| | | | | | | | Sets `NVIM_APPNAME` for the lsp server instances and also for the `exec_lua` environment to ensure local user config doesn't interfere with the test cases. My local `ftplugin/xml.lua` broke the LSP test cases about setting `omnifunc` defaults.
* feat(lsp): overwrite omnifunc/tagfunc set by ftplugin #22267Michal Liszcz2023-03-09
| | | | | | | | | | | | | | | | | Problem: Some built-in ftplugins set omnifunc/tagfunc/formatexpr which causes lsp.lua:set_defaults() to skip setup of defaults for those filetypes. For example the C++ ftplugin has: omnifunc=ccomplete#Complete Last set from /usr/share/nvim/runtime/ftplugin/c.vim line 30 so the changes done in #95c65a6b221fe6e1cf91e8322e7d7571dc511a71 will always be skipped for C++ files. Solution: Overwrite omnifunc/tagfunc/formatexpr options that were set by stock ftplugin. Fixes #21001
* feat(lsp): implement workspace/didChangeWatchedFiles (#22405)Jon Huhn2023-03-05
|
* Revert "feat(lsp): implement workspace/didChangeWatchedFiles (#21293)"Mathias Fussenegger2023-02-25
| | | | | | This reverts commit 5732aa706c639b3d775573d91d1139f24624629c. Causes editor to freeze in projects with many watcher registrations
* feat(lsp): implement workspace/didChangeWatchedFiles (#21293)Jon Huhn2023-02-25
|
* fix(lsp): check if the buffer is a directory before w! it (#22289)Eduard Baturin2023-02-18
|
* fix(tests): use -l mode for lsp testsbfredl2023-01-31
| | | | | This fixes "fake server" from leaking memory, which makes ASAN very upset, except on current ASAN CI for some reason.
* fix(lsp): check method is supported when range formatting (#21970)Sean Dewar2023-01-24
| | | | | | `vim.lsp.buf.format()` silently did nothing if no servers supported `textDocument/rangeFormatting` when formatting with a range. Issue found by `@hwrd:matrix.org` in the Matrix chat.
* refactor(test): create an lsp-specific helpers.lua fileJohn Drouhard2022-12-08
| | | | * move the code for creating fake rpc servers there
* test(lsp): call clear() before willSave tests (#21336)zeertzjq2022-12-08
| | | Otherwise these two tests cannot run alone and may fail on CI.
* feat(lsp): support willSave & willSaveWaitUntil capability (#21315)Mathias Fußenegger2022-12-08
| | | | | `willSaveWaitUntil` allows servers to respond with text edits before saving a document. That is used by some language servers to format a document or apply quick fixes like removing unused imports.
* fix(lsp): call show_document with correct argsMathias Fussenegger2022-12-04
| | | | Closes https://github.com/neovim/neovim/issues/21177
* refactor(lsp): extract a _create_server method in lsp_specMathias Fussenegger2022-12-04
|
* test: simplify platform detection (#21020)dundargoc2022-11-22
| | | | | Extend the capabilities of is_os to detect more platforms such as freebsd and openbsd. Also remove `iswin()` helper function as it can be replaced by `is_os("win")`.
* feat(test): add Lua forms for API methods (#20152)Lewis Russell2022-11-14
|
* test: introduce skip() #21010dundargoc2022-11-13
| | | | | | | This is essentially a convenience wrapper around the `pending()` function, similar to `skip_fragile()` but more general-purpose. Also remove `pending_win32` function as it can be replaced by `skip(iswin())`.
* docs: fix typosdundargoc2022-11-02
|
* feat(lsp): support window/showDocument (#19977)lvimuser2022-10-08
|
* fix(lsp): create missing directory before creating file (#19835)shaunsingh2022-09-24
| | | Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
* fix(lsp): out of bounds error in lsp.util.apply_text_edits (#20137)ofwinterpassed2022-09-20
| | | Co-authored-by: Jonas Strittmatter <40792180+smjonas@users.noreply.github.com>
* fix(lsp): support `false` result in handlers (#20252)Mathias Fußenegger2022-09-20
| | | Closes https://github.com/neovim/neovim/issues/20111
* test(lsp): call clear() before bufwipe test (#20170)zeertzjq2022-09-13
| | | Otherwise this test cannot be run alone, and fails frequently on CI.
* fix(lsp): when buffer detach remove buffer from client attached buffers (#20081)Raphael2022-09-08
| | | Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
* feat(lsp): add range option to lsp.buf.format (#19998)Mathias Fußenegger2022-09-08
|
* feat(lsp): add tcp supportMathias Fussenegger2022-08-28
|
* fix(lsp): send didOpen if name changes on write (#19583)Mathias Fußenegger2022-08-01
| | | | | | | | | `:saveas newName` changes the name of an existing buffer. Due to the buffer re-use it skips the lsp attach phase and immediately sends a `didSave` notification to the server. Servers get confused about this, because they expect a `didOpen` notification first. Closes https://github.com/neovim/neovim/issues/18688
* refactor(lsp): use autocmd api (#19407)ii142022-07-17
| | | | | | | * refactor(lsp): use autocmd api * refactor(lsp): inline BufWritePost and VimLeavePre callbacks
* test(report): formatting, drop dumplog()Justin M. Keyes2022-06-15
| | | | | Don't need to dumplog() on each failed test because we now have test-ids that associate log messages with tests.
* fix(lsp): fix multi client handling in code action (#18869)Mathias Fußenegger2022-06-05
| | | Fixes https://github.com/neovim/neovim/issues/18860
* feat(lsp): send didChangeConfiguration after init (#18847)Mathias Fußenegger2022-06-03
| | | | | | | Most LSP servers require the notification to correctly load the settings and for those who don't it doesn't cause any harm. So far this is done in lspconfig, but with the addition of vim.lsp.start it should be part of core.
* fix(ci): remove 2000ms blocking wait in many plugin/lsp_spec.lua testsbfredl2022-05-22
| | | | | | | | | | | Cuts down typical run time for `plugin/lsp_spec.lua` from 70 secs to 12 secs in ASAN CI build. This happens in ASAN/EXIT_FREE builds where nvim waits 2000ms due to unclosed handled. I wasn't able to pin-point the exact cause. But these tests ran in nested context where two server/client pairs were setup for no good reason. Moving these tests out so only one client is being setup fixed the exit hang.
* feat(lsp): add LspAttach and LspDetach autocommandsGregory Anders2022-05-18
| | | | | | | | | | | | | | | | | | | | | | | | | The current approach of using `on_attach` callbacks for configuring buffers for LSP is suboptimal: 1. It does not use the standard Nvim interface for driving and hooking into events (i.e. autocommands) 2. There is no way for "third parties" (e.g. plugins) to hook into the event. This means that *all* buffer configuration must go into the user-supplied on_attach callback. This also makes it impossible for these configurations to be modular, since it all must happen in the same place. 3. There is currently no way to do something when a client detaches from a buffer (there is no `on_detach` callback). The solution is to use the traditional method of event handling in Nvim: autocommands. When a LSP client is attached to a buffer, fire a `LspAttach`. Likewise, when a client detaches from a buffer fire a `LspDetach` event. This enables plugins to easily add LSP-specific configuration to buffers as well as enabling users to make their own configurations more modular (e.g. by creating multiple LspAttach autocommands that each do something unique).
* fix(lsp): perform client side filtering of code actions (#18392)Fredrik Ekre2022-05-12
| | | | | | | | Implement filtering of actions based on the kind when passing the 'only' parameter to code_action(). Action kinds are hierachical with a '.' as the separator, and the filter thus allows, for example, both 'quickfix' and 'quickfix.foo' when requestiong only 'quickfix'. Fix https://github.com/neovim/neovim/pull/18221#issuecomment-1110179121
* fix(lsp): fix rename capability checks and multi client support (#18441)Mathias Fußenegger2022-05-05
| | | | | | | | Adds filter and id options to filter the client to use for rename. Similar to the recently added `format` function. rename will use all matching clients one after another and can handle a mix of prepareRename/rename support. Also ensures the right `offset_encoding` is used for the `make_position_params` calls
* fix(lsp): make sure to always reset active codelens refreshes (#18331)William Boman2022-05-05
| | | | | | | | | | | This fixes issues where subsequent calls to vim.lsp.codelens.refresh() would have no effect due to the buffer not getting cleared from the active_refresh table. Examples of how such scenarios would occur are: - A textDocument/codeLens result yielded an error. - The 'textDocument/codeLens' handler was overriden in such a way that it no longer called vim.lsp.codelens.on_codelens().
* fix(lsp): handle textDocumentSync.save bool capability (#18332)Mathias Fußenegger2022-04-30
| | | Follow up to https://github.com/neovim/neovim/pull/17814
* feat(lsp): add async option to vim.lsp.buf.format (#18322)Mathias Fußenegger2022-04-30
| | | | | | | | Deprecates the existing `vim.lsp.buf.formatting` function. With this, `vim.lsp.buf.format` will replace all three: - vim.lsp.buf.formatting - vim.lsp.buf.formatting_sync - vim.lsp.buf.formatting_seq_sync
* feat(lsp): add vim.lsp.buf.format (#18193)Michael Lingelbach2022-04-30
|
* chore(lsp): remove capabilities sanitization (#17814)Michael Lingelbach2022-04-30
| | | | | | | | | | | | | | | | * feat(lsp)!: remove capabilities sanitization Users must now access client.server_capabilities which matches the same structure as the protocol. https://microsoft.github.io/language-server-protocol/specification client.resolved_capabilities is no longer used to gate capabilities, and will be removed in a future release. BREAKING CHANGE Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
* feat(lsp): options to filter and auto-apply code actions (#18221)Fredrik Ekre2022-04-30
| | | | | | | | | | | | | | | | | | | Implement two new options to vim.lsp.buf.code_action(): - filter (function): predicate taking an Action as input, and returning a boolean. - apply (boolean): when set to true, and there is just one remaining action (after filtering), the action is applied without user query. These options can, for example, be used to filter out, and automatically apply, the action indicated by the server to be preferred: vim.lsp.buf.code_action({ filter = function(action) return action.isPreferred end, apply = true, }) Fix #17514.
* fix(lsp): fix lookup of boolean values in workspace/configuration (#18026)Fredrik Ekre2022-04-15
|
* fix(lsp): set tabSize from 'shiftwidth', not 'softtabstop' (#17787)Tim Pope2022-03-20
| | | | | | | | | The use of 'softtabstop' to set tabSize was introduced in 5d5b068, replacing 'tabstop'. If we look past the name tabSize and at the actual purpose of the field, it's the indentation width used when formatting. This corresponds to the Vim option 'shiftwidth', not 'softtabstop'. The latter has the comparatively mundane purpose of controlling what happens when you hit the tab key (and even this is incomplete, as it fails to account for 'smarttab').
* fix(lsp): strictly enforce passing offset encoding (#17049)Michael Lingelbach2022-01-13
| | | | | | | | | | This removes the "fallback" to utf-16 in many of our helper functions. We should always explicitly pass these around when possible except in two locations: * generating params with help utilities called by buf.lua functions * the buf.lua functions themselves Anything that is called by the handler should be passed the offset encoding.
* fix(lsp): handle negative activeSignature in signatureHelp (#17064)Mathias Fußenegger2022-01-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | omnisharp-roslyn can send negative values: { activeParameter = 0, activeSignature = -1, signatures = { { documentation = "", label = "TestEntity.TestEntity()", parameters = {} } } } In 3.16 of the specification `activeSignature` is defined as `uinteger` and therefore negative values shouldn't be allowed, but within 3.15 it was defined as `number` which makes me think we can be a bit lenient in this case and handle them. The expected behavior is quite clear: The active signature. If omitted or the value lies outside the range of `signatures` the value defaults to zero or is ignored if the `SignatureHelp` has no signatures. Fixes an error: util.lua:1685: attempt to get length of local 'lines' (a nil value) util.lua:1685: in function 'trim_empty_lines' handlers.lua:334: in function 'textDocument/signatureHelp'