aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/buf.lua
Commit message (Collapse)AuthorAge
...
* refactor(lsp): move client code to a regular Lua classLewis Russell2024-02-07
| | | | | | | | | | Problem: The LSP client code is implemented as a complicated closure-class (class defined in a single function). Solution: Move LSP client code to a more conventional Lua class and move to a separate file.
* refactor: fix luals warningsdundargoc2023-12-30
|
* refactor: use vim.deprecate on all deprecated functionsdundargoc2023-12-27
|
* feat(lsp): more annotationsLewis Russell2023-12-14
|
* fix(lsp): create per client params in lsp.buf.code_actionMathias Fussenegger2023-11-04
| | | | | | | | | `code_action` used the same parameters for all clients, which led to the following warning and incorrect start/end column locations if using clients with mixed encodings: warning: multiple different client offset_encodings detected for buffer, this is not supported yet
* fix(lsp): call `on_list()` even for single location (#25830)Evgeni Chasnovski2023-10-31
| | | | | | | | Problem: Currently there is no way of customizing behavior of `declaration`, `definition`, `typeDefinition`, and `implementation` methods in `vim.lsp.buf` when LSP server returns `Location`. Instead, cursor jumps to that location directly. Solution: Normalize LSP response to be `Location[]` for those four cases.
* docs: do not hardcode LSP version in URL #25648Maria José Solano2023-10-16
|
* feat(lsp): fallback to code-action command on resolve failure (#25464)Mathias Fußenegger2023-10-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The haskell-language-server supports resolve only for a subset of code actions. For many code actions trying to resolve the `edit` property results in an error, but the unresolved action already contains a command that can be executed without issue. The protocol specification is unfortunately a bit vague about this, and what the haskell-language-server does seems to be valid. Example: newtype Dummy = Dummy Int instance Num Dummy where Triggering code actions on "Num Dummy" and choosing "Add placeholders for all missing methods" resulted in: -32601: No plugin enabled for SMethod_CodeActionResolve, potentially available: explicit-fields, importLens, hlint, overloaded-record-dot With this change it will insert the missing methods: instance Num Dummy where (+) = _ (-) = _ (*) = _ negate = _ abs = _ signum = _ fromInteger = _
* docs: replace <pre> with ``` (#25136)Gregory Anders2023-09-14
|
* docs(lsp): fix references to protocol.constants #24578Maria José Solano2023-08-07
|
* refactor(lsp): use protocol.Methods instead of strings #24570Raphael2023-08-05
|
* refactor(lsp): use protocol.Methods instead of strings #24537Raphael2023-08-03
|
* fix(lsp): fix multi client handling workspace_folder methods (#18839)Mathias Fußenegger2023-07-25
| | | | `buf_notify` sends the notification to all clients of a buffer, calling that inside a loop over clients multiplies the amount of notifications.
* fix(lsp): send empty "added" list when removing workspace folder #24440Mitchell Hanberg2023-07-24
| | | | | | | | | | | | | | | | | | When adding `workspace/didChangeWorkspaceFolders` support to my [language server](https://github.com/elixir-tools/next-ls), I noticed that when neovim removes a workspace, it sends an empty table (which is serialized to an empty JSON array) for the value in the `added` field. This does not follow the spec; the `added` table should just be empty. The following error led me to this discovery. Note the payload includes `"added" => [[]]`: ``` 22:46:48.476 [error] LSP Exited. Last message received: handle_notification %{"jsonrpc" => "2.0", "method" => "workspace/didChangeWorkspaceFolders", "params" => %{"event" => %{"added" => [[]], "removed" => [%{"name" => "/Users/mitchell/src/gen_lsp", "uri" => "file:///Users/mitchell/src/gen_lsp"}]}}} ** (MatchError) no match of right hand side value: {:error, %{"params" => %{"event" => %{"added" => [error: "expected a map"]}}}} (gen_lsp 0.4.0) lib/gen_lsp.ex:265: anonymous fn/4 in GenLSP.loop/3 (gen_lsp 0.4.0) lib/gen_lsp.ex:292: GenLSP.attempt/3 (stdlib 5.0.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3 ```
* docs(lua): more improvements (#24387)Lewis Russell2023-07-18
| | | | | | | | | | | | | | | | | * docs(lua): teach lua2dox how to table * docs(lua): teach gen_vimdoc.py about local functions No more need to mark local functions with @private * docs(lua): mention @nodoc and @meta in dev-lua-doc * fixup! Co-authored-by: Justin M. Keyes <justinkz@gmail.com> --------- Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* feat(lsp)!: rename vim.lsp.get_active_clients to get_clients (#24113)Mathias Fußenegger2023-07-17
|
* feat(lsp): add method filter to get_active_clients (#24319)Mathias Fußenegger2023-07-12
|
* fix(lint): lint warnings #24226Raphael2023-07-10
|
* fix(lsp): revert change to buf.clear_references() #24238Raphael2023-07-04
| | | | | | | Problem: in #24046 the signature of buf.clear_references() changed, which indirectly breaks callers that were passing "ignored" args. Solution: because util.buf_clear_references() already defaulted to "current buffer", the change to buf.clear_references() isn't actually needed, so just revert it.
* fix(lsp): lint warnings, default offset_encoding #24046Raphael2023-07-01
| | | | | - fix lint / analysis warnings - locations_to_items(): get default offset_encoding from active client - character_offset(): get default offset_encoding from active client
* feat(lsp): move inlay_hint() to vim.lsp (#24130)Mathias Fußenegger2023-06-30
| | | | | | Allows to keep more functions hidden and gives a path forward for further inlay_hint related functions - like applying textEdits. See https://github.com/neovim/neovim/pull/23984#pullrequestreview-1486624668
* fix(docs): vimdoc syntax errorsJustin M. Keyes2023-06-25
| | | | gen_help_html: truncate parse-error sample text
* test: spellcheck :help (vimdoc) files #24109Justin M. Keyes2023-06-22
| | | | | | | Enforce consistent terminology (defined in `gen_help_html.lua:spell_dict`) for common misspellings. This does not spellcheck English in general (perhaps a future TODO, though it may be noisy).
* refactor(lsp): extract common execute command functionality (#24065)Mathias Fußenegger2023-06-20
|
* feat(lsp): inlay hints #23984Chinmay Dalal2023-06-19
| | | | | | | | | | | Add automatic refresh and a public interface on top of #23736 * add on_reload, on_detach handlers in `enable()` buf_attach, and LspDetach autocommand in case of manual detach * unify `__buffers` and `hint_cache_by_buf` * use callback bufnr in `on_lines` callback, bufstate: remove __index override * move user-facing functions into vim.lsp.buf, unify enable/disable/toggle Closes #18086
* fix(lsp): allow Lua pattern chars in code action filter (#24041)Jonas Strittmatter2023-06-17
| | | | | | | Previously, filtering code actions with the "only" option failed if the code action kind contained special Lua pattern chars such as "-" (e.g. the ocaml language server supports a "type-annotate" code action). Solution: use string comparison instead of string.find
* fix(lsp): fix dynamic registration of code actions (#23826)Folke Lemaitre2023-05-30
|
* feat(lsp): initial support for dynamic capabilities (#23681)Folke Lemaitre2023-05-28
| | | | | | | | | | | | - `client.dynamic_capabilities` is an object that tracks client register/unregister - `client.supports_method` will additionally check if a dynamic capability supports the method, taking document filters into account. But only if the client enabled `dynamicRegistration` for the capability - updated the default client capabilities to include dynamicRegistration for: - formatting - rangeFormatting - hover - codeAction - hover - rename
* refactor(lsp): mark server_ready function as deprecated (#23520)Raphael2023-05-13
|
* refactor: remove modelines from Lua filesGregory Anders2023-04-13
| | | | Now that we have builtin EditorConfig support and a formatting check in CI, these are not necessary.
* fix(lsp): remove_workspace_folders fails if client has no workspace_folders ↵Dan Strokirk2023-03-13
| | | | | | #22633 When a client has no workspace_folders, (e.g., copilot), `pairs` code would crash.
* 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): 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.
* feat(lsp): add triggerKind option for vim.lsp.buf.code_action (#21905)kishii2023-01-21
|
* fix(lsp): fix `removed` param value in add_workspace_folder (#21915)Raphael2023-01-20
|
* docs(lua): adjust some type annotationsnotomo2023-01-04
|
* fix(lsp): fix get_active_clients bufnr parameter (#21366)Mathias Fußenegger2022-12-09
| | | Follow up to https://github.com/neovim/neovim/pull/21337
* refactor(lsp): remove deprecated vim.lsp.buf_get_clients calls (#21337)Raphael2022-12-08
|
* docs(gen): support language annotation in docstringsChristian Clason2022-12-02
|
* fix(lua): properly configure luacheck and remove `local vim = ...` lines ↵Folke Lemaitre2022-10-09
| | | | (#20551)
* refactor(lsp): remove deprecated lsp functions (#20421)Mathias Fußenegger2022-10-01
|
* fix(docs): invalid :help links #20345Justin M. Keyes2022-09-25
| | | | | Fix those naughty single quotes. closes #20159
* fix(lsp): use correct function name in deprecated message (#20308)Mike2022-09-23
| | | fix: use correct function name in deprecated message
* feat(lsp): add range option to lsp.buf.format (#19998)Mathias Fußenegger2022-09-08
|
* docs(lsp): rename on-list-handler to lsp-on-list-handler (#19813)Jonas Strittmatter2022-08-17
| | | | This makes it easier to find documentation about the on-list-handler when starting the search term with "lsp".
* docs(lsp): use direct link to formattingOptions in format docs (#19558)Mathias Fußenegger2022-07-28
| | | | Also changes `@see` to `See` to avoid the break to a dedicated "See also" block in the generated vimdoc
* feat(lsp): add range option to code_action; deprecate range_code_action (#19551)Mathias Fußenegger2022-07-28
| | | | | | | | | | | | | | | `code_action` gained extra functions (`filter` and `apply`) which `range_code_action` didn't have. To close this gap, this adds a `range` option to `code_action` and deprecates `range_code_action`. The option defaults to the current selection if in visual mode. This allows users to setup a mapping like `vim.keymap.set({'v', 'n'}, '<a-CR>', vim.lsp.buf.code_action)` `range_code_action` used to use the `<` and `>` markers to get the _last_ selection which required using a `<Esc><Cmd>lua vim.lsp.buf.range_code_action()<CR>` (note the `<ESC>`) mapping.
* feat(lsp): allow passing custom list handler to LSP functions that return ↵Dalius Dobravolskas2022-07-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lists (#19213) Currently LSP allows only using loclist or quickfix list window. I normally prefer to review all quickfix items without opening quickfix window. This fix allows passing `on_list` option which allows full control what to do with list. Here is example how to use it with quick fix list: ```lua local function on_list(options) vim.fn.setqflist({}, ' ', options) vim.api.nvim_command('cfirst') end local bufopts = { noremap=true, silent=true, buffer=bufnr } vim.keymap.set('n', '<leader>ad', function() vim.lsp.buf.declaration{on_list=on_list} end, bufopts) vim.keymap.set('n', '<leader>d', function() vim.lsp.buf.definition{on_list=on_list} end, bufopts) vim.keymap.set('n', '<leader>ai', function() vim.lsp.buf.implementation{on_list=on_list} end, bufopts) vim.keymap.set('n', '<leader>at', function() vim.lsp.buf.type_definition{on_list=on_list} end, bufopts) vim.keymap.set('n', '<leader>af', function() vim.lsp.buf.references(nil, {on_list=on_list}) end, bufopts) ``` If you prefer loclist do something like this: ```lua local function on_list(options) vim.fn.setloclist(0, {}, ' ', options) vim.api.nvim_command('lopen') end ``` close #19182 Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
* refactor: use `local api = vim.api`ii142022-07-15
|
* refactor: use npcall from vim.Fii142022-07-15
|