Add newline at EOF to `devcontainer-lock.json`
.devcontainer/devcontainer-lock.json has to be explicitly ignored if you use Prettier.
This is sad because a lot of projects use it …
Ensure dev.containers.experimentalLockfile is set to true in your VS Code user settings.
$ mkdir -p /tmp/test/.devcontainer && cd "$_/.."
$ npm init -y >/dev/null
$ npm i -Ds [email protected]
$ echo '{"image":"mcr.microsoft.com/devcontainers/javascript-node","features":{"ghcr.io/devcontainers/features/common-utils:2":{}}}' >.devcontainer/devcontainer.json
$ npx prettier --write . >/dev/null
$ echo 'node_modules/' >.gitignore
$ git init -q
$ git config set user.email "[email protected]"
$ git config set user.name "Your Name"
$ git add -A
$ git commit -q -m initial
$ code .
“Reopen in Container”
$ git status -s
?? .devcontainer/devcontainer-lock.json
$ git add -A
$ git commit -q -m lock
$ npx prettier --write . >/dev/null
$ git diff
diff --git i/.devcontainer/devcontainer-lock.json w/.devcontainer/devcontainer-lock.json
index 4949bae..18f8135 100644
--- i/.devcontainer/devcontainer-lock.json
+++ w/.devcontainer/devcontainer-lock.json
@@ -6,4 +6,4 @@
"integrity": "sha256:3cf7ca93154faf9bdb128f3009cf1d1a91750ec97cc52082cf5d4edef5451f85"
}
}
-}
\ No newline at end of file
+}
Hi @sdavids, Thank you for reporting this issue!
I followed the steps you provided, but I did not observe the untracked files in the git status output, which indicates that the devcontainer-lock.json file is not being ignored. Specifically, when running git status -s, I did not encounter the following output:
?? .devcontainer/devcontainer-lock.json
Could you please provide further details or clarification on the issue? This would be helpful in resolving the matter.
Thanks, Sireesha
Ensure
dev.containers.experimentalLockfileis set totruein your VS Code user settings.
I guess you forgot 👆
Also check that you do not have devcontainer-lock.json, .devcontainer/devcontainer-lock.json, or something similar in your global gitignore.
Also check that you installed the Dev Containers extension and that is enabled.
.devcontainer/devcontainer-lock.json is created by the Dev Containers VS Code extension.