aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp
Commit message (Collapse)AuthorAge
* fix(diagnostic): deepcopy diagnostics before clamping line numbersGregory Anders2021-11-19
| | | | | | | | | | | | | | The current 'clamp_line_numbers' implementation modifies diagnostics in place, which can have adverse downstream side effects. Before clamping line numbers, make a copy of the diagnostic. This commit also merges the 'clamp_line_numbers' method into a new 'get_diagnostics' local function which also implements the more general "get" method. The public 'vim.diagnostic.get()' API now just uses this function (without clamping). This has the added benefit that other internal API functions that need to use get() no longer have to go through vim.validate. Finally, reorganize the source code a bit by grouping all of the data structures together near the top of the file.
* fix(lsp): improve incremental sync robustness (#16358)Michael Lingelbach2021-11-18
| | | | | closes https://github.com/neovim/neovim/issues/16352 * improve handling of multi-byte deletions
* docs: mark tagfunc.lua methods as privateGregory Anders2021-11-18
|
* feat(lsp): add tagfunc (#16103)Michael Lingelbach2021-11-18
|
* fix(lsp): change signature of buf_highlight_references (#16345)Michael Lingelbach2021-11-17
| | | | | the prior signature did not assume an active language client this function can now be used directly by passing an offset encoding defaults to utf-16 (standard for LSP)
* fix(lsp): fix edge cases in incremental sync (#16308)Michael Lingelbach2021-11-15
|
* fix(lsp): ensure buffers are re-attached on rename (#16266)Mathias Fußenegger2021-11-14
| | | | | | | | | If a LSP server sent a workspace edit containing a rename the buffers file name changed without the server receiving a close notification for the old buffer and without the client properly re-attaching on the new file. This affected `Move` code-actions in nvim-jdtls, but also `vim.lsp.buf.rename` on a class level.
* fix(lsp): gracefully handle nil workspaceFolders (#16284)Michael Lingelbach2021-11-11
| | | * handle when workspaceFolder is nil in buf.list_workspace_folders and buf.add_workspace_folder
* fix(lsp): rewrite incremental sync (#16252)Michael Lingelbach2021-11-09
| | | | | | * use codeunits/points instead of byte ranges when applicable * take into account different file formats when computing range and sending text (dos, unix, and mac supported) * add tests of incremental sync
* fix(lsp): do not index nil client in progress (#16262)Michael Lingelbach2021-11-09
|
* feat(ui): add vim.ui.input and use in lsp rename (#15959)Sebastian Lyng Johansen2021-11-07
| | | | | | * vim.ui.input is an overridable function that prompts for user input * take an opts table and the `on_confirm` callback, see `:help vim.ui.input` for more details * defaults to a wrapper around vim.fn.input(opts) * switches the built-in client's rename handler to use vim.ui.input by default
* fix(lsp): convert range to byte index before highlighting (#16218)elianiva2021-11-06
| | | | Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com> Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com>
* fix(diagnostic): handle an unknown or missing client (#16242)Gregory Anders2021-11-05
| | | | | | | Sometimes plugins use pseudo-client IDs (e.g. nvim-lint or null-ls) in order to hook into the LSP infrastructure without being a bona fide LSP client. In these cases, get_client_by_id() will return nil since the client ID given does not correspond to a real client recognized by the LSP subsystem. When this happens, use "unknown" for the client name.
* fix(lsp): pass the enriched ctx to the client-side command (#16201)Nghia Le Minh2021-11-01
|
* feat(lsp): add per-client commands (#16101)Michael Lingelbach2021-11-01
|
* feat(ui): add `opt.kind` to `vim.ui.select` (#15838)Zachary Churchill2021-10-31
| | | Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* fix(lsp): improve symbols_to_items performance (#16197)Michael Lingelbach2021-10-31
| | | | | * use table.insert instead of list_extend to avoid validation overhead Co-authored-by: Gianmarco Fantinuoli <fanto-dev@hotmail.com>
* fix(lsp): default to UTF-16 when lsp client using str_utfindexblack_desk2021-10-31
|
* fix(lsp): default to UTF-16 in make_position_paramsblack_desk2021-10-31
|
* feat(lsp): default to botright for setting qflist (#16177)Michael Lingelbach2021-10-30
| | | | | | * Opens quickfix list spanning the entire nvim window in location handlers closes https://github.com/neovim/neovim/issues/12241
* refactor(diagnostic): make display handlers generic (#16137)Gregory Anders2021-10-29
| | | | | | | Rather than treating virtual_text, signs, and underline specially, introduce the concept of generic "handlers", of which those three are simply the defaults bundled with Nvim. Handlers are called in `vim.diagnostic.show()` and `vim.diagnostic.hide()` and are used to handle how diagnostics are displayed.
* feat(lsp): track pending+cancel requests on client object #15949jdrouhard2021-10-29
|
* fix(lsp): cleanup progress messages for the correct client (#16110)Folke Lemaitre2021-10-21
|
* fix(lsp): adjust legacy show diagnostic functions to use correct scope (#16106)Mathias Fußenegger2021-10-20
| | | * `where` was renamed to `scope`
* refactor(diagnostic)!: replace 'show_*' functions with 'open_float' (#16057)Gregory Anders2021-10-19
| | | | | | | | | | | | | | | | | | | | 'show_line_diagnostics()' and 'show_position_diagnostics()' are almost identical; they differ only in the fact that the latter also accepts a column to form a full position, rather than just a line. This is not enough to justify two separate interfaces for this common functionality. Renaming this to simply 'show_diagnostics()' is one step forward, but that is also not a good name as the '_diagnostics()' suffix is redundant. However, we cannot name it simply 'show()' since that function already exists with entirely different semantics. Instead, combine these two into a single 'open_float()' function that handles all of the cases of showing diagnostics in a floating window. Also add a "float" key to 'vim.diagnostic.config()' to provide global values of configuration options that can be overridden ephemerally. This makes the float API consistent with the rest of the diagnostic API. BREAKING CHANGE
* feat(lsp): set codelens virtual text hl_mode to combine (#16048)sim2021-10-19
| | | | | It looks a bit off with the extmark going over the cursorline. (With hl_mode combine it keeps the background of the cursorline under the codelens virtualtext)
* feat(lsp): use vim.ui.select() in codelenses (#16004)Josa Gesell2021-10-18
| | | Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com> Mathias Fußenegger <mfussenegger@users.noreply.github.com>
* fix(lsp): fix cursor row after textEdits (#16038)hrsh7th2021-10-18
|
* fix(lsp): persist diagnostic config for clientsGregory Anders2021-10-18
| | | | | Persist configuration settings set with `vim.lsp.with` and `vim.lsp.diagnostic.on_publish_diagnostics` by setting the config for the namespace associated with the client.
* fix(lsp): add done flag to messages returned in util.get_progress_messages() ↵jdrouhard2021-10-10
| | | | (#15985)
* fix(lsp): expose ContentModified error code to callbacks (#15262)Rishikesh Vaishnav2021-10-08
|
* feat(lsp): improve json deserialization performance (#15854)Michael Lingelbach2021-10-05
| | | | | | | | | | * Add optional second table argument to vim.json.decode which takes a table 'luanil' which can include the 'object' and/or 'array' keys. These options use luanil when converting NULL in json objects and arrays respectively. The default behavior matches the original lua-cjson. * Remove recursive_convert_NIL function from rpc.lua, use vim.json.decode with luanil = { object = true } instead. This removes a hotpath in the json deserialization pipeline by dropping keys with json NULL values throughout the deserialized table.
* fix(healthcheck): update builtins to the new convention #15914Javier Lopez2021-10-05
| | | Adjust some builtin healthchecks to use Lua, after #15259
* docs(lsp): clarify parameters of some util functions (#15851)zeertzjq2021-10-02
| | | | `pad_left` and `pad_right` are unused List used keys of `opts` in `make_floating_popup_options`
* fix(float)!: always anchor to corner of window including border #15832zeertzjq2021-10-02
| | | | | | | | | | N, W, S, E are all inclusive, i.e., always anchor to the exact corner of the window (including border). This line may also need change in this case (change 0 to -1): This is most consistent and easiest to reason about, especially with GUIs whose border do not need to have width/height of 1/1 in cell units. Fix #15789
* feat(lsp): add codeAction/resolve support (#15818)Mathias Fußenegger2021-09-28
| | | Closes https://github.com/neovim/neovim/issues/15339 and https://github.com/neovim/neovim/issues/15828
* feat(lsp): add client command support to codelens (#15820)Mathias Fußenegger2021-09-28
| | | | Also adds a check against the server capabilities to fix https://github.com/neovim/neovim/issues/15183
* refactor(lsp): remove json encode/decode wrappers (#15826)Mathias Fußenegger2021-09-28
|
* fix(ui): s/format_entry/format_item to match docs (#15819)Mathias Fußenegger2021-09-27
| | | Follow up to https://github.com/neovim/neovim/pull/15771
* feat(ui): add vim.ui.select and use in code actions (#15771)Mathias Fußenegger2021-09-27
| | | | | | | | | | | | | Continuation of https://github.com/neovim/neovim/pull/15202 A plugin like telescope could override it with a fancy implementation and then users would get the telescope-ui within each plugin that utilizes the vim.ui.select function. There are some plugins which override the `textDocument/codeAction` handler solely to provide a different UI. With custom client commands and soon codeAction resolve support, it becomes more difficult to implement the handler right - so having a dedicated way to override the picking function will be useful.
* fix(lsp): avoid serializing boolean as key (#15810)Michael Lingelbach2021-09-27
| | | | | | In vim.lsp.buf.references, the key vim.type_idx (which evaluates to a boolean) was set to equal vim.types.dictionary. This resulted in a boolean key in json which is not allowed by the json spec, and which lua-cjson fails to serialize.
* feat(lsp): allow subset of CodeActionContext as arg to code_action methods ↵Mathias Fußenegger2021-09-26
| | | | | | | | | (#15793) This makes it easier to filter the code actions. For example: vim.lsp.buf.code_action { only = 'refactor' }
* feat(lsp): use cjson for lsp rpc (#15759)Michael Lingelbach2021-09-26
|
* fix(lsp): guard textDocument/codeAction command logic #15769Chris Kipp2021-09-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Error executing vim.schedule lua callback: ...ovim/HEAD-aba3979/share/nvim/runtime/lua/vim/lsp/buf.lua:502: command: expected string, got nil stack traceback: ...ovim/HEAD-aba3979/share/nvim/runtime/lua/vim/lsp/buf.lua:502: in function 'execute_command' ...HEAD-aba3979/share/nvim/runtime/lua/vim/lsp/handlers.lua:151: in function <...HEAD-aba3979/share/nvim/runtime/lua/vim/lsp/handlers.lua:113> ...ovim/HEAD-aba3979/share/nvim/runtime/lua/vim/lsp/buf.lua:465: in function 'callback' ...r/neovim/HEAD-aba3979/share/nvim/runtime/lua/vim/lsp.lua:1325: in function 'handler' ...r/neovim/HEAD-aba3979/share/nvim/runtime/lua/vim/lsp.lua:899: in function 'cb' vim.lua:281: in function <vim.lua:281> Solution: This is a follow-up to the work done in https://github.com/neovim/neovim/commit/6c03601e3adb4c3c4d47f148df8df20401b88677. There are valid situations where a `textDocument/codeAction` is returned without a command, since a command in optional. For example from Metals, the Scala language server when you get a code action to add a missing import, it looks like this: ```json Result: [ { "title": "Import \u0027Instant\u0027 from package \u0027java.time\u0027", "kind": "quickfix", "diagnostics": [ { "range": { "start": { "line": 6, "character": 10 }, "end": { "line": 6, "character": 17 } }, "severity": 1, "source": "bloop", "message": "not found: value Instant" } ], "edit": { "changes": { "file:///Users/ckipp/Documents/scala-workspace/sanity/src/main/scala/Thing.scala": [ { "range": { "start": { "line": 6, "character": 10 }, "end": { "line": 6, "character": 17 } }, "newText": "Instant" }, { "range": { "start": { "line": 1, "character": 0 }, "end": { "line": 1, "character": 0 } }, "newText": "\nimport java.time.Instant\n" } ] } } } ] ``` This change just wraps the logic that grabs the command in a conditional to skip it if there is no command.
* Merge pull request #14115 from mfussenegger/lsp-commandsMichael Lingelbach2021-09-22
|\ | | | | lsp: Add a registry for client side code action commands
| * feat(lsp): add a registry for client side code action commandsMathias Fussenegger2021-09-20
| | | | | | | | | | This builds on https://github.com/neovim/neovim/pull/14112 and closes https://github.com/neovim/neovim/issues/12326
* | refactor(diagnostic): remove get_virt_text_chunks()Gregory Anders2021-09-21
| | | | | | | | | | | | | | | | | | This function isn't compatible with including diagnostic sources when "source" is "if_many" since it only has access to diagnostics for a single line. Rather than having an inconsistent or incomplete interface, make this function private. It is still exported as part of the module for backward compatibility with vim.lsp.diagnostics, but it can eventually be made into a local function.
* | feat(diagnostic): add option to include diagnostic sourceGregory Anders2021-09-21
| | | | | | | | | | Add an option to virtual text display and floating window previews to include diagnostic source in the diagnostic message.
* | fix(diagnostic): preserve fields from LSP diagnostics via user_data (#15735)masterGregory Anders2021-09-21
| | | | | | * preserve fields from LSP diagnostics via adding a user_data table to the diagnostic, which can hold arbitrary data in addition to the lsp diagnostic information.
* | fix(lsp): update lsp-handler signature in call_hierarchy (#15738)Mathias Fußenegger2021-09-21
|/ | | | | | | | This fixes the handler signature and also prevents n+1 requests firing if there are multiple clients. (The first `prepareCallHierarchy` handler is called once per client, each invocation used `buf_request` to make more requests using *all* clients)