language-docker
language-docker copied to clipboard
syntax highlight && when used in RUN commands?
I think it would make for some beautiful Dockerfiles.
Also I have forgotten an && or a \ at the end of a line only to have a 20 min build fail at the last second due to that.
maybe the regex would be ^&& or && \
This would be a nice compliment to the / highlighting we just added. PRs welcome, otherwise I'll have a look in due course.
It would make more sense to add shellcheck support instead, by using syntax shell for [ON BUILD] RUN commands.
@jagregory @mishak87, what do you think about this one?
I inlined the shellscript grammar into the RUN <shell> expression, and also made a support of \.
I think that looks great! On Fri, 2 Jun 2017 at 7:22 pm, Igor Strebezhev [email protected] wrote:
@jagregory https://github.com/jagregory @mishak87 https://github.com/mishak87, what do you think about this one?
https://cloud.githubusercontent.com/assets/4586392/26719467/5123e182-478d-11e7-9fe8-975b8d288642.png
I inlined the shellscript grammar into the RUN
expression, and also made a support of . — You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/jagregory/language-docker/issues/21#issuecomment-305736257, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAqTIn06ktMaTFRHCNSt-4GtRgriJVXks5r_9RlgaJpZM4Jgqpn .
@xamgore Could you also please add syntax--operator for the &&? I would love to syntax highlight them a bit differently than echo and test in the examples
@klippx, there are two ways here. The first one it to make a pull request to the language-shell package. The second one is just to drop the inner shell scope I have made, in favor of self written implementation. I'm not sure what is the best one.
@xamgore I think flagging the thing as syntax--shell is the best solution, go for it! Did you already pull request it?
@klippx not yet. I want to check whether docker accepts the command with newlines:
RUN for (( i = 0; i < 10; i++ )); do
echo $i;
done
If it turns out that no, but Atom still hightlights it, then… I will need some time to fix this.
@xamgore End of line slashes are docker proprietary format. They have nothing to do with shell slashes (command continues on next line). Docker simply join lines together.
RUN a \
b \
c
Results in:
sh -c 'a_b___c'
Note: I have replaced spaces with undescores to more clearly demonstrate what is happening
Still no support for shell syntax highlighting in language-docker? That would be pretty cool.
Agreed, I often use # comments in my shell pipelines and it constantly throws "Empty / bogus instruction is invalid".
RUN true \
# blabla this
&& do_this \
# blabla that
&& do_that