diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index e2c3ceed5..4eae17a62 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,6 +1,17 @@ -# Everything else comes from features. This exists only because fish does not -# need a feature: Debian trixie ships fish 4.0.2, so installing it is one apt -# call, and doing it here bakes it into a cached image layer. +# Everything else comes from features. This exists only for packages that do +# not need one: Debian trixie ships both fish (the default shell, per +# devcontainer.json) and ripgrep, so installing them is one apt call, and +# doing it here bakes them into a cached image layer. +# +# ripgrep is here for the Todo Tree extension, which shells out to an `rg` +# binary. It used to find one inside VS Code itself, but it only ever probes +# four hardcoded paths under vscode.env.appRoot -- node_modules and +# node_modules.asar.unpacked, each joined with vscode-ripgrep/bin/rg or +# @vscode/ripgrep/bin/rg -- and VS Code now ships +# @vscode/ripgrep-universal/bin//rg, which matches none of them. Every +# probe is a bare fs.existsSync, so the extension never consults PATH; +# installing the binary is necessary but not sufficient, and +# devcontainer.json has to point todo-tree.ripgrep at it explicitly. # # The alternative considered was ghcr.io/devcontainers-extra/features/fish-apt-get, # which downloads the 20 MB nanolayer binary and runs it as root to invoke a @@ -8,14 +19,15 @@ # size of the package it installs, for a package the distribution already has. FROM mcr.microsoft.com/devcontainers/typescript-node:5-24-trixie@sha256:b55b444f6658dd2370d430c12d4bc9540c8ed0d3d5b05e4c247161173666954f -# DL3008 wants `fish=4.0.2-1`. Pinning an apt package is not the same bargain -# as pinning an npm one: Debian drops superseded versions from the archive, so -# the first security update to fish would leave this asking for a version that -# no longer exists and fail the build outright. Nothing tracks apt pins to -# raise a PR the way renovate does for everything else here. The previous -# Dockerfile suppressed this same rule for the same reason. +# DL3008 wants these pinned, as in `fish=4.0.2-1`. Pinning an apt package is +# not the same bargain as pinning an npm one: Debian drops superseded versions +# from the archive, so the first security update to either package would leave +# this asking for a version that no longer exists and fail the build outright. +# Nothing tracks apt pins to raise a PR the way renovate does for everything +# else here. The previous Dockerfile suppressed this same rule for the same +# reason. # skipcq: DOK-DL3008 RUN apt-get update \ - && apt-get install -y --no-install-recommends fish \ + && apt-get install -y --no-install-recommends fish ripgrep \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c9c8556bd..cfa3db582 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -61,7 +61,20 @@ "path": "fish" } }, - "terminal.integrated.defaultProfile.linux": "fish" + "terminal.integrated.defaultProfile.linux": "fish", + + // Where the Dockerfile's apt install puts ripgrep. Todo Tree probes + // only four hardcoded paths inside VS Code itself and never looks at + // PATH, so installing the binary does not on its own make the + // extension find it -- see the Dockerfile for the full reasoning. + // + // This lives here rather than in .vscode/settings.json because it is + // an absolute container path. That file is shared with anyone opening + // the repo outside this container, where /usr/bin/rg is usually wrong + // (Homebrew puts it in /opt/homebrew/bin). Being wrong there is + // harmless -- the extension falls through on a failed existsSync -- + // but it would be stating something untrue of that environment. + "todo-tree.ripgrep.ripgrep": "/usr/bin/rg" }, "extensions": [ // https://marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments