tree-sitter-vim
tree-sitter-vim copied to clipboard
bug: Some highlighting problems
Did you check existing issues?
- [x] I have read all the tree-sitter docs if it relates to using the parser
- [x] I have searched the existing issues
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)
NA
Describe the bug
This is screenshot with Treesitter enabled
This is screenshot with Treesitter disabled (using legacy syntax in Neovim)
So there are 2 problems as seen in the first image (compared to the second one):
- Treesitter parses
mksession!asrepl (command), while I think it should be parsed as(unknown_command_name) (bang), because it comes right after the command_nameRestartStatement - Treesitter doesn't even recognizes interpolation syntax (in line 3 in the screenshot)
Steps To Reproduce/Bad Parse Tree
- nvim --clean test.vim
- Paste the following code to
test.vim
command -nargs=0 RestartSession
\ mksession!
\|exe $"restart source {'Session.vim'->fnamemodify(':p')->fnameescape()} | call delete(v:this_session)"
- See the highlighting with legacy syntax. Run
:lua vim.treesitter.start()to see Treesitter highlighting
This is the parsing tree of the above code
(command_statement ; [0, 0] - [1, 13]
(command_attribute ; [0, 8] - [0, 16]
val: (integer_literal)) ; [0, 15] - [0, 16]
name: (command_name) ; [0, 17] - [0, 31]
repl: (command)) ; [1, 2] - [1, 13]
(execute_statement ; [2, 3] - [2, 102]
(ERROR ; [2, 7] - [2, 88]
(keyword) ; [2, 9] - [2, 16]
(keyword) ; [2, 17] - [2, 23]
(keyword) ; [2, 26] - [2, 33]
(keyword) ; [2, 40] - [2, 51]
(keyword) ; [2, 59] - [2, 70]
(keyword) ; [2, 76] - [2, 80]
(keyword)) ; [2, 81] - [2, 87]
(scoped_identifier ; [2, 88] - [2, 102]
(scope) ; [2, 88] - [2, 90]
(identifier))) ; [2, 90] - [2, 102]
(ERROR) ; [2, 102] - [2, 104]
Expected Behavior/Parse Tree
- Should highlight
mksessionas a command name - Should support string interpolation
Repro
No response