Skip to content

Commit

Permalink
feat(labels): add option to set closing tag virtual text priority (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
devansh08 authored Aug 19, 2024
1 parent cd4222b commit 18a28d6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ require("flutter-tools").setup {
closing_tags = {
highlight = "ErrorMsg", -- highlight for the closing tag
prefix = ">", -- character to use for close tag e.g. > Widget
priority = 10, -- priority of virtual text in current line
-- consider to configure this when there is a possibility of multiple virtual text items in one line
-- see `priority` option in |:help nvim_buf_set_extmark| for more info
enabled = true -- set to false to disable
},
dev_log = {
Expand Down
3 changes: 3 additions & 0 deletions doc/flutter-tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ both are set.
closing_tags = {
highlight = "ErrorMsg", -- highlight for the closing tag
prefix = ">", -- character to use for close tag e.g. > Widget
priority = 10, -- priority of virtual text in current line
-- consider to configure this when there is a possibility of multiple virtual text items in one line
-- see `priority` option in |:help nvim_buf_set_extmark| for more info
enabled = true -- set to false to disable
},
dev_log = {
Expand Down
1 change: 1 addition & 0 deletions lua/flutter-tools/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ local config = {
closing_tags = {
highlight = "Comment",
prefix = "// ",
priority = 10,
enabled = true,
},
lsp = {
Expand Down
2 changes: 2 additions & 0 deletions lua/flutter-tools/labels.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local function render_labels(labels, opts)
opts = opts or {}
local highlight = opts and opts.highlight or "Comment"
local prefix = opts and opts.prefix or "// "
local priority = opts and opts.priority or 10

for _, item in ipairs(labels) do
local line = tonumber(item.range["end"].line)
Expand All @@ -23,6 +24,7 @@ local function render_labels(labels, opts)
} },
virt_text_pos = "eol",
hl_mode = "combine",
priority = priority,
})
end
end
Expand Down

0 comments on commit 18a28d6

Please sign in to comment.