rust-lang / rust-lang/rust-mode

Behavior with enum variants, using treesitter

Open
#518 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Emacs Lisp
Stars
1.3k
Forks
198
PR merge metrics
No merged PRs in 30d

Description

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:
Screenshot from 2024-02-26 23-23-04

The same buffer using rust-ts-mode, with treesit-font-lock-level set to 3:
Notice the variants are using white color.

Screenshot from 2024-02-26 23-22-26

Same buffer using rust-ts-mode, with treesit-font-lock-level set to 4:
Here we have 3 different colors, for variants
Screenshot from 2024-02-26 23-22-43

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the rust-ts-mode and rust-mode entry points, comparing their enum-variant fontification while testing treesit-font-lock-level values 3 and 4. Determine how enum variants can receive the same coloring as rust-mode, then verify that the resulting rust-ts-mode display uses consistent variant colors.

Written by the indexing model from the issue text.

Assessment

Tech stack
emacs, emacs-lisp, rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.