Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

languages: added elvish #2948

Merged
merged 1 commit into from
Jul 3, 2022
Merged

languages: added elvish #2948

merged 1 commit into from
Jul 3, 2022

Conversation

rsteube
Copy link
Contributor

@rsteube rsteube commented Jul 2, 2022

Added elvish. Can't see the grammar taking any effect so there is likely still sth. wrong with the config.

@the-mikedavis
Copy link
Member

For the syntax highlighting you'll want to add runtime/queries/elvish/highlights.scm and runtime/queries/elvish/injections.scm following the queries in tree-sitter-elvish: https://github.com/ckafi/tree-sitter-elvish/tree/main/queries

The captures need to be adapted to the ones helix uses though: https://docs.helix-editor.com/master/themes.html#syntax-highlighting, for example @parameter should become @variable.parameter

And the injections.scm in tree-sitter-elvish looks like it's in neovim format. In helix format that injection would be

((comment) @injection.content
 (#set! injection.language "comment"))

@the-mikedavis
Copy link
Member

Also to clear up the Docs CI's ❌, you'll want to run cargo xtask docgen and commit the changes

@rsteube
Copy link
Contributor Author

rsteube commented Jul 2, 2022

For the syntax highlighting you'll want to add runtime/queries/elvish/highlights.scm and runtime/queries/elvish/injections.scm following the queries in tree-sitter-elvish: https://github.com/ckafi/tree-sitter-elvish/tree/main/queries

The captures need to be adapted to the ones helix uses though: https://docs.helix-editor.com/master/themes.html#syntax-highlighting, for example @parameter should become @variable.parameter

And the injections.scm in tree-sitter-elvish looks like it's in neovim format. In helix format that injection would be

((comment) @injection.content
 (#set! injection.language "comment"))

So basically that probably needs to be forked to support neovim and helix (different format)?

@the-mikedavis
Copy link
Member

We host the queries in this repo (https://github.com/helix-editor/helix/tree/master/runtime/queries) since each editor tends to use their own queries. Technically the injections in that repo are wrong according to tree-sitter-cli and could be updated. But for getting syntax highlighting working for elvish in helix we just need the queries to be adapted in-repo here

@rsteube
Copy link
Contributor Author

rsteube commented Jul 2, 2022

Not sure if i got them all, but syntax highlighting is working now and i don't see an error.

Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you re-run cargo xtask docgen? It should add a checkmark to the highlight column for elvish. After that I think this should be good to go 👍

@rsteube
Copy link
Contributor Author

rsteube commented Jul 3, 2022

Sure. Will do when i'm back home.

Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this, this looks great!

@the-mikedavis the-mikedavis merged commit 4c30a36 into helix-editor:master Jul 3, 2022
@rsteube rsteube deleted the add-elvish branch July 4, 2022 07:11
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants