-
-
Notifications
You must be signed in to change notification settings - Fork 332
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
js package bug: new line escape character removed incorrectly #424
Comments
Do you try to run shfmt directly on Dockerfile? This is not supported as Dockerfile is not a shell file its syntax is different and it can break in other ways. |
What @kaey said. Removing the You could potentially work around this by using |
Then what's the difference between the JS API and |
@mvdan I'm using the JS API, it there any related API to preserve new line as like as |
@mvdan How can I access functions like Or is the js package just outdated from latest go source? |
@kaey asked you to reproduce the issue with shfmt because that tool ends up running pretty much the same code to format shell code. The JS package doesn't have printer options like BinaryNextLine right now. It probably will in the future, but again, this won't be enough to support dockerfiles. You're going to need a parser that understands dockerfiles. |
@mvdan Related: foxundermoon/vs-shell-format#31 |
foxundermoon/vs-shell-format#29 foxundermoon/vs-shell-format#62 mvdan/sh#424 The foxundermoon/vs-shell-format extension formats Dockerfiles, but it shouldn't, because the underlying formatter mvdan/sh isn't engineered for Dockerfiles. As explained in mvdan/sh#424, > Removing the `\` is correct in shell, because a line ending in `&&` > just continues the command in the following line. This commit will disable Dockerfile formatting.
foxundermoon/vs-shell-format#29 foxundermoon/vs-shell-format#62 mvdan/sh#424 The foxundermoon/vs-shell-format extension formats Dockerfiles, but it shouldn't, because the underlying formatter mvdan/sh isn't engineered for Dockerfiles. As explained in mvdan/sh#424, > Removing the `\` is correct in shell, because a line ending in `&&` > just continues the command in the following line. This commit will disable Dockerfile formatting.
Thanks very much for building this project, and I'm trying to wrap it into a prettier plugin: prettier-plugin-sh, it works well for most cases.
But I just find an issue when formatting
Dockerfile
:It is clear the
\
character after&&
should not be removed.The text was updated successfully, but these errors were encountered: