aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter/dev.lua
diff options
context:
space:
mode:
authorRiley Bruins <ribru17@hotmail.com>2024-07-04 10:09:19 -0700
committerChristian Clason <c.clason@uni-graz.at>2024-07-05 10:11:48 +0200
commit9217e0d671b790d39192181cb894cfec012f06a6 (patch)
treea28628137ebc564b26f6000a57ba901bb4221ce6 /runtime/lua/vim/treesitter/dev.lua
parent2a883d9c597e70d25ffc53373731d05d18a89b91 (diff)
downloadrneovim-9217e0d671b790d39192181cb894cfec012f06a6.tar.gz
rneovim-9217e0d671b790d39192181cb894cfec012f06a6.tar.bz2
rneovim-9217e0d671b790d39192181cb894cfec012f06a6.zip
fix(treesitter): display fields for anonymous nodes in :InspectTree
Diffstat (limited to 'runtime/lua/vim/treesitter/dev.lua')
-rw-r--r--runtime/lua/vim/treesitter/dev.lua9
1 files changed, 4 insertions, 5 deletions
diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua
index 56608bbf14..bd0ef5a011 100644
--- a/runtime/lua/vim/treesitter/dev.lua
+++ b/runtime/lua/vim/treesitter/dev.lua
@@ -220,14 +220,13 @@ function TSTreeView:draw(bufnr)
local text ---@type string
if item.node:named() then
- if item.field then
- text = string.format('%s: (%s', item.field, item.node:type())
- else
- text = string.format('(%s', item.node:type())
- end
+ text = string.format('(%s', item.node:type())
else
text = string.format('%q', item.node:type()):gsub('\n', 'n')
end
+ if item.field then
+ text = string.format('%s: %s', item.field, text)
+ end
local next = self:get(i + 1)
if not next or next.depth <= item.depth then