mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
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
This commit is contained in:
parent
d50596e1e3
commit
3a8265266e
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user