vscode shell设置 升级到1.56版后终端配置不支持"terminal.integrated.shell.windows"后的解决办法
我用 vs code 开发ESP8266固件,一直用make flash用的好好的,今天打开发现命令不能执行了,想起昨天升级过vscode,就查了下setting.json,发现有如下提示:
终端在 Windows 上使用的 shell 的路径(默认: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe)。详细了解如何配置 shell。 This is deprecated, the new recommended way to configure your default shell is by creating a terminal profile in `#terminal.integrated.profiles.osx#`
and setting its profile name as the default in `#terminal.integrated.defaultProfile.osx#`. This will currently take priority over the new profiles
settings but that will change in the future.(2)
意思是原来的terminal.integrated.shell.windows配置方式已经不再支持, 要修改文件路径: .vscode\settings.json
"terminal.integrated.shell.windows": "xx/ESP/msys32/msys2_shell.cmd", //不支持的配置 "terminal.integrated.shellArgs.windows": [ "-defterm", "-mingw32", "-no-start", "-here" ], "terminal.integrated.env.windows": { "CHERE_INVOKING": "1", "MSYSTEM": "MINGW32" }
解决方法:
经过搜索后,配置修改为如下配置:
"terminal.integrated.profiles.windows": { //新的配置 "MINGW32": { "path": "xx/ESP/msys32/msys2_shell.cmd", //shell路径 "icon": "terminal-cmd", "args": [ "-defterm", "-mingw32", "-no-start", "-here"], "env": { "CHERE_INVOKING": "1", "MSYSTEM": "MINGW32" } } },
然后重新打开vs code,我去,竟然还是默认的power shell, 这是咋回事呢?
vs code中首选项中,搜索@feature:terminal,看到用户配置下面的 Allow workspace configuration没有打勾,于是勾上,重新打开vs code, 熟悉的界面又回来了。
make命令又可以正常使用了。
补充:
VScode升级到1.57.1后又提示要转换新的环境,点迁移后正常,没有发现问题。以下为项目级(路径:项目文件夹下的.vscode/settings.json中)配置:
1 | "terminal.integrated.defaultProfile.windows" : "Command Prompt" //设置本工作区的默认终端,用于覆盖系统的默认设置,这样打开工作区,就默认打开了需要的终端 |
用户级settings.json,可以通过打开菜单:文件>首选项>设置,然后搜索terminal, 点击 在settings.json中编辑即可看到所有现有终端的配置
以下为配置实例放在在项目文件夹下.vscode\settings.json中,仅影响当前项目:
"terminal.integrated.profiles.windows": { //新的配置 "ESP32C3": { "path": "${env:windir}/System32/cmd.exe", //shell路径 "icon": "terminal-cmd", "args": [ "/k", "xx/.espressif/idf_cmd_init.bat", "esp-idf-402269c78bff9d18", "-noexit", "-here"], "overrideName": true, //是否用Profile的名字来替代默认检测到的名字,这里是ESP32C3替代cmd } }, "terminal.integrated.defaultProfile.windows": "ESP32C3" //默认的终端配置
参考:
https://code.visualstudio.com/docs/editor/integrated-terminal
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)