Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@wdhongtw
Copy link
Contributor

@wdhongtw wdhongtw commented Jul 9, 2024

Motivation

To provide robust usage upon shell type context, only set shell-type context key if we can tell the type of the shell.

Also update the description of the context to reflect this change.

This modification resolve #191650.

Since that the semantic of the context key is also changed, the translation should also be updated.
But I'm not sure about the work flow regarding this.

How to Test

(This PR can only be verified since that terminalShellType context key is only supported when the host environment is Windows.)

Prepare a shell profile that the shell type is undefined.

--- a/src/vs/platform/terminal/node/windowsShellHelper.ts
+++ b/src/vs/platform/terminal/node/windowsShellHelper.ts
@@ -136,7 +136,7 @@ export class WindowsShellHelper extends Disposable implements IWindowsShellHelpe
        getShellType(executable: string): TerminalShellType | undefined {
                switch (executable.toLowerCase()) {
                        case 'cmd.exe':
-                               return WindowsShellType.CommandPrompt;
+                               return undefined;
                        case 'powershell.exe':
                        case 'pwsh.exe':
                                return WindowsShellType.PowerShell;

Open a shell, inspect the context key terminalShellType is set correctly.

Open another shell that do not support shell-type,
inspect again to check that the context key terminalShellType is disappeared.

(Also change between two opened shells to validate the behavior)

To provide robust usage upon shell type context, only set
shell-type context key if we can tell the type of the shell.

Also update the description of the context to reflect this change.

This modification resolve microsoft#191650.
@wdhongtw
Copy link
Contributor Author

wdhongtw commented Jul 9, 2024

@microsoft-github-policy-service agree

Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect thanks! And sorry about not responding to your reply in the issue 😅

@Tyriar Tyriar enabled auto-merge July 9, 2024 15:34
@Tyriar Tyriar added this to the July 2024 milestone Jul 9, 2024
@Tyriar Tyriar merged commit 1c53aae into microsoft:main Jul 9, 2024
aaronchucarroll pushed a commit to aaronchucarroll/vscode that referenced this pull request Jul 10, 2024
Reset shell-type context when the type is unknown
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Aug 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

terminalShellType value is stuck at "gitbash"

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.