commit 3a8265266e0c0fe31f34b7c0192e8ae7d83ae950
parent d50596e1e33354c9a69684ab358a4e98954e3934
Author: Riley Bruins <ribru17@hotmail.com>
Date: Fri, 3 May 2024 09:34:02 -0700
fix(treesitter): escape "\" in :InspectTree #28613
Some parsers for, e.g., LaTeX or PHP have anonymous nodes like `"\"` or `"\text"` that behave wonkily (especially the first example) in the `InspectTree` window, so this PR escapes them by adding another backslash in front of them
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua
@@ -226,7 +226,7 @@ function TSTreeView:draw(bufnr)
text = string.format('(%s', item.node:type())
end
else
- text = string.format('"%s"', item.node:type():gsub('\n', '\\n'):gsub('"', '\\"'))
+ text = string.format('%q', item.node:type()):gsub('\n', 'n')
end
local next = self:get(i + 1)