diff --git a/Dockerfile b/Dockerfile index 759d7e8b..0636454e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -101,6 +101,31 @@ RUN npm install --global @vscode/vsce yarn && \ npm uninstall --global vsce yarn +# Build custom versions of Microsoft's Python extensions to remove the "Run Button" +RUN cd /tmp && \ + # Process each extension: format is "repo-name|build-command|output-filename" + for ext in \ + "vscode-python|package|ms-python-insiders.vsix" \ + "vscode-python-debugger|vsce-package|python-debugger.vsix" \ + "vscode-python-environments|vsce-package|ms-python-envs-insiders.vsix"; \ + do \ + # Parse the pipe-delimited string + repo=$(echo "$ext" | cut -d'|' -f1) && \ + build_cmd=$(echo "$ext" | cut -d'|' -f2) && \ + output_file=$(echo "$ext" | cut -d'|' -f3) && \ + # Clone the latest commit from the main branch + git clone --depth 1 "https://github.com/microsoft/$repo.git" && \ + cd "$repo" && \ + # Modify package.json to remove the editor/title/run contributions if it exists + jq 'del(.contributes.menus."editor/title/run")' package.json > package.tmp.json && \ + mv package.tmp.json package.json && \ + npm install && \ + npm run "$build_cmd" && \ + mv "$output_file" /opt/cs50/extensions && \ + cd /tmp && \ + rm --force --recursive "$repo"; \ + done + # Final stage FROM cs50/cli:${TAG} diff --git a/devcontainer.json b/devcontainer.json index f0c499f1..27c2c792 100644 --- a/devcontainer.json +++ b/devcontainer.json @@ -16,6 +16,9 @@ "/opt/cs50/extensions/ddb50-2.0.0.vsix", "/opt/cs50/extensions/phpliteadmin-0.0.1.vsix", "/opt/cs50/extensions/style50-0.0.1.vsix", + "/opt/cs50/extensions/python-debugger.vsix", + "/opt/cs50/extensions/ms-python-envs-insiders.vsix", + "/opt/cs50/extensions/ms-python-insiders.vsix", "cs50.extension-uninstaller", "inferrinizzard.prettier-sql-vscode", "mathematic.vscode-pdf", @@ -33,7 +36,6 @@ "ms-ceintl.vscode-language-pack-zh-hans", "ms-ceintl.vscode-language-pack-zh-hant", "ms-python.autopep8", - "ms-python.python", "ms-vscode.cpptools", "ms-vscode.hexeditor", "ms-vsliveshare.vsliveshare",