Skip to content
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

Highlight is broken in heredocs regions of the docker file #4188

Closed
romintomasetti opened this issue Dec 13, 2023 · 5 comments
Closed

Highlight is broken in heredocs regions of the docker file #4188

romintomasetti opened this issue Dec 13, 2023 · 5 comments

Comments

@romintomasetti
Copy link

When using heredocs sections in a Docker file, this extension does not seem to correctly highlight.

See the below screenshot. The comment is not colorized.

However, other linters I've tried manage to do it correctly. I'll mention https://github.com/hadolint/hadolint for instance.

Is there anything I can do to help you with this?

image

@rcjsuen
Copy link
Contributor

rcjsuen commented Mar 26, 2024

When using heredocs sections in a Docker file, this extension does not seem to correctly highlight.

See the below screenshot. The comment is not colorized.

However, other linters I've tried manage to do it correctly. I'll mention https://github.com/hadolint/hadolint for instance.

@romintomasetti Sorry, could you explain how hadolint provides syntax highlighting? It is a tool for linting Dockerfiles and not about syntax highlighting.

@romintomasetti
Copy link
Author

Let's compare the output in VS Code.

without this extension with this extension enabled
image image

Basically, the # Command was in green but your extension makes it blue (in my color settings), making the code harder to read.

@rcjsuen
Copy link
Contributor

rcjsuen commented Mar 27, 2024

Basically, the # Command was in green but your extension makes it blue (in my color settings), making the code harder to read.

@romintomasetti That is a (positive) side effect of the # character being the character for comments in a Dockerfile.

FROM alpine
COPY <<EOF test.go
// this is a comment
EOF

If you had the above Dockerfile where // is the character for comments it would not get highlighted.

@rcjsuen
Copy link
Contributor

rcjsuen commented Mar 27, 2024

"[dockerfile]": {
    "editor.semanticHighlighting.enabled": false
}

If you would like to disable semantic highlighting, you can put the snippet above in your settings.json which will put you in the default colouring provided by Visual Studio Code instead of what the language server is calculating.

@rcjsuen
Copy link
Contributor

rcjsuen commented Jun 19, 2024

@bwateratmsft I think we can consider this to be a duplicate of #4183.

@bwateratmsft bwateratmsft closed this as not planned Won't fix, can't repro, duplicate, stale Jun 24, 2024
@bwateratmsft bwateratmsft removed this from the Future milestone Jun 24, 2024
@microsoft microsoft locked and limited conversation to collaborators Aug 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants