diff --git a/lua/lsp_signature/helper.lua b/lua/lsp_signature/helper.lua index cbea867..a62edb9 100644 --- a/lua/lsp_signature/helper.lua +++ b/lua/lsp_signature/helper.lua @@ -662,10 +662,12 @@ helper.highlight_parameter = function(s, l) end if vim.fn.has('nvim-0.10') == 1 then local lines = vim.api.nvim_buf_get_lines(_LSP_SIG_CFG.bufnr, 0, 3, false) - if lines[1]:find([[```]]) then -- it is strange that the first line is not signatures, it is ```language_id + if lines[1]:find([[```]]) then -- it is strange that the first line is not signatures, it is ```language_id -- open_floating_preview changed display ```language_id - log("Check: first line is ```language_id, it may not be behavior of release version of nvim") - log("first two lines: ", lines) + log( + 'Check: first line is ```language_id, it may not be behavior of release version of nvim' + ) + log('first two lines: ', lines) line = 1 end end @@ -753,7 +755,7 @@ end helper.trim_empty_lines = function(lines) local new_list = {} for i, str in ipairs(lines) do - if str ~= "" and str then + if str ~= '' and str then table.insert(new_list, str) end end @@ -768,7 +770,7 @@ helper.get_mardown_syntax = function(lines) return 'markdown' end - function helper.try_trim_markdown_code_blocks(lines) +function helper.try_trim_markdown_code_blocks(lines) local language_id = lines[1]:match('^```(.*)') if language_id then local has_inner_code_fence = false @@ -789,7 +791,6 @@ end return 'markdown' end - local validate = vim.validate local default_border = { { '', 'NormalFloat' }, diff --git a/lua/lsp_signature/init.lua b/lua/lsp_signature/init.lua index b295bd6..95b65ea 100644 --- a/lua/lsp_signature/init.lua +++ b/lua/lsp_signature/init.lua @@ -163,7 +163,8 @@ local function virtual_hint(hint, off_y) pl = pl or '' local pad = '' local offset = r[2] - if _LSP_SIG_CFG.hint_inline() == false then + local inline_display = _LSP_SIG_CFG.hint_inline() + if inline_display == false then local line_to_cursor_width = dwidth(line_to_cursor) local pl_width = dwidth(pl) if show_at ~= cur_line and line_to_cursor_width > pl_width + 1 then @@ -200,8 +201,6 @@ local function virtual_hint(hint, off_y) return -- no offset found end local vt = { pad .. _LSP_SIG_CFG.hint_prefix .. hint, _LSP_SIG_CFG.hint_scheme } - local inline_display = _LSP_SIG_CFG.hint_inline() - -- if inline_display then if inline_display then if type(inline_display) == 'boolean' then inline_display = 'inline' @@ -216,6 +215,7 @@ local function virtual_hint(hint, off_y) { -- Note: the vt was put after of cursor. -- this seems eaiser to handle in the code also easy to read virt_text_pos = inline_display, + -- virt_text_pos = 'right_align', virt_text = { vt }, hl_mode = 'combine', ephemeral = false,