Skip to content

Commit cd9e844

Browse files
committed
Merge branch 'remove-python-run-button' into canary
2 parents 2515872 + 7e96852 commit cd9e844

File tree

2 files changed

+30
-10
lines changed

2 files changed

+30
-10
lines changed

Dockerfile

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,35 @@ RUN npm install --global @vscode/vsce yarn && \
100100
rm --force --recursive design50.vsix && \
101101
npm uninstall --global vsce yarn
102102

103-
# Pull Python VS Code extension and remove run button from editor title menu
103+
104+
# Build custom versions of Microsoft's Python extensions to remove the "Run Button"
104105
RUN cd /tmp && \
105-
git clone --branch v2025.14.0 --depth 1 https://github.com/microsoft/vscode-python.git && \
106-
cd vscode-python && \
107-
# Remove the editor/title/run entry and save back to package.json
108-
jq 'del(.contributes.menus."editor/title/run")' package.json > package.tmp.json && mv package.tmp.json package.json && \
109-
npm install && \
110-
npm run package && \
111-
mv ms-python-insiders.vsix /opt/cs50/extensions && \
112-
cd /tmp && \
113-
rm --force --recursive vscode-python
106+
# Process each extension: format is "repo-name|build-command|output-filename"
107+
for ext in \
108+
"vscode-python|package|ms-python-insiders.vsix" \
109+
"vscode-python-debugger|vsce-package|python-debugger.vsix" \
110+
"vscode-python-environments|vsce-package|ms-python-envs-insiders.vsix"; \
111+
do \
112+
# Parse the pipe-delimited string
113+
repo=$(echo "$ext" | cut -d'|' -f1) && \
114+
build_cmd=$(echo "$ext" | cut -d'|' -f2) && \
115+
output_file=$(echo "$ext" | cut -d'|' -f3) && \
116+
# Fetch the latest release tag from GitHub API
117+
echo "Fetching latest release for $repo..." && \
118+
latest_tag=$(curl -s "https://api.github.com/repos/microsoft/$repo/releases/latest" | jq -r .tag_name) && \
119+
echo "Using version: $latest_tag" && \
120+
# Clone the repository at the latest release tag
121+
git clone --branch "$latest_tag" --depth 1 "https://github.com/microsoft/$repo.git" && \
122+
cd "$repo" && \
123+
# Modify package.json to remove the editor/title/run contributions if it exists
124+
jq 'del(.contributes.menus."editor/title/run")' package.json > package.tmp.json && \
125+
mv package.tmp.json package.json && \
126+
npm install && \
127+
npm run "$build_cmd" && \
128+
mv "$output_file" /opt/cs50/extensions && \
129+
cd /tmp && \
130+
rm --force --recursive "$repo"; \
131+
done
114132

115133
# Final stage
116134
FROM cs50/cli:${TAG}

devcontainer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"/opt/cs50/extensions/ddb50-2.0.0.vsix",
1717
"/opt/cs50/extensions/phpliteadmin-0.0.1.vsix",
1818
"/opt/cs50/extensions/style50-0.0.1.vsix",
19+
"/opt/cs50/extensions/python-debugger.vsix",
20+
"/opt/cs50/extensions/ms-python-envs-insiders.vsix",
1921
"/opt/cs50/extensions/ms-python-insiders.vsix",
2022
"cs50.extension-uninstaller",
2123
"inferrinizzard.prettier-sql-vscode",

0 commit comments

Comments
 (0)