helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
33.67k stars 2.5k forks source link

Highlight mutable variables #6659

Open palango opened 1 year ago

palango commented 1 year ago

In VSCode mutable vars can be highlighted distinctly from immutable vars: Screenshot 2023-04-08 at 20 51 30

This would be nice to have in Helix as well.

KMikeeU commented 1 year ago

That depends on your theme, you can reference and style the mut keyword using keyword.storage.modifier.mut

SoraTenshi commented 1 year ago

i have already a pr that would somewhat addresses this. I am not sure how i feel about selecting only mutable variables, as this would be pretty much only applicable to rust.

https://github.com/helix-editor/helix/pull/6197

palango commented 1 year ago

I am not sure how i feel about selecting only mutable variables, as this would be pretty much only applicable to rust.

The same distinction exists in other languages as well, like var and val in Kotlin, so I think it can be generalized.

KMikeeU commented 1 year ago

it is only possible to color mut instead of variable name depending on mut type.

Is this maybe what this TODO by @archseer is referring to? https://github.com/helix-editor/helix/blob/bff7fc8695f1d58b918f94dee7638f8a4a1e4b0e/runtime/queries/rust/highlights.scm#L183