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

Empty lines in HEREDOCs trigger a warning (empty continuation line) #107

Closed
wedi opened this issue Jan 19, 2022 · 4 comments
Closed

Empty lines in HEREDOCs trigger a warning (empty continuation line) #107

wedi opened this issue Jan 19, 2022 · 4 comments
Assignees
Labels

Comments

@wedi
Copy link

wedi commented Jan 19, 2022

issue: The linter complains about empty lines in HEREDOCs.

Empty continuation line dockerfile-utils(11)

Test:

const utils = require('dockerfile-utils');
const problems = utils.validate('FROM alpine\nRUN <<eot\necho "foo"\n\necho "bar"\neot');
console.log(problems);
1

In addition, I have experienced that VS Code added backslashes on pressing enter to escape newlines in HEREDOCs but I cannot reproduce that right now. Maybe this has been fixed recently?

praise:

In #97 you started supporting HEREDOCs from the very beginning and in #105 you promptly fixed formatting when I reported that over at microsoft/vscode-docker#3327. Thank you!

This tool works secretly behind the scenes and provides a tremendous value for everyone handling Dockerfiles with VS Code. This is just great. Thank you!

@rcjsuen rcjsuen pinned this issue Jan 19, 2022
@rcjsuen rcjsuen added the bug label Jan 19, 2022
@rcjsuen rcjsuen self-assigned this Jan 19, 2022
@rcjsuen
Copy link
Owner

rcjsuen commented Jan 19, 2022

Hi @wedi, thanks for the bug report.

  1. For the empty continuation lines warning, in Visual Studio Code you can try setting "docker.languageserver.diagnostics.emptyContinuationLine" to "ignore" as a workaround.
  2. The language server does not insert characters when "enter" is pressed. At least...it shouldn't. :P There might be some autoformatting/auto-tabbing behaviour but I don't think it should "randomly" be adding a \ character. If you do see it again please open an issue in the microsoft/vscode-docker repository and CC me there.
  3. Thank you for your compliments and recognition of this little project! The project wouldn't be this far without people like you opening bugs though (as the company I work with does not use heredoc syntax for example) so I appreciate everyone out there letting me know about updates to the Dockerfile syntax and false positives and so on. :)

@wedi
Copy link
Author

wedi commented Jan 19, 2022

Thanks for the prompt reply!

  1. Thanks for the hint but I'll leave it as is for now. I prefer having a non disruptive false positive warning to broken images. :)
  2. I've just realised that this was not VS Code but a JetBrains IDE. They do not support the LSP which is a shame.
  3. ❤️

@rcjsuen
Copy link
Owner

rcjsuen commented Jan 20, 2022

Blocked by rcjsuen/dockerfile-ast#103.

rcjsuen added a commit that referenced this issue Jan 22, 2022
dockerfile-ast 0.4.2 is required for the complete fix.

Signed-off-by: Remy Suen <[email protected]>
@rcjsuen rcjsuen unpinned this issue Jan 22, 2022
@rcjsuen
Copy link
Owner

rcjsuen commented Jan 23, 2022

@wedi I have opened microsoft/vscode-docker#3399 to ask the engineers at Microsoft to update the Visual Studio Code Docker extension with the new fixed version.

Thanks again for the bug report and have a great weekend!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants