Skip to content
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

fix non windows shell type context key #147884

Merged
merged 2 commits into from Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
Expand Up @@ -460,6 +460,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
// Re-establish the title after reconnect
if (this.shellLaunchConfig.attachPersistentProcess) {
this.refreshTabLabels(this.shellLaunchConfig.attachPersistentProcess.title, this.shellLaunchConfig.attachPersistentProcess.titleSource);
this.setShellType(this.shellType);
}

if (this._fixedCols) {
Expand Down Expand Up @@ -1098,11 +1099,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {

this._register(dom.addDisposableListener(xterm.raw.textarea, 'focus', () => {
this._terminalFocusContextKey.set(true);
if (this.shellType) {
this._terminalShellTypeContextKey.set(this.shellType.toString());
} else {
this._terminalShellTypeContextKey.reset();
}
this._onDidFocus.fire(this);
}));

Expand Down Expand Up @@ -1882,6 +1878,9 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {

setShellType(shellType: TerminalShellType) {
this._shellType = shellType;
if (shellType) {
this._terminalShellTypeContextKey.set(shellType?.toString());
}
}

private _setAriaLabel(xterm: XTermTerminal | undefined, terminalId: number, title: string | undefined): void {
Expand Down
7 changes: 7 additions & 0 deletions src/vs/workbench/contrib/terminal/browser/terminalService.ts
Expand Up @@ -52,6 +52,7 @@ export class TerminalService implements ITerminalService {
private _hostActiveTerminals: Map<ITerminalInstanceHost, ITerminalInstance | undefined> = new Map();

private _terminalEditorActive: IContextKey<boolean>;
private readonly _terminalShellTypeContextKey: IContextKey<string>;

private _escapeSequenceLoggingEnabled: boolean = false;

Expand Down Expand Up @@ -187,9 +188,15 @@ export class TerminalService implements ITerminalService {
if (!instance && !this._isShuttingDown) {
this._terminalGroupService.hidePanel();
}
if (instance?.shellType) {
this._terminalShellTypeContextKey.set(instance.shellType.toString());
} else if (!instance) {
this._terminalShellTypeContextKey.reset();
}
});

this._handleInstanceContextKeys();
this._terminalShellTypeContextKey = TerminalContextKeys.shellType.bindTo(this._contextKeyService);
this._processSupportContextKey = TerminalContextKeys.processSupported.bindTo(this._contextKeyService);
this._processSupportContextKey.set(!isWeb || this._remoteAgentService.getConnection() !== null);
this._terminalHasBeenCreated = TerminalContextKeys.terminalHasBeenCreated.bindTo(this._contextKeyService);
Expand Down