aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2021-06-01 04:32:59 -0700
committerGitHub <noreply@github.com>2021-06-01 04:32:59 -0700
commitb10cda83faac977c97bfa241b02ca35ebb2fd458 (patch)
treeefd6a5c6caaf085514ca2d86852f2936d95d229d /runtime/lua/vim/lsp
parent64bdaef327a587aaceff9cff1f204b9b93b7e3e8 (diff)
parent68d48e25b6d6e8d9b06c557cbf9b018c3e84ab72 (diff)
downloadrneovim-b10cda83faac977c97bfa241b02ca35ebb2fd458.tar.gz
rneovim-b10cda83faac977c97bfa241b02ca35ebb2fd458.tar.bz2
rneovim-b10cda83faac977c97bfa241b02ca35ebb2fd458.zip
Merge pull request #14693 from shadmansaleh/enhance/lsp/make_focusable_parameter_configurable
feat(lsp): Make focusability of lsp float configurable
Diffstat (limited to 'runtime/lua/vim/lsp')
-rw-r--r--runtime/lua/vim/lsp/util.lua28
1 files changed, 15 insertions, 13 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 0fa6518c0b..a986bd6f81 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -935,6 +935,7 @@ function M.make_floating_popup_options(width, height, opts)
anchor = anchor,
col = col + (opts.offset_x or 0),
height = height,
+ focusable = opts.focusable,
relative = 'cursor',
row = row + (opts.offset_y or 0),
style = 'minimal',
@@ -1324,18 +1325,19 @@ end
--@param contents table of lines to show in window
--@param syntax string of syntax to set for opened buffer
--@param opts dictionary with optional fields
--- - height of floating window
--- - width of floating window
--- - wrap boolean enable wrapping of long lines (defaults to true)
--- - wrap_at character to wrap at for computing height when wrap is enabled
--- - max_width maximal width of floating window
--- - max_height maximal height of floating window
--- - pad_left number of columns to pad contents at left
--- - pad_right number of columns to pad contents at right
--- - pad_top number of lines to pad contents at top
--- - pad_bottom number of lines to pad contents at bottom
--- - focus_id if a popup with this id is opened, then focus it
--- - close_events list of events that closes the floating window
+--- - height of floating window
+--- - width of floating window
+--- - wrap boolean enable wrapping of long lines (defaults to true)
+--- - wrap_at character to wrap at for computing height when wrap is enabled
+--- - max_width maximal width of floating window
+--- - max_height maximal height of floating window
+--- - pad_left number of columns to pad contents at left
+--- - pad_right number of columns to pad contents at right
+--- - pad_top number of lines to pad contents at top
+--- - pad_bottom number of lines to pad contents at bottom
+--- - focus_id if a popup with this id is opened, then focus it
+--- - close_events list of events that closes the floating window
+--- - focusable (boolean, default true): Make float focusable
--@returns bufnr,winnr buffer and window number of the newly created floating
---preview window
function M.open_floating_preview(contents, syntax, opts)
@@ -1352,7 +1354,7 @@ function M.open_floating_preview(contents, syntax, opts)
local bufnr = api.nvim_get_current_buf()
-- check if this popup is focusable and we need to focus
- if opts.focus_id then
+ if opts.focus_id and opts.focusable ~= false then
-- Go back to previous window if we are in a focusable one
local current_winnr = api.nvim_get_current_win()
if npcall(api.nvim_win_get_var, current_winnr, opts.focus_id) then