aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorRiley Bruins <ribru17@hotmail.com>2025-02-04 09:25:03 -0800
committerChristian Clason <ch.clason+github@icloud.com>2025-02-05 09:29:31 +0100
commit09f9f0a94625002f4c70efbdf858fe6918cbc9c6 (patch)
tree2b92ce243a57a30d2e6312465b033706add495a6 /runtime/lua/vim
parentd769c340b95b731d9a589345741070f7988d7149 (diff)
downloadrneovim-09f9f0a94625002f4c70efbdf858fe6918cbc9c6.tar.gz
rneovim-09f9f0a94625002f4c70efbdf858fe6918cbc9c6.tar.bz2
rneovim-09f9f0a94625002f4c70efbdf858fe6918cbc9c6.zip
feat(treesitter): show which nodes are missing in InspectTree
Now `:InspectTree` will show missing nodes as e.g. `(MISSING identifier)` or `(MISSING ";")` rather than just `(identifier)` or `";"`. This is doable because the `MISSING` keyword is now valid query syntax. Co-authored-by: Christian Clason <c.clason@uni-graz.at>
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/treesitter/dev.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua
index ab08e1a527..24dd8243db 100644
--- a/runtime/lua/vim/treesitter/dev.lua
+++ b/runtime/lua/vim/treesitter/dev.lua
@@ -224,9 +224,12 @@ function TSTreeView:draw(bufnr)
local text ---@type string
if item.node:named() then
- text = string.format('(%s', item.node:type())
+ text = string.format('(%s%s', item.node:missing() and 'MISSING ' or '', item.node:type())
else
text = string.format('%q', item.node:type()):gsub('\n', 'n')
+ if item.node:missing() then
+ text = string.format('(MISSING %s)', text)
+ end
end
if item.field then
text = string.format('%s: %s', item.field, text)