Closed KaratasFurkan closed 2 years ago
I also realized that decorators (e.g. @method_decorator...
in screenshots) changed too, when run M-x describe-text-properties
on it, it gives two faces: (tree-sitter-hl-face:function\.call tree-sitter-hl-face:function\.special)
first one is orange
, second one is white
which I prefer. Can I make tree-sitter-hl-face:function\.special
come first?
This is an issue in tree-sitter-langs, probably because the grammar was updated, but the hl queries were not modified accordingly. Can you open a bug there?
In the mean time, you can work around this by adding a custom pattern in your config code:
(tree-sitter-hl-add-patterns 'python
[(assignment left: (identifier) @variable)])
I also realized that decorators (e.g.
@method_decorator...
in screenshots) changed too, when runM-x describe-text-properties
on it, it gives two faces:(tree-sitter-hl-face:function\.call tree-sitter-hl-face:function\.special)
first one isorange
, second one iswhite
which I prefer. Can I maketree-sitter-hl-face:function\.special
come first?
You can add a custom pattern to override that:
(tree-sitter-hl-add-patterns 'python
[(decorator (call (identifier) @function.special))])
Your workarounds fixed the problem :tada: Thank you so much. I opened an issue in tree-sitter-langs as you suggested. I will remove the custom patterns from my config when it fixed :+1:
Hi, I wasn't updating
emacs-tree-sitter
for a very long time but a few days ago, I accidentally deleted it and re-installed it with newest version. Now, in python-mode, variables doesn't get highlighted, and when I try to install the version I used before (which is759e3c4aeace2f4224aec071249b7a8794bfe3fa
) it gives the same error in this issue: #152 (but withtree-sitter-grammars-linux-0.5.0.tar.gz
in my old version)Syntax highlighting comparison:
Without tree-sitter (variable declarations are red but less highlighting in general):![disabled-cut](https://user-images.githubusercontent.com/29731420/123526258-4a727c00-d6df-11eb-9fe8-e045b863e486.png)
With old version tree-sitter (variable declarations are red and everything gets highlighting, perfect):![old-cut](https://user-images.githubusercontent.com/29731420/123526266-60803c80-d6df-11eb-8335-8569a1d9a3e1.png)
With new version tree-sitter (variable declarations doesn't get highlighted):![new-cut](https://user-images.githubusercontent.com/29731420/123526283-83125580-d6df-11eb-8c38-6710916279e3.png)