Open jsngalloway opened 1 year ago
Hi I am still encounted this format error. Have it already amended on latest release?
My environment: vscode: v1.74.0-insider shell-format plugin: v7.2.2
This issue is a duplicate of https://github.com/foxundermoon/vs-shell-format/issues/176 which links to https://github.com/mvdan/sh/issues/640.
The issue is that the plugin is using shfmt
to interpret the docker file as a shell script. In shell writing
apt-get --quiet update &&
DEBIAN_FRONTEND=noninteractive apt-get --quiet install -y
is valid but in docker it breaks since the line is broken. In my case I use
binary_next_line = true
so that the shell scripts have all the operators on the next line and this happens to be aligned with the dockerfiles as well. See https://github.com/mvdan/sh/blob/master/cmd/shfmt/shfmt.1.scd
Is this fixed already?
Is this fixed already?
Still experiencing this bug. It also seems disabling formatting for Dockerfiles doesn't work:
"[docker]": {
"editor.formatOnSave": false,
"editor.defaultFormatter": null
},
"[dockerfile]": {
"editor.formatOnSave": false,
"editor.defaultFormatter": null
},
"[dockerfile]": {
"editor.formatOnSave": false,
},
This actually worked for me, if you also add:
"shellformat.effectLanguages": [
"shellscript",
// "dockerfile", // Remove me!!
"dotenv",
"hosts",
"jvmoptions",
"ignore",
"gitignore",
"properties",
"spring-boot-properties",
"azcli",
"bats"
],
Thank you @Octogonapus !
The shfmt crew says explicitly that dockerfile is not supported. It seems like we should perhaps prune Dockerfile support out of this extension?
Type: Bug
Before formatting:
After formatting:
Notice first backslash is removed, this breaks the functionality of the file.