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

only update terminal dropdown options if they've changed #115720

Merged
merged 4 commits into from Feb 4, 2021
Merged
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
11 changes: 8 additions & 3 deletions src/vs/workbench/contrib/terminal/browser/terminalActions.ts
Expand Up @@ -41,6 +41,7 @@ import { RemoteNameContext } from 'vs/workbench/browser/contextkeys';
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
import { killTerminalIcon, newTerminalIcon } from 'vs/workbench/contrib/terminal/browser/terminalIcons';
import { Codicon } from 'vs/base/common/codicons';
import { equals } from 'vs/base/common/objects';

async function getCwdForSplit(configHelper: ITerminalConfigHelper, instance: ITerminalInstance, folders?: IWorkspaceFolder[], commandService?: ICommandService): Promise<string | URI | undefined> {
switch (configHelper.config.splitCwd) {
Expand Down Expand Up @@ -340,7 +341,6 @@ export class SwitchTerminalAction extends Action {
if (customType) {
return this._commands.executeCommand(customType.command);
}

console.warn(`Unmatched terminal item: "${item}"`);
return Promise.resolve();
}
Expand All @@ -349,7 +349,7 @@ export class SwitchTerminalAction extends Action {
export class SwitchTerminalActionViewItem extends SelectActionViewItem {

public static readonly SEPARATOR = '─────────';

private _lastOptions: ISelectOptionItem[] = [];
constructor(
action: IAction,
@ITerminalService private readonly _terminalService: ITerminalService,
Expand All @@ -376,7 +376,12 @@ export class SwitchTerminalActionViewItem extends SelectActionViewItem {
}

private _updateItems(): void {
this.setOptions(getTerminalSelectOpenItems(this._terminalService, this._contributions), this._terminalService.activeTabIndex);
const options = getTerminalSelectOpenItems(this._terminalService, this._contributions);
// only update options if they've changed
if (!equals(Object.values(options), Object.values(this._lastOptions))) {
this.setOptions(options, this._terminalService.activeTabIndex);
this._lastOptions = options;
}
}
}

Expand Down