-
-
Notifications
You must be signed in to change notification settings - Fork 830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python: arguments in Callable not highlighted as types #6203
Comments
Don't think this can be handled gracefully without bloating up the parser/slowing down parsing ( |
Been thinking about this. I'm not too familiar with treesitter queries, but maybe it could only look up a few nodes rather than all the way up the tree? If it only has to look back one or two nodes, I don't think that it'll have as significant a performance impact. No clue whether there's a query for this, though. |
There is one for direct parents, but that's it. |
Describe the highlighting problem
In python, the arguments in a
Callable
are highlighted as variables/constants rather than as types.Example snippet that causes the problem
Tree-sitter parsing result
Example screenshot
Using the catppuccin colorscheme.
:Inspect
was called with the cursor on thet
.Expected behavior
The
t
should be a@type
, but it is a@variable
instead. If it is changed toT
, then it is both a@variable
and a@constant
. Note that theu
is correctly identified as an@type
. I suspect that the issue is thetype
node does not "propagate into" thelist
node for syntax highlighting.Output of
:checkhealth nvim-treesitter
Output of
nvim --version
Additional context
Also reported (erroneously) at tree-sitter/tree-sitter-python#258.
The text was updated successfully, but these errors were encountered: