-
Notifications
You must be signed in to change notification settings - Fork 180
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
Behavior with enum variants, using treesitter #518
Comments
Thanks for the clear description of the issue! I tried your code block in my rust setup (which uses my fork of rustic) and here is the snapshot of the same code: The reason I'm getting a consistent look is because I have enabled semantic tokens in lsp-mode and that's what my buffer is using: https://github.com/psibi/dotfiles/blob/8f491d47846683860a9605a4e4b9ce9c45644e32/.emacs.d/init.el#L154 |
Assuming you want to use font lock level 3, this should do the trick: (defun rust-ts-add-enum-rules ()
"Add a rule that fontifies Capitalized identifiers as types."
(setq treesit-font-lock-settings
(append
treesit-font-lock-settings
(treesit-font-lock-rules
:language 'rust
:feature 'enum-supplement
'(((identifier) @font-lock-type-face
(:match "\\`[A-Z]" @font-lock-type-face)))))))
(add-hook 'rust-ts-mode-hook #'rust-ts-add-enum-rules) |
@casouri Thanks, I have added I might have found a bug with indentation: fn my_fun<F>(_: F)
where
F: Clone
{
// abc
} When I open an empty I have tested with an empty Not sure if I should report to |
That's because it's rare for the |
Hello
I just tested the new
rust-ts-mode
with emacs 29, and it seems to be working well.I can already see some improvements, compared to some cases where
rust-mode
was having some issues, both in fontifications and identations.Thanks to everyone who worked on that integration.
However I've noticed an issue with enum variants:
This is my buffer using the legacy
rust-mode
:The same buffer using
rust-ts-mode
, withtreesit-font-lock-level
set to3
:Notice the variants are using white color.
Same buffer using
rust-ts-mode
, withtreesit-font-lock-level
set to4
:Here we have 3 different colors, for variants
Ideally I would like to get the same colors/fontification than
rust-mode
(variants in green).What would be the correct way to customize that ?
Thanks
cc @casouri @psibi
The text was updated successfully, but these errors were encountered: