| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
closes https://github.com/neovim/neovim/issues/16352
* improve handling of multi-byte deletions
|
| |
|
| |
|
|
|
|
|
| |
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)
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
| |
* handle when workspaceFolder is nil in buf.list_workspace_folders and buf.add_workspace_folder
|
|
|
|
|
|
| |
* 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
|
| |
|
|
|
|
|
|
| |
* 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
|
|
|
|
| |
Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com>
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
| |
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
|
|
|
|
|
| |
* use table.insert instead of list_extend to avoid validation overhead
Co-authored-by: Gianmarco Fantinuoli <fanto-dev@hotmail.com>
|
| |
|
| |
|
|
|
|
|
|
| |
* Opens quickfix list spanning the entire nvim window in location
handlers
closes https://github.com/neovim/neovim/issues/12241
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
| |
* `where` was renamed to `scope`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
'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
|
|
|
|
|
| |
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)
|
|
|
| |
Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com> Mathias Fußenegger <mfussenegger@users.noreply.github.com>
|
| |
|
|
|
|
|
| |
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.
|
|
|
|
| |
(#15985)
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
| |
Adjust some builtin healthchecks to use Lua, after #15259
|
|
|
|
| |
`pad_left` and `pad_right` are unused
List used keys of `opts` in `make_floating_popup_options`
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
| |
Closes https://github.com/neovim/neovim/issues/15339 and https://github.com/neovim/neovim/issues/15828
|
|
|
|
| |
Also adds a check against the server capabilities to fix
https://github.com/neovim/neovim/issues/15183
|
| |
|
|
|
| |
Follow up to https://github.com/neovim/neovim/pull/15771
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
(#15793)
This makes it easier to filter the code actions. For example:
vim.lsp.buf.code_action { only = 'refactor' }
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|\
| |
| | |
lsp: Add a registry for client side code action commands
|
| |
| |
| |
| |
| | |
This builds on https://github.com/neovim/neovim/pull/14112 and closes
https://github.com/neovim/neovim/issues/12326
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| | |
Add an option to virtual text display and floating window previews to
include diagnostic source in the diagnostic message.
|
| |
| |
| | |
* 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.
|
|/
|
|
|
|
|
|
| |
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)
|