mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
Merge 62fe64608e
into a0d8c2b86e
This commit is contained in:
commit
bd1dcc5d0a
@ -1033,6 +1033,11 @@ Lua module: vim.lsp.client *lsp-client*
|
||||
`150`) Debounce `didChange` notifications to
|
||||
the server by the given number in
|
||||
milliseconds. No debounce occurs if `nil`.
|
||||
• {pull_diagnostics_on_save} (`boolean`,
|
||||
default: `false`) Request diagnostics from
|
||||
the server on `didSave` events instead of
|
||||
`didChange` events. Has no effect if the
|
||||
server does not support pull diagnostics.
|
||||
• {exit_timeout} (`integer|false`, default:
|
||||
`false`) Milliseconds to wait for server to
|
||||
exit cleanly after sending the "shutdown"
|
||||
@ -1204,6 +1209,11 @@ Lua module: vim.lsp.client *lsp-client*
|
||||
`150`) Debounce `didChange` notifications to
|
||||
the server by the given number in
|
||||
milliseconds. No debounce occurs if `nil`.
|
||||
• {pull_diagnostics_on_save} (`boolean`,
|
||||
default: `false`) Request diagnostics from the
|
||||
server on `didSave` events instead of
|
||||
`didChange` events. Has no effect if the
|
||||
server does not support pull diagnostics.
|
||||
• {exit_timeout} (`integer|false`, default:
|
||||
`false`) Milliseconds to wait for server to
|
||||
exit cleanly after sending the "shutdown"
|
||||
|
@ -141,6 +141,8 @@ LSP
|
||||
|
||||
• Completion side effects (including snippet expansion, execution of commands
|
||||
and application of additional text edits) is now built-in.
|
||||
• |vim.lsp.Client| flag `pull_diagnostic_on_save` sends diagnostic requests on
|
||||
save instead of change
|
||||
• |vim.lsp.util.locations_to_items()| sets `end_col` and `end_lnum` fields.
|
||||
• |vim.lsp.buf.format()| now supports passing a list of ranges
|
||||
via the `range` parameter (this requires support for the
|
||||
|
@ -23,6 +23,11 @@ local validate = vim.validate
|
||||
--- (default: `150`)
|
||||
--- @field debounce_text_changes integer
|
||||
---
|
||||
--- Request diagnostics from the server on `didSave` events instead of `didChange` events.
|
||||
--- Has no effect if the server does not support pull diagnostics.
|
||||
--- (default: `false`)
|
||||
--- @field pull_diagnostics_on_save boolean
|
||||
---
|
||||
--- Milliseconds to wait for server to exit cleanly after sending the
|
||||
--- "shutdown" request before sending kill -15. If set to false, nvim exits
|
||||
--- immediately after sending the "shutdown" request to the server.
|
||||
|
@ -438,14 +438,43 @@ function M._enable(bufnr)
|
||||
buffer = bufnr,
|
||||
callback = function(opts)
|
||||
if
|
||||
opts.data.method ~= ms.textDocument_didChange
|
||||
and opts.data.method ~= ms.textDocument_didOpen
|
||||
not (bufstates[bufnr] and bufstates[bufnr].enabled)
|
||||
or (
|
||||
opts.data.method ~= ms.textDocument_didChange
|
||||
and opts.data.method ~= ms.textDocument_didSave
|
||||
and opts.data.method ~= ms.textDocument_didOpen
|
||||
)
|
||||
then
|
||||
return
|
||||
end
|
||||
if bufstates[bufnr] and bufstates[bufnr].enabled then
|
||||
local client_id = opts.data.client_id --- @type integer?
|
||||
_refresh(bufnr, { only_visible = true, client_id = client_id })
|
||||
local opts_client_id = opts.data.client_id --- @type integer?
|
||||
if opts.data.method == ms.textDocument_didOpen then
|
||||
_refresh(bufnr, { only_visible = true, client_id = opts_client_id })
|
||||
return
|
||||
end
|
||||
local clients = vim.lsp.get_clients({
|
||||
bufnr = bufnr,
|
||||
method = ms.textDocument_diagnostic,
|
||||
client_id = opts_client_id,
|
||||
})
|
||||
local on_save_client_ids = {} --- @type integer[]
|
||||
local on_change_client_ids = {} --- @type integer[]
|
||||
for _, client in pairs(clients) do
|
||||
if client.flags.pull_diagnostics_on_save then
|
||||
on_save_client_ids[#on_save_client_ids + 1] = client.id
|
||||
else
|
||||
on_change_client_ids[#on_change_client_ids + 1] = client.id
|
||||
end
|
||||
end
|
||||
|
||||
if opts.data.method == ms.textDocument_didSave then
|
||||
for _, client_id in pairs(on_save_client_ids) do
|
||||
_refresh(bufnr, { only_visible = true, client_id = client_id })
|
||||
end
|
||||
else
|
||||
for _, client_id in pairs(on_change_client_ids) do
|
||||
_refresh(bufnr, { only_visible = true, client_id = client_id })
|
||||
end
|
||||
end
|
||||
end,
|
||||
group = augroup,
|
||||
|
Loading…
Reference in New Issue
Block a user