Skip to content

Commit 2841ca3

Browse files
committed
feat(renderer_vimdoc): Added support for ? after arguments
1 parent 30d3104 commit 2841ca3

2 files changed

Lines changed: 33 additions & 12 deletions

File tree

lua/helpview/renderers/vimdoc.lua

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,40 @@ vimdoc.argument = function (buffer, item)
7676
hl_mode = "combine"
7777
});
7878

79-
vim.api.nvim_buf_set_extmark(buffer, vimdoc.ns, range.row_end, range.col_end - 1, {
80-
undo_restore = false, invalidate = true,
81-
end_col = range.col_end,
82-
conceal = "",
79+
if string.match(item.text[1], "?$") then
80+
vim.api.nvim_buf_set_extmark(buffer, vimdoc.ns, range.row_end, range.col_end - 2, {
81+
undo_restore = false, invalidate = true,
8382

84-
virt_text_pos = "inline",
85-
virt_text = {
86-
{ config.padding_right or "", utils.set_hl(config.padding_right_hl or config.hl) },
87-
{ config.corner_right or "", utils.set_hl(config.corner_right_hl or config.hl) }
88-
},
83+
end_col = range.col_end - 1,
84+
conceal = "",
85+
});
8986

90-
hl_mode = "combine"
91-
});
87+
vim.api.nvim_buf_set_extmark(buffer, vimdoc.ns, range.row_end, range.col_end, {
88+
undo_restore = false, invalidate = true,
89+
90+
virt_text_pos = "inline",
91+
virt_text = {
92+
{ config.padding_right or "", utils.set_hl(config.padding_right_hl or config.hl) },
93+
{ config.corner_right or "", utils.set_hl(config.corner_right_hl or config.hl) }
94+
},
95+
96+
hl_mode = "combine"
97+
});
98+
else
99+
vim.api.nvim_buf_set_extmark(buffer, vimdoc.ns, range.row_end, range.col_end - 1, {
100+
undo_restore = false, invalidate = true,
101+
end_col = range.col_end,
102+
conceal = "",
103+
104+
virt_text_pos = "inline",
105+
virt_text = {
106+
{ config.padding_right or "", utils.set_hl(config.padding_right_hl or config.hl) },
107+
{ config.corner_right or "", utils.set_hl(config.corner_right_hl or config.hl) }
108+
},
109+
110+
hl_mode = "combine"
111+
});
112+
end
92113

93114
---@type string Added virtual text.
94115
local ext = table.concat({

lua/helpview/spec.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ spec.default = {
396396
},
397397

398398
["codepen%.io"] = {
399-
priority = 9999,
399+
priority = -9999,
400400

401401
icon = "",
402402
hl = "HelpviewPalette6Fg"

0 commit comments

Comments
 (0)