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: highlights.scm #70

Open
1 task done
XavierCS-dev opened this issue Jul 24, 2024 · 2 comments
Open
1 task done

feature: highlights.scm #70

XavierCS-dev opened this issue Jul 24, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@XavierCS-dev
Copy link

XavierCS-dev commented Jul 24, 2024

Did you check the tree-sitter docs?

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

I need a highlights.scm file so I can use this grammar in an extension for the Zed code editor, but I have no idea how to create one myself.

Describe the solution you'd like

A highlights.scm file like this one https://github.com/tree-sitter/tree-sitter-cpp/blob/master/queries/highlights.scm.

Describe alternatives you've considered

I tried making one myself but couldn't figure out how to make one given the grammar files.

Additional context

No response

@XavierCS-dev XavierCS-dev added the enhancement New feature or request label Jul 24, 2024
@theHamsta
Copy link
Member

Hi! For nvim-treesitter you can inherit highlights of another grammar. I think this is not possible for zed. So you could take the highlights.scm that zed uses for C++ and extend it in a similar spirit as https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/hlsl/highlights.scm (just paste this additional text below Zed's highlight.scm for C++). You would need to replace #lua-match? by #match? and maybe #keyword.modifier by #keyword (I don't know whether the modifier is known to Zed)

I hope this helps. I don't know how I provide a hightlight.scm that would work for most editors. I know there have been some efforts to standardize. But I personally wouldn't feel confident what's the current state on this. Contributions welcome when they are in line what tree-sitter-c and tree-sitter-cpp offer

@XavierCS-dev
Copy link
Author

Ah thank you! I didn't know about the existence of that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants