Skip to content

Commit a443309

Browse files
authored
Merge pull request microsoft#106385 from microsoft/ben/pinned-tabs-setting
Pinned Tabs Enhancements
2 parents c591f8b + 1424f2b commit a443309

20 files changed

Lines changed: 456 additions & 282 deletions

File tree

src/vs/base/browser/ui/actionbar/actionbar.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as DOM from 'vs/base/browser/dom';
1010
import * as types from 'vs/base/common/types';
1111
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
1212
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
13-
import { Event, Emitter } from 'vs/base/common/event';
13+
import { Emitter } from 'vs/base/common/event';
1414
import { IActionViewItemOptions, ActionViewItem, BaseActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems';
1515

1616
export const enum ActionsOrientation {
@@ -47,8 +47,9 @@ export class ActionBar extends Disposable implements IActionRunner {
4747

4848
private _actionRunner: IActionRunner;
4949
private _context: unknown;
50-
private _orientation: ActionsOrientation;
51-
private _triggerKeys: ActionTrigger;
50+
private readonly _orientation: ActionsOrientation;
51+
private readonly _triggerKeys: ActionTrigger;
52+
private _actionIds: string[];
5253

5354
// View Items
5455
viewItems: IActionViewItem[];
@@ -60,16 +61,16 @@ export class ActionBar extends Disposable implements IActionRunner {
6061
protected actionsList: HTMLElement;
6162

6263
private _onDidBlur = this._register(new Emitter<void>());
63-
readonly onDidBlur: Event<void> = this._onDidBlur.event;
64+
readonly onDidBlur = this._onDidBlur.event;
6465

6566
private _onDidCancel = this._register(new Emitter<void>());
66-
readonly onDidCancel: Event<void> = this._onDidCancel.event;
67+
readonly onDidCancel = this._onDidCancel.event;
6768

6869
private _onDidRun = this._register(new Emitter<IRunEvent>());
69-
readonly onDidRun: Event<IRunEvent> = this._onDidRun.event;
70+
readonly onDidRun = this._onDidRun.event;
7071

7172
private _onDidBeforeRun = this._register(new Emitter<IRunEvent>());
72-
readonly onDidBeforeRun: Event<IRunEvent> = this._onDidBeforeRun.event;
73+
readonly onDidBeforeRun = this._onDidBeforeRun.event;
7374

7475
constructor(container: HTMLElement, options: IActionBarOptions = {}) {
7576
super();
@@ -92,6 +93,7 @@ export class ActionBar extends Disposable implements IActionRunner {
9293
this._register(this._actionRunner.onDidRun(e => this._onDidRun.fire(e)));
9394
this._register(this._actionRunner.onDidBeforeRun(e => this._onDidBeforeRun.fire(e)));
9495

96+
this._actionIds = [];
9597
this.viewItems = [];
9698
this.focusedItem = undefined;
9799

@@ -245,6 +247,10 @@ export class ActionBar extends Disposable implements IActionRunner {
245247
return this.domNode;
246248
}
247249

250+
hasAction(action: IAction): boolean {
251+
return this._actionIds.includes(action.id);
252+
}
253+
248254
push(arg: IAction | ReadonlyArray<IAction>, options: IActionOptions = {}): void {
249255
const actions: ReadonlyArray<IAction> = Array.isArray(arg) ? arg : [arg];
250256

@@ -279,9 +285,11 @@ export class ActionBar extends Disposable implements IActionRunner {
279285
if (index === null || index < 0 || index >= this.actionsList.children.length) {
280286
this.actionsList.appendChild(actionViewItemElement);
281287
this.viewItems.push(item);
288+
this._actionIds.push(action.id);
282289
} else {
283290
this.actionsList.insertBefore(actionViewItemElement, this.actionsList.children[index]);
284291
this.viewItems.splice(index, 0, item);
292+
this._actionIds.splice(index, 0, action.id);
285293
index++;
286294
}
287295
});
@@ -317,12 +325,14 @@ export class ActionBar extends Disposable implements IActionRunner {
317325
if (index >= 0 && index < this.viewItems.length) {
318326
this.actionsList.removeChild(this.actionsList.childNodes[index]);
319327
dispose(this.viewItems.splice(index, 1));
328+
this._actionIds.splice(index, 1);
320329
}
321330
}
322331

323332
clear(): void {
324333
dispose(this.viewItems);
325334
this.viewItems = [];
335+
this._actionIds = [];
326336
DOM.clearNode(this.actionsList);
327337
}
328338

@@ -463,6 +473,8 @@ export class ActionBar extends Disposable implements IActionRunner {
463473
dispose(this.viewItems);
464474
this.viewItems = [];
465475

476+
this._actionIds = [];
477+
466478
DOM.removeNode(this.getContainer());
467479

468480
super.dispose();

src/vs/base/test/browser/actionbar.test.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as assert from 'assert';
7-
import { prepareActions } from 'vs/base/browser/ui/actionbar/actionbar';
7+
import { ActionBar, prepareActions } from 'vs/base/browser/ui/actionbar/actionbar';
88
import { Action, Separator } from 'vs/base/common/actions';
99

1010
suite('Actionbar', () => {
@@ -24,4 +24,37 @@ suite('Actionbar', () => {
2424
assert(actions[1] === a5);
2525
assert(actions[2] === a6);
2626
});
27+
28+
test('hasAction()', function () {
29+
const container = document.createElement('div');
30+
const actionbar = new ActionBar(container);
31+
32+
let a1 = new Action('a1');
33+
let a2 = new Action('a2');
34+
35+
actionbar.push(a1);
36+
assert.equal(actionbar.hasAction(a1), true);
37+
assert.equal(actionbar.hasAction(a2), false);
38+
39+
actionbar.pull(0);
40+
assert.equal(actionbar.hasAction(a1), false);
41+
42+
actionbar.push(a1, { index: 1 });
43+
actionbar.push(a2, { index: 0 });
44+
assert.equal(actionbar.hasAction(a1), true);
45+
assert.equal(actionbar.hasAction(a2), true);
46+
47+
actionbar.pull(0);
48+
assert.equal(actionbar.hasAction(a1), true);
49+
assert.equal(actionbar.hasAction(a2), false);
50+
51+
actionbar.pull(0);
52+
assert.equal(actionbar.hasAction(a1), false);
53+
assert.equal(actionbar.hasAction(a2), false);
54+
55+
actionbar.push(a1);
56+
assert.equal(actionbar.hasAction(a1), true);
57+
actionbar.clear();
58+
assert.equal(actionbar.hasAction(a1), false);
59+
});
2760
});

src/vs/editor/contrib/suggest/suggestController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ export class SuggestController implements IEditorContribution {
442442
private _alertCompletionItem({ completion: suggestion }: CompletionItem): void {
443443
const textLabel = typeof suggestion.label === 'string' ? suggestion.label : suggestion.label.name;
444444
if (isNonEmptyArray(suggestion.additionalTextEdits)) {
445-
let msg = nls.localize('arai.alert.snippet', "Accepting '{0}' made {1} additional edits", textLabel, suggestion.additionalTextEdits.length);
445+
let msg = nls.localize('aria.alert.snippet', "Accepting '{0}' made {1} additional edits", textLabel, suggestion.additionalTextEdits.length);
446446
alert(msg);
447447
}
448448
}

src/vs/workbench/browser/contextkeys.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Event } from 'vs/base/common/event';
77
import { Disposable } from 'vs/base/common/lifecycle';
88
import { IContextKeyService, IContextKey, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
99
import { InputFocusedContext, IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsDevelopmentContext } from 'vs/platform/contextkey/common/contextkeys';
10-
import { ActiveEditorContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, ActiveEditorGroupEmptyContext, MultipleEditorGroupsContext, TEXT_DIFF_EDITOR_ID, SplitEditorsVertically, InEditorZenModeContext, IsCenteredLayoutContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, EditorReadonlyContext, EditorAreaVisibleContext, ActiveEditorAvailableEditorIdsContext } from 'vs/workbench/common/editor';
10+
import { ActiveEditorContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, ActiveEditorGroupEmptyContext, MultipleEditorGroupsContext, TEXT_DIFF_EDITOR_ID, SplitEditorsVertically, InEditorZenModeContext, IsCenteredLayoutContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorReadonlyContext, EditorAreaVisibleContext, ActiveEditorAvailableEditorIdsContext } from 'vs/workbench/common/editor';
1111
import { trackFocus, addDisposableListener, EventType } from 'vs/base/browser/dom';
1212
import { preferredSideBySideGroupDirection, GroupDirection, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
1313
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@@ -87,7 +87,7 @@ export class WorkbenchContextKeysHandler extends Disposable {
8787

8888
// Editors
8989
this.activeEditorContext = ActiveEditorContext.bindTo(this.contextKeyService);
90-
this.activeEditorIsReadonly = EditorReadonlyContext.bindTo(this.contextKeyService);
90+
this.activeEditorIsReadonly = ActiveEditorReadonlyContext.bindTo(this.contextKeyService);
9191
this.activeEditorAvailableEditorIds = ActiveEditorAvailableEditorIdsContext.bindTo(this.contextKeyService);
9292
this.editorsVisibleContext = EditorsVisibleContext.bindTo(this.contextKeyService);
9393
this.textCompareEditorVisibleContext = TextCompareEditorVisibleContext.bindTo(this.contextKeyService);

src/vs/workbench/browser/parts/editor/editor.contribution.ts

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
77
import * as nls from 'vs/nls';
88
import { URI, UriComponents } from 'vs/base/common/uri';
99
import { IEditorRegistry, EditorDescriptor, Extensions as EditorExtensions } from 'vs/workbench/browser/editor';
10-
import { EditorInput, IEditorInputFactory, SideBySideEditorInput, IEditorInputFactoryRegistry, Extensions as EditorInputExtensions, TextCompareEditorActiveContext, EditorPinnedContext, EditorGroupEditorsCountContext, EditorStickyContext, ActiveEditorAvailableEditorIdsContext, MultipleEditorGroupsContext } from 'vs/workbench/common/editor';
10+
import { EditorInput, IEditorInputFactory, SideBySideEditorInput, IEditorInputFactoryRegistry, Extensions as EditorInputExtensions, TextCompareEditorActiveContext, ActiveEditorPinnedContext, EditorGroupEditorsCountContext, ActiveEditorStickyContext, ActiveEditorAvailableEditorIdsContext, MultipleEditorGroupsContext, ActiveEditorDirtyContext } from 'vs/workbench/common/editor';
1111
import { TextResourceEditor } from 'vs/workbench/browser/parts/editor/textResourceEditor';
1212
import { SideBySideEditor } from 'vs/workbench/browser/parts/editor/sideBySideEditor';
1313
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
@@ -447,9 +447,9 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCo
447447
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.CLOSE_SAVED_EDITORS_COMMAND_ID, title: nls.localize('closeAllSaved', "Close Saved") }, group: '1_close', order: 40 });
448448
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.CLOSE_EDITORS_IN_GROUP_COMMAND_ID, title: nls.localize('closeAll', "Close All") }, group: '1_close', order: 50 });
449449
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: ReopenResourcesAction.ID, title: ReopenResourcesAction.LABEL }, group: '1_open', order: 10, when: ActiveEditorAvailableEditorIdsContext });
450-
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.KEEP_EDITOR_COMMAND_ID, title: nls.localize('keepOpen', "Keep Open"), precondition: EditorPinnedContext.toNegated() }, group: '3_preview', order: 10, when: ContextKeyExpr.has('config.workbench.editor.enablePreview') });
451-
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.PIN_EDITOR_COMMAND_ID, title: nls.localize('pin', "Pin") }, group: '3_preview', order: 20, when: ContextKeyExpr.and(EditorStickyContext.toNegated(), ContextKeyExpr.has('config.workbench.editor.showTabs')) });
452-
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.UNPIN_EDITOR_COMMAND_ID, title: nls.localize('unpin', "Unpin") }, group: '3_preview', order: 20, when: ContextKeyExpr.and(EditorStickyContext, ContextKeyExpr.has('config.workbench.editor.showTabs')) });
450+
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.KEEP_EDITOR_COMMAND_ID, title: nls.localize('keepOpen', "Keep Open"), precondition: ActiveEditorPinnedContext.toNegated() }, group: '3_preview', order: 10, when: ContextKeyExpr.has('config.workbench.editor.enablePreview') });
451+
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.PIN_EDITOR_COMMAND_ID, title: nls.localize('pin', "Pin") }, group: '3_preview', order: 20, when: ActiveEditorStickyContext.toNegated() });
452+
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.UNPIN_EDITOR_COMMAND_ID, title: nls.localize('unpin', "Unpin") }, group: '3_preview', order: 20, when: ActiveEditorStickyContext });
453453
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.SPLIT_EDITOR_UP, title: nls.localize('splitUp', "Split Up") }, group: '5_split', order: 10 });
454454
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.SPLIT_EDITOR_DOWN, title: nls.localize('splitDown', "Split Down") }, group: '5_split', order: 20 });
455455
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.SPLIT_EDITOR_LEFT, title: nls.localize('splitLeft', "Split Left") }, group: '5_split', order: 30 });
@@ -518,14 +518,14 @@ appendEditorToolItem(
518518
}
519519
);
520520

521-
// Editor Title Menu: Close Group (tabs disabled)
521+
// Editor Title Menu: Close (tabs disabled, dirty editor)
522522
appendEditorToolItem(
523523
{
524524
id: editorCommands.CLOSE_EDITOR_COMMAND_ID,
525525
title: nls.localize('close', "Close"),
526-
icon: { id: 'codicon/close' }
526+
icon: { id: 'codicon/close-dirty' }
527527
},
528-
ContextKeyExpr.and(ContextKeyExpr.not('config.workbench.editor.showTabs'), ContextKeyExpr.not('activeEditorIsDirty')),
528+
ContextKeyExpr.and(ContextKeyExpr.not('config.workbench.editor.showTabs'), ActiveEditorDirtyContext),
529529
1000000, // towards the far end
530530
{
531531
id: editorCommands.CLOSE_EDITORS_IN_GROUP_COMMAND_ID,
@@ -534,13 +534,30 @@ appendEditorToolItem(
534534
}
535535
);
536536

537+
// Editor Title Menu: Close (tabs disabled, sticky editor)
537538
appendEditorToolItem(
539+
{
540+
id: editorCommands.UNPIN_EDITOR_COMMAND_ID,
541+
title: nls.localize('unpin', "Unpin"),
542+
icon: { id: 'codicon/pinned' }
543+
},
544+
ContextKeyExpr.and(ContextKeyExpr.not('config.workbench.editor.showTabs'), ActiveEditorDirtyContext.toNegated(), ActiveEditorStickyContext),
545+
1000000, // towards the far end
538546
{
539547
id: editorCommands.CLOSE_EDITOR_COMMAND_ID,
540548
title: nls.localize('close', "Close"),
541-
icon: { id: 'codicon/close-dirty' }
549+
icon: { id: 'codicon/close' }
550+
}
551+
);
552+
553+
// Editor Title Menu: Unpin (tabs disabled, normal editor)
554+
appendEditorToolItem(
555+
{
556+
id: editorCommands.CLOSE_EDITOR_COMMAND_ID,
557+
title: nls.localize('close', "Close"),
558+
icon: { id: 'codicon/close' }
542559
},
543-
ContextKeyExpr.and(ContextKeyExpr.not('config.workbench.editor.showTabs'), ContextKeyExpr.has('activeEditorIsDirty')),
560+
ContextKeyExpr.and(ContextKeyExpr.not('config.workbench.editor.showTabs'), ActiveEditorDirtyContext.toNegated(), ActiveEditorStickyContext.toNegated()),
544561
1000000, // towards the far end
545562
{
546563
id: editorCommands.CLOSE_EDITORS_IN_GROUP_COMMAND_ID,
@@ -596,8 +613,10 @@ appendEditorToolItem(
596613
// Editor Commands for Command Palette
597614
const viewCategory = { value: nls.localize('view', "View"), original: 'View' };
598615
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.KEEP_EDITOR_COMMAND_ID, title: { value: nls.localize('keepEditor', "Keep Editor"), original: 'Keep Editor' }, category: viewCategory }, when: ContextKeyExpr.has('config.workbench.editor.enablePreview') });
599-
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.PIN_EDITOR_COMMAND_ID, title: { value: nls.localize('pinEditor', "Pin Editor"), original: 'Pin Editor' }, category: viewCategory }, when: ContextKeyExpr.has('config.workbench.editor.showTabs') });
600-
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.UNPIN_EDITOR_COMMAND_ID, title: { value: nls.localize('unpinEditor', "Unpin Editor"), original: 'Unpin Editor' }, category: viewCategory }, when: ContextKeyExpr.has('config.workbench.editor.showTabs') });
616+
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.PIN_EDITOR_COMMAND_ID, title: { value: nls.localize('pinEditor', "Pin Editor"), original: 'Pin Editor' }, category: viewCategory } });
617+
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.UNPIN_EDITOR_COMMAND_ID, title: { value: nls.localize('unpinEditor', "Unpin Editor"), original: 'Unpin Editor' }, category: viewCategory } });
618+
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.CLOSE_EDITOR_COMMAND_ID, title: { value: nls.localize('closeEditor', "Close Editor"), original: 'Close Editor' }, category: viewCategory } });
619+
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.CLOSE_PINNED_EDITOR_COMMAND_ID, title: { value: nls.localize('closePinnedEditor', "Close Pinned Editor"), original: 'Close Pinned Editor' }, category: viewCategory } });
601620
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.CLOSE_EDITORS_IN_GROUP_COMMAND_ID, title: { value: nls.localize('closeEditorsInGroup', "Close All Editors in Group"), original: 'Close All Editors in Group' }, category: viewCategory } });
602621
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.CLOSE_SAVED_EDITORS_COMMAND_ID, title: { value: nls.localize('closeSavedEditors', "Close Saved Editors in Group"), original: 'Close Saved Editors in Group' }, category: viewCategory } });
603622
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID, title: { value: nls.localize('closeOtherEditors', "Close Other Editors in Group"), original: 'Close Other Editors in Group' }, category: viewCategory } });

