camdencheek / tree-sitter-dockerfile

A tree-sitter grammar for Dockerfile
MIT License
73 stars 22 forks source link

Whitespace after line continuation breaks syntax highlighting #26

Closed eortega-pjr closed 6 months ago

eortega-pjr commented 2 years ago

sorry if this is already known

RUN echo "foo" \<space> 
    echo "feh"
### no syntax hereafter due to space after \ above
zbroniszewski commented 1 year ago

Would have never caught that!

Glad I found this.

gruhn commented 1 year ago

encountered this too

camdencheek commented 6 months ago

It's actually pretty surprising to me that docker accepts that. In most other languages I've used, the backslash is escaping only the next character, which is not a newline in this case. In any case, fixed it in #49

eortega-pjr commented 6 months ago

It's actually pretty surprising to me that docker accepts that. In most other languages I've used, the backslash is escaping only the next character, which is not a newline in this case. In any case, fixed it in #49

I wouldn't be surprised if the Dockerfile parser trims whitespace off the end of each line.