vscode: terminal.integrated.profiles.windows does not work with spaces in names anymore

Since one of the recent updates, VSCode does not accept my custom terminal profile anymore (for the Git Bash in this instance). This is what I had configured so far:

    "terminal.integrated.defaultProfile.windows": "Git Bash",
    "terminal.integrated.profiles.windows": {
        "Git Bash": {
            "path": "C:\\ProgramData\\scoop\\apps\\git-with-openssh\\current\\bin\\bash.exe"
        },
        "PowerShell": {
            "source": "PowerShell"
        }
    },

See also https://github.com/microsoft/vscode/issues/123205#issuecomment-834045362

The profile does not work anymore though and within the settings editor VSCode laments “Value is not accepted”:

image

Has anything changed in the way how you define custom terminals in the recent updates?

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.71.2
  • OS Version: Windows 10 Pro x64, Version 10.0.19044 Build 19044

Steps to Reproduce:

  1. Create a custom terminal profile under terminal.integrated.profiles.windows with the path option.
  2. Try to set this as your default profile (or test if you can start a terminal with this profile).

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 26 (10 by maintainers)

Most upvoted comments

1.74.3 still no “Git Bash”

Are you sure the path that you’re providing there is on your computer?

Yes, because if I change the name from "Git Bash" to "GitBash" it works.

It works now.

For repro: redefine Git Bash like this for example, and see if it appear in the list of terminal profiles. It has nothing to do with default terminal selection.

"terminal.integrated.profiles.windows": {
        "Git Bash": {
            "args": [
                "-i"
            ],
            "icon": "terminal-bash",
            "overrideName": true,
            "path": "C:\\Programs\\Git\\bin\\bash.exe",
            "source": "Git Bash"
        },
    }

A sort of similar problem now exists with the SFTP extension, where you can create SSH/SFTP profiles within .vscode/sftp.json with the following format:

{
    "name": "…",
    "host": "…",
    "protocol": "sftp",
    "port": 22,
    "username": "…",
    "remotePath": "…",
    "uploadOnSave": false
}

If name contains spaces then the command SFTP: Open SSH in Terminal won’t work anymore. May be not related, but thought I would mention it.

Click to view original comment, where I done goofed

For me even profile names without whitespace won’t work either. As in, they don’t appear in the VSCode terminal list, nor is used when set as default terminal profile.

Example complete settings.json:

Click to view
{
    "[powershell]": {
        "editor.defaultFormatter": "ms-vscode.powershell"
    },
    "[yaml]": {
        "editor.autoIndent": "none",
        "editor.formatOnSave": false
    },
    "editor.defaultFormatter": "ms-vscode.powershell",
    "editor.mouseWheelZoom": true,
    "files.defaultLanguage": "powershell",
    "files.encoding": "utf8",
    "files.insertFinalNewline": true,
    "files.trimFinalNewlines": true,
    "files.trimTrailingWhitespace": true,
    "powershell.powerShellDefaultVersion": "Windows PowerShell (x64)",
    "terminal.integrated.defaultProfile.windows": "PowerShell2",
    "terminal.integrated.profiles.windows": {
        "PowerShell2": {
            "args": [
                "/NoLogo",
                "/NoExit",
                "/Command",
                "'v{0} x{1}' -f $PSVersionTable.PSVersion.ToString(),$(if([System.Environment]::Is64BitProcess){'64'}else{'86'})"
            ],
            "overrideName": false,
            "path": "${env:%SystemRoot}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
        }
    },
    "workbench.colorTheme": "Default Dark+",
    "workbench.startupEditor": "welcomePage"
}

Screenshot

Click to view

image

Also tried with override name set to true.

Same behavior with stable v1.73.1 and insiders v1.74.0 latest as of 17th november 2022.

Am I misunderstanding intended functionality here, or is it just still broken?

Edit: God damnit, I had a % in the path. Seems whitespace in name also works now. So, resolved?

Working example settings.json:

{
    "[powershell]": {
        "editor.defaultFormatter": "ms-vscode.powershell"
    },
    "[yaml]": {
        "editor.autoIndent": "none",
        "editor.formatOnSave": false
    },
    "editor.defaultFormatter": "ms-vscode.powershell",
    "editor.mouseWheelZoom": true,
    "files.defaultLanguage": "powershell",
    "files.encoding": "utf8",
    "files.insertFinalNewline": true,
    "files.trimFinalNewlines": true,
    "files.trimTrailingWhitespace": true,
    "powershell.powerShellDefaultVersion": "Windows PowerShell (x64)",
    "terminal.integrated.defaultProfile.windows": "Windows PowerShell (x64)",
    "terminal.integrated.profiles.windows": {
        "CMD (x64)": {
            "icon": "terminal-cmd",
            "overrideName": true,
            "path": "${env:SystemRoot}\\System32\\cmd.exe"
        },
        "CMD (x86)": {
            "icon": "terminal-cmd",
            "overrideName": true,
            "path": "${env:SystemRoot}\\SysWOW64\\cmd.exe"
        },
        "Command Prompt": null,
        "Git Bash": null,
        "JavaScript Debug Terminal": null,
        "PowerShell": null,
        "PowerShell Microsoft Store": {
            "args": [
                "/NoLogo",
                "/NoExit",
                "/Command",
                "'v{0} x{1}' -f $PSVersionTable.PSVersion.ToString(),$(if([System.Environment]::Is64BitProcess){'64'}else{'86'})"
            ],
            "icon": "terminal-powershell",
            "overrideName": true,
            "path": "${env:LOCALAPPDATA}\\Microsoft\\WindowsApps\\Microsoft.PowerShell_8wekyb3d8bbwe\\pwsh.exe"
        },
        "Windows PowerShell (x86)": {
            "args": [
                "/NoLogo",
                "/NoExit",
                "/Command",
                "'v{0} x{1}' -f $PSVersionTable.PSVersion.ToString(),$(if([System.Environment]::Is64BitProcess){'64'}else{'86'})"
            ],
            "icon": "terminal-powershell",
            "overrideName": true,
            "path": "${env:SystemRoot}\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell.exe"
        },
        "Windows PowerShell (x64)": {
            "args": [
                "/NoLogo",
                "/NoExit",
                "/Command",
                "'v{0} x{1}' -f $PSVersionTable.PSVersion.ToString(),$(if([System.Environment]::Is64BitProcess){'64'}else{'86'})"
            ],
            "path": "${env:SystemRoot}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
        }
    },
    "workbench.colorTheme": "Default Dark+",
    "workbench.startupEditor": "welcomePage"
}

One ask would be to view an error or problem when path is not valid/ working.

Thanks for pointing that out. we had an issue at one point where the exact name of “Git Bash” was the problem and I was confusing that w this. I can reproduce the issue you describe though