-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose shell type to extensions #237624
Expose shell type to extensions #237624
Conversation
8b245eb
to
c484f28
Compare
…nstanceShellTypeChanged()
… from onDidChangeShellType
Co-authored-by: Daniel Imms <[email protected]>
Co-authored-by: Daniel Imms <[email protected]>
Co-authored-by: Daniel Imms <[email protected]>
case PosixShellType.Sh: extHostType = 1; break; | ||
case PosixShellType.Bash: extHostType = 2; break; | ||
case PosixShellType.Fish: extHostType = 3; break; | ||
case PosixShellType.Csh: extHostType = 4; break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at this now, you'd be better off just copying the enum from the API and duplicating it here. You could add a comment on top stating that it's important it keeps in sync
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean something like this?
Or having something like case vscode.TerminalShellType.Sh: extHostType = 1; break;
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this:
// IMPORTANT: This must stay in sync with the extension host API type.
enum VscodeTerminalShellType {
Sh = 1,
Bash,
Fish,
Csh,
Ksh,
Zsh,
CommandPrompt,
GitBash,
PowerShell,
Python,
Julia,
NuShell
}
switch (shellType) {
case PosixShellType.Sh: extHostType = VscodeTerminalShellType.Sh; break;
case PosixShellType.Bash: extHostType = VscodeTerminalShellType.Bash; break;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this!
Now should be here
And is the reason why we choose not to directly import the VScodeTerminalShellType
or TerminalShellType
(as named in proposed api file) from terminal shell type proposed api file is because we are already using internal TerminalShellType
from src/vs/platform/terminal/common/terminal.ts
export type TerminalShellType = PosixShellType | WindowsShellType | GeneralShellType;
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're duplicating because we're not allowed to import anything but types from vscode
. An enum isn't just a type but it also has an implementation (sh = 1, etc.).
TODO: Copy all content to branch on upstream since build+tests wont run in fork based PR branch, if I recall correctly. |
* copy everything from #237624 * try to better word notes in proposed.d.ts * why is test being so flaky * try sending one more text * strictEqual only on isInteractedWith always fails * update the name as recommended * embed to make sure we are selecting event we are interested in as recommended * add node as part of TerminalShellType * getting type ..extHostTypes.TerminalShellType.Bash is not comparable to type ..vscode.TerminalShellType.Bash * just use one enum? * figured out how to get from extHostTypes * clean up
Resolves: #230165