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

Support dockerfiles #1303

Merged
merged 22 commits into from
Dec 21, 2021
Merged

Support dockerfiles #1303

merged 22 commits into from
Dec 21, 2021

Conversation

midnightexigent
Copy link
Contributor

@midnightexigent midnightexigent commented Dec 19, 2021

I couldn't get it to look as neat as the original

image

Here is how this PR looks

image

I am not good enough with tree-sitter.. Anyone has any ideas ?

@archseer
Copy link
Member

To get shell highlighting to work, you need to add an injections.scm:

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

((shell_command) @injection.content
 (#set! injection.language "bash"))

@midnightexigent
Copy link
Contributor Author

Thanks for the help

That didn't quite do the trick, I needed an injections.scm that looks like this

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

((shell_command) @injection.content
 (#set! injection.language "bash"))

((shell_fragment) @injection.content
 (#set! injection.language "bash"))

Which gives to get the following

image

Also

((shell_fragment) @injection.content
 (#set! injection.language "bash"))

on its own works also

Does that look okay to you ? If yes I can submit that

@pickfire
Copy link
Contributor

If I am not mistaken, you can reuse the highlights context.

([(line_comment) (block_comment)] @injection.content
(#set! injection.language "comment"))

@archseer
Copy link
Member

@midnightexigent Yeah we want all three clauses, not just the last one (since it's targetting different nodes).

And you can merge the shell_ ones as pickfire proposed:

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

([(shell_command) (shell_fragment)] @injection.content
 (#set! injection.language "bash"))

To improve the highlighting further we can compare the bash/highlights.scm with the changes in nvim-treesitter, right now we just copy-pasted the one provided by tree-sitter-bash but it can be further improved.

@midnightexigent
Copy link
Contributor Author

Done

@archseer
Copy link
Member

Thanks! 🎉

@archseer archseer merged commit dba22c6 into helix-editor:master Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants