Given the following dockerfile snippet...
# setup a new user
COPY compiler.sudoers /etc/sudoers.d/compiler
RUN chmod 0440 /etc/sudoers.d/compiler && \
adduser --disabled-password --gecos \"\" compiler && \
usermod -a -G sudo compiler
USER compiler
WORKDIR /home/compiler
CMD ["/bin/bash"] ["--login"]
The escaped quotes after gecos appear to throw off the syntax highlighting.

+1

Also seems to be an issue when using backslashes within quoted paths:

Another example of the problem:
# escape=`
FROM repo:label
RUN command `
-arg1=\"val1\" `
-arg2=\"val2\" `
-arg3=\"val3\"
RUN echo "and now all the syntax highlighting is backwards"
Which shows up as:

I wonder if this issue should really belong in Microsoft/vscode or moby/moby instead. The syntax highlighting is provided by the docker.tmLanguage.json file which lives in Microsoft/vscode (which is a converted version of the file in moby/moby).
@PrashanthCorp so any chances to get this fixed here or we need to log an issue in https://github.com/Microsoft/vscode?
Also, just an observation - this problem doesn't happen in VS (just wondering if there is any potential for syntax rules reuse).
@Leon99 Could you please provide an example of your Dockerfile that has proper syntax highlighting in Visual Studio Code but doesn't when the vscode-docker extension is installed?
@rcjsuen I can't, I never said that was the case. It worked fine in VS2019, not in VSCode.
@rcjsuen I can't, I never said that was the case. It worked fine in VS2019, not in VSCode.
You're right, I misread your comment. You were talking about Visual Studio 2019 and not Visual Studio Code. My mistake and sorry for the confusion.
Could you share a screenshot of how something looks in VS2019 and VSCode for comparison? Thanks!
Since syntax highlighting is provided by VSCode with the tmLanguage file, I've created https://github.com/microsoft/vscode/issues/82988 and will close this one as external to that one.
Most helpful comment
Also seems to be an issue when using backslashes within quoted paths: