mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
fix #146972
This commit is contained in:
parent
ade21d7359
commit
ae2fe7d085
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import * as dom from 'vs/base/browser/dom';
|
import * as dom from 'vs/base/browser/dom';
|
||||||
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||||
import { IAction } from 'vs/base/common/actions';
|
import { Action, IAction } from 'vs/base/common/actions';
|
||||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||||
import { DropdownWithPrimaryActionViewItem } from 'vs/platform/actions/browser/dropdownWithPrimaryActionViewItem';
|
import { DropdownWithPrimaryActionViewItem } from 'vs/platform/actions/browser/dropdownWithPrimaryActionViewItem';
|
||||||
import { IMenu, IMenuService, MenuId, MenuItemAction } from 'vs/platform/actions/common/actions';
|
import { IMenu, IMenuService, MenuId, MenuItemAction } from 'vs/platform/actions/common/actions';
|
||||||
|
@ -211,6 +211,7 @@ export class TerminalEditor extends EditorPane {
|
||||||
if (action instanceof MenuItemAction) {
|
if (action instanceof MenuItemAction) {
|
||||||
const location = { viewColumn: ACTIVE_GROUP };
|
const location = { viewColumn: ACTIVE_GROUP };
|
||||||
const actions = getTerminalActionBarArgs(location, this._terminalProfileService.availableProfiles, this._getDefaultProfileName(), this._terminalProfileService.contributedProfiles, this._terminalService, this._dropdownMenu);
|
const actions = getTerminalActionBarArgs(location, this._terminalProfileService.availableProfiles, this._getDefaultProfileName(), this._terminalProfileService.contributedProfiles, this._terminalService, this._dropdownMenu);
|
||||||
|
this._registerDisposableActions(actions.dropdownAction, actions.dropdownMenuActions);
|
||||||
const button = this._instantiationService.createInstance(DropdownWithPrimaryActionViewItem, action, actions.dropdownAction, actions.dropdownMenuActions, actions.className, this._contextMenuService, { hoverDelegate: options.hoverDelegate });
|
const button = this._instantiationService.createInstance(DropdownWithPrimaryActionViewItem, action, actions.dropdownAction, actions.dropdownMenuActions, actions.className, this._contextMenuService, { hoverDelegate: options.hoverDelegate });
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
@ -219,6 +220,16 @@ export class TerminalEditor extends EditorPane {
|
||||||
return super.getActionViewItem(action, options);
|
return super.getActionViewItem(action, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actions might be of type Action (disposable) or Separator or SubmenuAction, which don't extend Disposable
|
||||||
|
*/
|
||||||
|
private _registerDisposableActions(dropdownAction: IAction, dropdownMenuActions: IAction[]): void {
|
||||||
|
if (dropdownAction instanceof Action) {
|
||||||
|
this._register(dropdownAction);
|
||||||
|
}
|
||||||
|
dropdownMenuActions.filter(a => a instanceof Action).forEach(a => this._register(a));
|
||||||
|
}
|
||||||
|
|
||||||
private _getDefaultProfileName(): string {
|
private _getDefaultProfileName(): string {
|
||||||
let defaultProfileName;
|
let defaultProfileName;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -272,6 +272,7 @@ export class TerminalViewPane extends ViewPane {
|
||||||
case TerminalCommandId.New: {
|
case TerminalCommandId.New: {
|
||||||
if (action instanceof MenuItemAction) {
|
if (action instanceof MenuItemAction) {
|
||||||
const actions = getTerminalActionBarArgs(TerminalLocation.Panel, this._terminalProfileService.availableProfiles, this._getDefaultProfileName(), this._terminalProfileService.contributedProfiles, this._terminalService, this._dropdownMenu);
|
const actions = getTerminalActionBarArgs(TerminalLocation.Panel, this._terminalProfileService.availableProfiles, this._getDefaultProfileName(), this._terminalProfileService.contributedProfiles, this._terminalService, this._dropdownMenu);
|
||||||
|
this._registerDisposableActions(actions.dropdownAction, actions.dropdownMenuActions);
|
||||||
this._newDropdown?.dispose();
|
this._newDropdown?.dispose();
|
||||||
this._newDropdown = new DropdownWithPrimaryActionViewItem(action, actions.dropdownAction, actions.dropdownMenuActions, actions.className, this._contextMenuService, { hoverDelegate: options.hoverDelegate }, this._keybindingService, this._notificationService, this._contextKeyService, this._themeService, this._accessibilityService);
|
this._newDropdown = new DropdownWithPrimaryActionViewItem(action, actions.dropdownAction, actions.dropdownMenuActions, actions.className, this._contextMenuService, { hoverDelegate: options.hoverDelegate }, this._keybindingService, this._notificationService, this._contextKeyService, this._themeService, this._accessibilityService);
|
||||||
this._updateTabActionBar(this._terminalProfileService.availableProfiles);
|
this._updateTabActionBar(this._terminalProfileService.availableProfiles);
|
||||||
|
@ -282,6 +283,16 @@ export class TerminalViewPane extends ViewPane {
|
||||||
return super.getActionViewItem(action, options);
|
return super.getActionViewItem(action, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actions might be of type Action (disposable) or Separator or SubmenuAction, which don't extend Disposable
|
||||||
|
*/
|
||||||
|
private _registerDisposableActions(dropdownAction: IAction, dropdownMenuActions: IAction[]): void {
|
||||||
|
if (dropdownAction instanceof Action) {
|
||||||
|
this._register(dropdownAction);
|
||||||
|
}
|
||||||
|
dropdownMenuActions.filter(a => a instanceof Action).forEach(a => this._register(a));
|
||||||
|
}
|
||||||
|
|
||||||
private _getDefaultProfileName(): string {
|
private _getDefaultProfileName(): string {
|
||||||
let defaultProfileName;
|
let defaultProfileName;
|
||||||
try {
|
try {
|
||||||
|
@ -298,6 +309,7 @@ export class TerminalViewPane extends ViewPane {
|
||||||
|
|
||||||
private _updateTabActionBar(profiles: ITerminalProfile[]): void {
|
private _updateTabActionBar(profiles: ITerminalProfile[]): void {
|
||||||
const actions = getTerminalActionBarArgs(TerminalLocation.Panel, profiles, this._getDefaultProfileName(), this._terminalProfileService.contributedProfiles, this._terminalService, this._dropdownMenu);
|
const actions = getTerminalActionBarArgs(TerminalLocation.Panel, profiles, this._getDefaultProfileName(), this._terminalProfileService.contributedProfiles, this._terminalService, this._dropdownMenu);
|
||||||
|
this._registerDisposableActions(actions.dropdownAction, actions.dropdownMenuActions);
|
||||||
this._newDropdown?.update(actions.dropdownAction, actions.dropdownMenuActions);
|
this._newDropdown?.update(actions.dropdownAction, actions.dropdownMenuActions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue