From 7caca829a15fc347c61c331dd16fa4c2ba4859a4 Mon Sep 17 00:00:00 2001 From: Lucien Shaw Date: Tue, 28 Oct 2025 11:58:09 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4devcontainer?= =?UTF-8?q?=E8=BD=BB=E9=87=8F=E7=8E=AF=E5=A2=83=E7=9A=84=E9=83=A8=E5=88=86?= =?UTF-8?q?=E9=9D=9E=E5=BF=85=E8=A6=81=E4=BE=9D=E8=B5=96=20(#14499)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 对 devcontainer 的改动如下: 1. 在轻量环境中, - 移除 `python` 及其相关格式化扩展 `black` 和 `isort` - 移除 `black` 和 `isort` 等 pip 包 2. 在所有环境中, - 将 VS Code 的默认主题设置为 `Default Dark Modern` * chore: 移除devcontainer轻量环境的部分非必要依赖 * chore: 将编辑器默认颜色主题调整为暗色 * chore: 将空白环境的post-create脚本独立,与其它环境一致 * chore: 把maa扩展加回来 --- .devcontainer/0/Dockerfile | 2 +- .devcontainer/0/devcontainer.json | 22 +++------------------- .devcontainer/1/devcontainer.json | 3 +++ .devcontainer/devcontainer.json | 10 +++++++++- .devcontainer/post-create.sh | 8 ++++++++ 5 files changed, 24 insertions(+), 21 deletions(-) create mode 100644 .devcontainer/post-create.sh diff --git a/.devcontainer/0/Dockerfile b/.devcontainer/0/Dockerfile index 6158289f3a..e20cca0cbf 100644 --- a/.devcontainer/0/Dockerfile +++ b/.devcontainer/0/Dockerfile @@ -22,7 +22,7 @@ RUN eval "$(conda shell.bash hook)" \ && conda install -y \ python=$PYTHON_VERSION \ conda-forge::nodejs=$NODEJS_VERSION \ - && pip install pre-commit black isort + && pip install pre-commit # Finalize conda setup RUN conda init \ diff --git a/.devcontainer/0/devcontainer.json b/.devcontainer/0/devcontainer.json index 0d9cce0f18..074f45528a 100644 --- a/.devcontainer/0/devcontainer.json +++ b/.devcontainer/0/devcontainer.json @@ -21,9 +21,6 @@ "vscode": { "extensions": [ "nekosu.maa-support", - "ms-python.python", - "ms-python.black-formatter", - "ms-python.isort", "esbenp.prettier-vscode", "DavidAnson.vscode-markdownlint", "yzhang.markdown-all-in-one", @@ -31,26 +28,13 @@ "mkxml.vscode-filesize" ], "settings": { + // Color theme + "workbench.colorTheme": "Default Dark Modern", + // Editor formatting "editor.formatOnSave": true, "editor.defaultFormatter": "esbenp.prettier-vscode", - // Language-specific formatting - "[python]": { - "editor.defaultFormatter": "ms-python.black-formatter", - "editor.codeActionsOnSave": { - "source.organizeImports": "explicit" - } - }, - - // Python formatting and linting - "isort.args": ["--profile", "black"], - - // Python runtime - "python.terminal.launchArgs": ["-u"], - "python.defaultInterpreterPath": "/home/vscode/miniconda/envs/maa/bin/python", - "python.terminal.activateEnvironment": false, - // Performance optimizations "search.exclude": { "**/node_modules": true, diff --git a/.devcontainer/1/devcontainer.json b/.devcontainer/1/devcontainer.json index 4e205dc160..d641b320a3 100644 --- a/.devcontainer/1/devcontainer.json +++ b/.devcontainer/1/devcontainer.json @@ -34,6 +34,9 @@ "mkxml.vscode-filesize" ], "settings": { + // Color theme + "workbench.colorTheme": "Default Dark Modern", + // Editor formatting "editor.formatOnSave": true, "editor.defaultFormatter": "esbenp.prettier-vscode", diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b5c5908b5a..ef62bd322c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,13 @@ { "name": "Plain Env (Nothing Installed)", "image": "mcr.microsoft.com/devcontainers/base:ubuntu", - "postCreateCommand": "git config --global --add safe.directory \"$(pwd)\" && git submodule foreach --recursive 'git config --global --add safe.directory \"$toplevel/$path\"'" + "postCreateCommand": "bash .devcontainer/post-create.sh", + "customizations": { + "vscode": { + "settings": { + // Color theme + "workbench.colorTheme": "Default Dark Modern" + } + } + } } diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100644 index 0000000000..138753e749 --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,8 @@ +#!/bin/bash +WORKSPACE=$(pwd) + +echo "====================" +cd "$WORKSPACE" +echo "Setting up git safe.directory for $WORKSPACE and its submodules..." +git config --global --add safe.directory "$WORKSPACE" +git submodule foreach --recursive 'git config --global --add safe.directory "$toplevel/$path"'