Showing signatures and highlighting parameters done
parent
c291a7df66
commit
9e69ec98c0
|
|
@ -218,11 +218,12 @@ local function _make_floating_popup_options(content, opts)
|
|||
end
|
||||
|
||||
offset_x = opts.offset_x or 0
|
||||
local first_col = vim.fn.getwininfo(vim.fn.win_getid())[1].textoff
|
||||
|
||||
return {
|
||||
anchor = anchor,
|
||||
row = row,
|
||||
col = col + offset_x,
|
||||
col = col + first_col + offset_x,
|
||||
width = width,
|
||||
height = height,
|
||||
focusable = opts.focusable,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ function SignatureHelp.new()
|
|||
ns = nil,
|
||||
markid = nil,
|
||||
timer = nil,
|
||||
visible = false,
|
||||
current_signatures = nil,
|
||||
enabled = false,
|
||||
normal_mode_active = false,
|
||||
|
|
@ -52,8 +51,8 @@ function SignatureHelp.new()
|
|||
max_width = 80,
|
||||
anchor_bias = "below", -- below|above|auto
|
||||
relative = "cursor",
|
||||
offset_y = 5,
|
||||
offset_x = 5,
|
||||
offset_y = 0,
|
||||
offset_x = 0,
|
||||
},
|
||||
|
||||
trigger_chars = { "(", "," },
|
||||
|
|
@ -257,16 +256,11 @@ function SignatureHelp:display(result)
|
|||
return
|
||||
end
|
||||
|
||||
-- Prevent duplicate displays of identical content
|
||||
if
|
||||
self.current_signatures and vim.deep_equal(result.signatures, self.current_signatures)
|
||||
-- and result.activeParameter == self.current_active_parameter
|
||||
then
|
||||
return
|
||||
end
|
||||
local content = helper.convert_signature_help_to_lines(result, self.config.win_opts.max_width)
|
||||
if not self.showing then
|
||||
self.sig_buf, self.sig_win = helper.create_float_window(content, "lua", self.config.win_opts) -- TODO: programmatically set file type:
|
||||
local param_str = helper.get_parameter_label(result)
|
||||
self:set_active_parameter_highlights(param_str, content)
|
||||
self.showing = true
|
||||
end
|
||||
local param_str = helper.get_parameter_label(result)
|
||||
|
|
@ -289,6 +283,7 @@ function SignatureHelp:trigger()
|
|||
end
|
||||
|
||||
if result and result.signatures and #result.signatures > 0 then
|
||||
self.current_signatures = result.signatures
|
||||
self:display(result)
|
||||
else
|
||||
self:hide_sig_win()
|
||||
|
|
|
|||
Loading…
Reference in New Issue