vscode shell设置 升级到1.56版后终端配置不支持"terminal.integrated.shell.windows"后的解决办法

我用 vs code 开发ESP8266固件,一直用make flash用的好好的,今天打开发现命令不能执行了,想起昨天升级过vscode,就查了下setting.json,发现有如下提示:

终端在 Windows 上使用的 shell 的路径(默认: C:WINDOWSSystem32WindowsPowerShellv1.0powershell.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配置方式已经不再支持, 要修改文件路径: .vscodesettings.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中)配置: 

"terminal.integrated.defaultProfile.windows": "Command Prompt"  //设置本工作区的默认终端,用于覆盖系统的默认设置,这样打开工作区,就默认打开了需要的终端

  

用户级settings.json,可以通过打开菜单:文件>首选项>设置,然后搜索terminal, 点击 在settings.json中编辑即可看到所有现有终端的配置

参考:

https://code.visualstudio.com/docs/editor/integrated-terminal

原文地址:https://www.cnblogs.com/jopny/p/14777279.html