fix(inspect): always show priority

Problem: It is not obvious if a treesitter highlight priority shown in
`:Inspect` is higher or lower than the default.

Solution: Also print default priority (`vim.hl.priorities.treesitter`).
Add padding for better readability.

(cherry picked from commit b52ffd0a59)
This commit is contained in:
Christian Clason
2024-12-07 10:57:09 +01:00
committed by github-actions[bot]
parent 6a63034b51
commit 650dcbbafe

View File

@ -169,7 +169,7 @@ function vim.show_pos(bufnr, row, col, filter)
if data.hl_group ~= data.hl_group_link then if data.hl_group ~= data.hl_group_link then
append('links to ', 'MoreMsg') append('links to ', 'MoreMsg')
append(data.hl_group_link, data.hl_group_link) append(data.hl_group_link, data.hl_group_link)
append(' ') append(' ')
end end
if comment then if comment then
append(comment, 'Comment') append(comment, 'Comment')
@ -184,9 +184,11 @@ function vim.show_pos(bufnr, row, col, filter)
for _, capture in ipairs(items.treesitter) do for _, capture in ipairs(items.treesitter) do
item( item(
capture, capture,
capture.metadata.priority string.format(
and string.format('%s priority: %d', capture.lang, capture.metadata.priority) 'priority: %d language: %s',
or capture.lang capture.metadata.priority or vim.hl.priorities.treesitter,
capture.lang
)
) )
end end
nl() nl()