Skip to content
This repository was archived by the owner on Jul 7, 2022. It is now read-only.

Commit 90f15d3

Browse files
ebobrowJafarAbdi
authored andcommitted
add support for aligned hints
1 parent 27761bf commit 90f15d3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lua/lsp_extensions/inlay_hints.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ inlay_hints.get_callback = function(opts)
108108

109109
local text
110110
for _, hint in ipairs(hints) do
111-
if aligned then
112-
local line_length = #vim.api.nvim_buf_get_lines(bufnr, end_line, end_line + 1, false)[1]
113-
text = string.format("%s %s", (" "):rep(longest_line - line_length), prefix .. hint.label)
114-
else
115-
text = (text or "") .. prefix .. hint.label
116-
end
111+
text = (text or "") .. prefix .. hint.label
112+
end
113+
114+
if aligned then
115+
local line_length = #vim.api.nvim_buf_get_lines(bufnr, end_line, end_line + 1, false)[1]
116+
text = string.format("%s %s", (" "):rep(longest_line - line_length), text)
117117
end
118118
vim.api.nvim_buf_set_virtual_text(ctx.bufnr, inlay_hints_ns, end_line, {{text, highlight}}, {})
119119
end

0 commit comments

Comments
 (0)