Skip to content
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

feature: Improve C Highlighting #251

Open
1 task done
LeoBras opened this issue Feb 22, 2025 · 1 comment
Open
1 task done

feature: Improve C Highlighting #251

LeoBras opened this issue Feb 22, 2025 · 1 comment

Comments

@LeoBras
Copy link

LeoBras commented Feb 22, 2025

Did you check the tree-sitter docs?

Is your feature request related to a problem? Please describe.

It would be awesome if we could have different colors for function parameters, global variables and macro defines!

In some of the examples below, I compare Zed (using tree-sitter) and VS Code, which uses it's own parser/highlighter, just as an example of what would like to have.

Describe the solution you'd like

Function parameters:

They are super useful to be easily spotted because we can track faster which parts of the function are being affected by the parameter. It would look like this:
See how parameter b has a different color than variable i
See how parameter b has a different color than variable i

Global variables:

Sometimes it's important (while you read functions) to make sure to know which variables are global, and which are local, for a very similar reason than function parameters. So it would be awesome to be able to select a color for those.
Sample code with bad color choice, but representing the idea: check a and b
Sample code with bad color choice, but representing the idea: check a and b

Macro defines:

Telling macros apart from functions can also be very useful, and there are already ways of setting a color on the "#define" part, so it makes sense to match the color on the usage:

On "improved", macro's usage  has the same color as it's define
On "improved", macro's usage has the same color as it's define

Fade-out disabled code

On VSCode, when code is disabled by a #ifdef, we have the text being faded-out:

image
(somewhere in the project, CONFIG_SMP is defined, so the second line is disabled and faded-out)

Is there any chance the above features are possible to achieve?

Thanks!
Leo

Describe alternatives you've considered

N/A

Additional context

No response

@LeoBras LeoBras changed the title feature: feature: Improve C Highlighting Feb 22, 2025
@LeoBras
Copy link
Author

LeoBras commented Feb 22, 2025

Actually, Zed already have an improved version:
https://github.com/zed-industries/zed/blob/main/crates/languages/src/c/highlights.scm

It just misses the above mentioned features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant