aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/lsp/buf.lua6
-rw-r--r--runtime/lua/vim/lsp/diagnostic.lua2
-rw-r--r--runtime/lua/vim/lsp/util.lua59
3 files changed, 7 insertions, 60 deletions
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua
index c63b947c99..ad5a348d4c 100644
--- a/runtime/lua/vim/lsp/buf.lua
+++ b/runtime/lua/vim/lsp/buf.lua
@@ -156,7 +156,7 @@ function M.formatting(options)
if client == nil then return end
local params = util.make_formatting_params(options)
- return client.request("textDocument/formatting", params)
+ return client.request("textDocument/formatting", params, nil, vim.api.nvim_get_current_buf())
end
--- Performs |vim.lsp.buf.formatting()| synchronously.
@@ -176,7 +176,7 @@ function M.formatting_sync(options, timeout_ms)
if client == nil then return end
local params = util.make_formatting_params(options)
- local result, err = client.request_sync("textDocument/formatting", params, timeout_ms)
+ local result, err = client.request_sync("textDocument/formatting", params, timeout_ms, vim.api.nvim_get_current_buf())
if result and result.result then
util.apply_text_edits(result.result)
elseif err then
@@ -218,7 +218,7 @@ function M.formatting_seq_sync(options, timeout_ms, order)
for _, client in ipairs(clients) do
if client.resolved_capabilities.document_formatting then
local params = util.make_formatting_params(options)
- local result, err = client.request_sync("textDocument/formatting", params, timeout_ms)
+ local result, err = client.request_sync("textDocument/formatting", params, timeout_ms, vim.api.nvim_get_current_buf())
if result and result.result then
util.apply_text_edits(result.result)
elseif err then
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua
index d4580885db..e4acfd0711 100644
--- a/runtime/lua/vim/lsp/diagnostic.lua
+++ b/runtime/lua/vim/lsp/diagnostic.lua
@@ -1123,6 +1123,8 @@ end
--- </pre>
---@param opts table Configuration table
--- - show_header (boolean, default true): Show "Diagnostics:" header.
+--- - Plus all the opts for |vim.lsp.diagnostic.get_line_diagnostics()|
+--- and |vim.lsp.util.open_floating_preview()| can be used here.
---@param bufnr number The buffer number
---@param line_nr number The line number
---@param client_id number|nil the client id
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 326005dac4..7c0132822e 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -867,7 +867,7 @@ function M.convert_signature_help_to_markdown_lines(signature_help, ft)
end
local label = signature.label
if ft then
- -- wrap inside a code block so fancy_markdown can render it properly
+ -- wrap inside a code block so stylize_markdown can render it properly
label = ("```%s\n%s\n```"):format(ft, label)
end
vim.list_extend(contents, vim.split(label, '\n', true))
@@ -1011,7 +1011,7 @@ function M.preview_location(location, opts)
local syntax = api.nvim_buf_get_option(bufnr, 'syntax')
if syntax == "" then
-- When no syntax is set, we use filetype as fallback. This might not result
- -- in a valid syntax definition. See also ft detection in fancy_floating_win.
+ -- in a valid syntax definition. See also ft detection in stylize_markdown.
-- An empty syntax is more common now with TreeSitter, since TS disables syntax.
syntax = api.nvim_buf_get_option(bufnr, 'filetype')
end
@@ -1029,53 +1029,6 @@ local function find_window_by_var(name, value)
end
end
---- Enters/leaves the focusable window associated with the current buffer via the
---window - variable `unique_name`. If no such window exists, run the function
---{fn}.
----
---@param unique_name (string) Window variable
---@param fn (function) should return create a new window and return a tuple of
----({focusable_buffer_id}, {window_id}). if {focusable_buffer_id} is a valid
----buffer id, the newly created window will be the new focus associated with
----the current buffer via the tag `unique_name`.
---@returns (pbufnr, pwinnr) if `fn()` has created a new window; nil otherwise
----@deprecated please use open_floating_preview directly
-function M.focusable_float(unique_name, fn)
- vim.notify("focusable_float is deprecated. Please use open_floating_preview and pass focus_id = [unique_name] instead", vim.log.levels.WARN)
- -- Go back to previous window if we are in a focusable one
- if npcall(api.nvim_win_get_var, 0, unique_name) then
- return api.nvim_command("wincmd p")
- end
- local bufnr = api.nvim_get_current_buf()
- do
- local win = find_window_by_var(unique_name, bufnr)
- if win and api.nvim_win_is_valid(win) and vim.fn.pumvisible() == 0 then
- api.nvim_set_current_win(win)
- api.nvim_command("stopinsert")
- return
- end
- end
- local pbufnr, pwinnr = fn()
- if pbufnr then
- api.nvim_win_set_var(pwinnr, unique_name, bufnr)
- return pbufnr, pwinnr
- end
-end
-
---- Focuses/unfocuses the floating preview window associated with the current
---- buffer via the window variable `unique_name`. If no such preview window
---- exists, makes a new one.
----
---@param unique_name (string) Window variable
---@param fn (function) The return values of this function will be passed
----directly to |vim.lsp.util.open_floating_preview()|, in the case that a new
----floating window should be created
----@deprecated please use open_floating_preview directly
-function M.focusable_preview(unique_name, fn)
- vim.notify("focusable_preview is deprecated. Please use open_floating_preview and pass focus_id = [unique_name] instead", vim.log.levels.WARN)
- return M.open_floating_preview(fn(), {focus_id = unique_name})
-end
-
--- Trims empty lines from input and pad top and bottom with empty lines
---
---@param contents table of lines to trim and pad
@@ -1103,14 +1056,6 @@ function M._trim(contents, opts)
return contents
end
-
-
---- @deprecated please use open_floating_preview directly
-function M.fancy_floating_markdown(contents, opts)
- vim.notify("fancy_floating_markdown is deprecated. Please use open_floating_preview and pass focus_id = [unique_name] instead", vim.log.levels.WARN)
- return M.open_floating_preview(contents, "markdown", opts)
-end
-
--- Converts markdown into syntax highlighted regions by stripping the code
--- blocks and converting them into highlighted code.
--- This will by default insert a blank line separator after those code block