-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add heredoc support #38
Comments
I made this first try, but I'm far from undestanding how works everything, Any help will be appreciated |
Came here from https://github.com/jaytaylor/Dockerfile.sublime-syntax for the Sublime Text 3 support. (note the same issue is still open over at vscode: microsoft/vscode-docker#4183) I'm not familiar with how to define tmbundle syntaxes but after trying @ggari-robotnik's fork (it's not working for me), maybe someone would like to try to use this definition of HEREDOC syntax from the Bash tmbundle? |
That's not enough unfortunately. Here's an example of docker's heredoc syntax: RUN <<EOF
echo hello
cowsay moo
EOF
RUN echo this is a normal command The current syntax of <<EOF
echo hello
cowsay moo
EOF gets parsed in bash scope. Since We need something similar to what @ggari-robotnik has done above (a special case for |
Here's my attempt at this (building on https://github.com/ggari-robotnik/Docker.tmbundle from before)- - match: \s*(<<)\s*([A-Za-z][A-Za-z0-9_]*)\s+
captures:
1: keyword.other.dockerfile
2: entity.name.tag.dockerfile
set: scope:source.shell.bash
with_prototype:
- include: scope:source.shell.bash#prototype
- match: ^\2
captures:
0: entity.name.tag.dockerfile
pop: true This works for the most part- But for whatever reason, it works incorrectly when the inner lines are not indented- I suspect it has something to do with how we are including the bash syntax, but I'm not too familiar with the format to fix this. |
Happy to accept the change. Cheers. |
Not sure if experimental features are of interest for this project, but I would assume Buildkit's heredoc support is here to stay:
https://www.docker.com/blog/introduction-to-heredocs-in-dockerfiles/
This would be especially nice for the bash flavor of the syntax.
The text was updated successfully, but these errors were encountered: