diff options
author | Riley Bruins <ribru17@hotmail.com> | 2024-05-03 09:34:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-03 09:34:02 -0700 |
commit | 3a8265266e0c0fe31f34b7c0192e8ae7d83ae950 (patch) | |
tree | bdf05ccc292ee1e123b981d68ac9ee92afcbd041 /runtime/lua/vim/treesitter/dev.lua | |
parent | d50596e1e33354c9a69684ab358a4e98954e3934 (diff) | |
download | rneovim-3a8265266e0c0fe31f34b7c0192e8ae7d83ae950.tar.gz rneovim-3a8265266e0c0fe31f34b7c0192e8ae7d83ae950.tar.bz2 rneovim-3a8265266e0c0fe31f34b7c0192e8ae7d83ae950.zip |
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 (limited to 'runtime/lua/vim/treesitter/dev.lua')
-rw-r--r-- | runtime/lua/vim/treesitter/dev.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua index dc2a14d238..5c91f101c0 100644 --- 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) |