-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
How to disable formatting for Dockerfile? #62
Comments
"shellformat.effectLanguages": [
"shellscript",
- "dockerfile",
"dotenv",
"hosts",
"jvmoptions",
"ignore",
"gitignore",
"properties",
"spring-boot-properties",
"azcli"
] |
Hi, I, too, liked to disable the formatting for Dockerfiles since it removes However, since I had format-on-save enabled, I needed to add
having either of those excluded from the settings would result in auto formatting of Dockerfiles. |
@Eisbrenner Maybe it was formatted by another plugin. You can check out docker related plugins. |
@foxundermoon Dropped backslashes in Dockerfiles seems to be happening upstream in "[dockerfile]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
} After that, my Dockerfiles formatted, but all multi-line commands broke. Output from this extension (obviously?) is identical to output from Input RUN yum -y -q update \
&& yum install -q -y zip output RUN yum -y -q update &&
yum install -q -y zip |
Followup: This should be a known issue and was already mentioned here in #29 which referenced mvdan/sh#424 |
@foxundermoon Your extension shouldn't manually format files. vs-shell-format/src/extension.ts Lines 43 to 51 in 9af1d95
can you submit a pr? |
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.
Doesn't work for me. I also want to disable this weird Dockerfile formatter. |
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 It looks like the manual formatting behavior mentioned in #62 (comment) is still in the code in master? vs-shell-format/src/extension.ts Lines 43 to 51 in 95bf6a6
If I understand @texastoland's comment correctly, this code is causing the extension to ignore the user's |
I happened to have same issue. After some struggles I evaded the problem by installing Docker extension and setting dockerfile default formatter to the one given there. |
I managed to fix it adding following to my settings.json
|
I think the solution should be well documented. Or it should be enabled by default for |
This extension should not be attempting to format Dockefiles, since it clearly isn't able to do so correctly and it doesn't seem to be the goal of this extension. There should not be extra configuration required to avoid breaking files which this extension doesn't support. |
Hi,
I've been using this extension for a while and I like it. But for Dockerfile, I prefer not to enable the auto formatting.
How to disable it?
Thanks.
The text was updated successfully, but these errors were encountered: