Skip to content

Commit

Permalink
Merge pull request #173376 from microsoft/tyriar/166506_3
Browse files Browse the repository at this point in the history
Toggle terminal in web when there are no contributed profiles
  • Loading branch information
Tyriar committed Feb 3, 2023
2 parents 40f31f9 + 52e366e commit 5a64e8b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/vs/workbench/browser/parts/titlebar/menubarControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'vs/css!./media/menubarControl';
import { localize } from 'vs/nls';
import { IMenuService, MenuId, IMenu, SubmenuItemAction, registerAction2, Action2, MenuItemAction, MenuRegistry } from 'vs/platform/actions/common/actions';
import { MenuBarVisibility, getTitleBarStyle, IWindowOpenable, getMenuBarVisibility } from 'vs/platform/window/common/window';
import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IAction, Action, SubmenuAction, Separator, IActionRunner, ActionRunner, WorkbenchActionExecutedEvent, WorkbenchActionExecutedClassification } from 'vs/base/common/actions';
import { addDisposableListener, Dimension, EventType } from 'vs/base/browser/dom';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
Expand Down Expand Up @@ -101,8 +101,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarMainMenu, {
original: 'Terminal',
mnemonicTitle: localize({ key: 'mTerminal', comment: ['&& denotes a mnemonic'] }, "&&Terminal")
},
order: 7,
when: ContextKeyExpr.has('terminalProcessSupported')
order: 7
});

MenuRegistry.appendMenuItem(MenuId.MenubarMainMenu, {
Expand Down
9 changes: 7 additions & 2 deletions src/vs/workbench/contrib/terminal/browser/terminalActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1820,6 +1820,7 @@ export function registerTerminalActions() {
const terminalService = accessor.get(ITerminalService);
const terminalEditorService = accessor.get(ITerminalEditorService);
const terminalGroupService = accessor.get(ITerminalGroupService);
const terminalProfileService = accessor.get(ITerminalProfileService);
const workspaceContextService = accessor.get(IWorkspaceContextService);
const commandService = accessor.get(ICommandService);
const folders = workspaceContextService.getWorkspace().folders;
Expand Down Expand Up @@ -1847,8 +1848,12 @@ export function registerTerminalActions() {
}
terminalService.setActiveInstance(instance);
await focusActiveTerminal(instance, terminalEditorService, terminalGroupService);
} else if (TerminalContextKeys.webExtensionContributedProfile) {
commandService.executeCommand(TerminalCommandId.NewWithProfile);
} else {
if (terminalProfileService.contributedProfiles.length > 0) {
commandService.executeCommand(TerminalCommandId.NewWithProfile);
} else {
commandService.executeCommand(TerminalCommandId.Toggle);
}
}
}
});
Expand Down

0 comments on commit 5a64e8b

Please sign in to comment.