tree-sitter-dockerfile icon indicating copy to clipboard operation
tree-sitter-dockerfile copied to clipboard

Parser errors on comment immediately after RUN

Open thetic opened this issue 3 years ago • 4 comments
trafficstars

The following causes an error:

RUN \
  # comment
  echo foo

Whereas none of the following do:

RUN echo foo \
  # comment
  echo foo
# comment
RUN \
  echo foo
RUN \
  echo foo \
  # comment
  echo foo

thetic avatar Jan 22 '22 00:01 thetic

Thanks for the report! I just pushed a commit to main that should fix this issue.

camdencheek avatar Jan 23 '22 19:01 camdencheek

I just noticed that this also affects ENV:

ENV \
   # comment
  VAR=value

thetic avatar Jan 24 '22 20:01 thetic

Sure enough. Thanks for the vigilance 😄

I'll reopen this until I get to fixing the issue for all commands.

camdencheek avatar Jan 27 '22 18:01 camdencheek

I see issue e.g. on:

FROM image
ENV FOO bar baz
ENV BAR foo

with the last ENV not getting highlighted. Similarly to this, "multi-parameter" EXPOSE also does this.

vcunat avatar Jun 03 '22 09:06 vcunat

Okay, the issue with comment lines not being removed after line continuations should be fixed by https://github.com/camdencheek/tree-sitter-dockerfile/commit/439c3e7b8a9bfdbf1f7d7c2beaae4173dc484cbf. Thanks for the report!

camdencheek avatar Apr 19 '24 21:04 camdencheek