src/vs/workbench/browser/parts/editor/editor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export const DEFAULT_EDITOR_PART_OPTIONS: IEditorPartOptions = {
3030
highlightModifiedTabs: false,
3131
tabCloseButton: 'right',
3232
tabSizing: 'fit',
33+
pinnedTabSizing: 'shrink',
3334
titleScrollbarSizing: 'default',
3435
focusRecentEditorAfterClose: true,
3536
showIcons: true,

src/vs/workbench/browser/parts/editor/editorActions.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/la
1010
import { IHistoryService } from 'vs/workbench/services/history/common/history';
1111
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
1212
import { ICommandService } from 'vs/platform/commands/common/commands';
13-
import { CLOSE_EDITOR_COMMAND_ID, MOVE_ACTIVE_EDITOR_COMMAND_ID, ActiveEditorMoveArguments, SPLIT_EDITOR_LEFT, SPLIT_EDITOR_RIGHT, SPLIT_EDITOR_UP, SPLIT_EDITOR_DOWN, splitEditor, LAYOUT_EDITOR_GROUPS_COMMAND_ID, mergeAllGroups } from 'vs/workbench/browser/parts/editor/editorCommands';
13+
import { CLOSE_EDITOR_COMMAND_ID, MOVE_ACTIVE_EDITOR_COMMAND_ID, ActiveEditorMoveArguments, SPLIT_EDITOR_LEFT, SPLIT_EDITOR_RIGHT, SPLIT_EDITOR_UP, SPLIT_EDITOR_DOWN, splitEditor, LAYOUT_EDITOR_GROUPS_COMMAND_ID, mergeAllGroups, UNPIN_EDITOR_COMMAND_ID } from 'vs/workbench/browser/parts/editor/editorCommands';
1414
import { IEditorGroupsService, IEditorGroup, GroupsArrangement, GroupLocation, GroupDirection, preferredSideBySideGroupDirection, IFindGroupScope, GroupOrientation, EditorGroupLayout, GroupsOrder, OpenEditorContext } from 'vs/workbench/services/editor/common/editorGroupsService';
1515
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
1616
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@@ -406,6 +406,24 @@ export class CloseEditorAction extends Action {
406406
}
407407
}
408408

409+
export class UnpinEditorAction extends Action {
410+
411+
static readonly ID = 'workbench.action.unpinActiveEditor';
412+
static readonly LABEL = nls.localize('unpinEditor', "Unpin Editor");
413+
414+
constructor(
415+
id: string,
416+
label: string,
417+
@ICommandService private readonly commandService: ICommandService
418+
) {
419+
super(id, label, Codicon.pinned.classNames);
420+
}
421+
422+
run(context?: IEditorCommandsContext): Promise<void> {
423+
return this.commandService.executeCommand(UNPIN_EDITOR_COMMAND_ID, undefined, context);
424+
}
425+
}
426+
409427
export class CloseOneEditorAction extends Action {
410428

411429
static readonly ID = 'workbench.action.closeActiveEditor';

0 commit comments

Comments
 (0)