From b52ffd0a59df3b79f2f3f2338485f235da94478d Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 7 Dec 2024 10:57:09 +0100 Subject: [PATCH] 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. --- runtime/lua/vim/_inspector.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/runtime/lua/vim/_inspector.lua b/runtime/lua/vim/_inspector.lua index 520c437906..a09dd55a47 100644 --- a/runtime/lua/vim/_inspector.lua +++ b/runtime/lua/vim/_inspector.lua @@ -178,7 +178,7 @@ function vim.show_pos(bufnr, row, col, filter) if data.hl_group ~= data.hl_group_link then append('links to ', 'MoreMsg') append(data.hl_group_link, data.hl_group_link) - append(' ') + append(' ') end if comment then append(comment, 'Comment') @@ -193,9 +193,11 @@ function vim.show_pos(bufnr, row, col, filter) for _, capture in ipairs(items.treesitter) do item( capture, - capture.metadata.priority - and string.format('%s priority: %d', capture.lang, capture.metadata.priority) - or capture.lang + string.format( + 'priority: %d language: %s', + capture.metadata.priority or vim.hl.priorities.treesitter, + capture.lang + ) ) end nl()