@codingame/monaco-vscode-views-service-override 2.0.3 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/index.d.ts +1 -1
  2. package/index.js +1 -1
  3. package/package.json +11 -11
  4. package/tools/editor.js +14 -0
  5. package/views.js +12 -5
  6. package/vscode/src/vs/base/common/codicons.d.ts +5 -0
  7. package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +2 -2
  8. package/vscode/src/vs/workbench/browser/actions/listCommands.js +160 -4
  9. package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +14 -19
  10. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +1 -1
  11. package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +59 -21
  12. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +77 -45
  13. package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +23 -1
  14. package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +77 -45
  15. package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +131 -5
  16. package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +1 -1
  17. package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +1 -1
  18. package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +2 -2
  19. package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +1 -1
  20. package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.d.ts +1 -3
  21. package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +8 -16
  22. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +13 -13
  23. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +8 -3
  24. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +1 -1
  25. package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +4 -0
  26. package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +2 -2
  27. package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +3 -4
  28. package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +1 -1
  29. package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +1 -1
  30. package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +1 -1
  31. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +17 -16
  32. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +4 -4
  33. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +1 -1
  34. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +13 -13
  35. package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +2 -2
  36. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +1 -1
  37. package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +2 -1
  38. package/vscode/src/vs/workbench/services/activity/browser/activityService.js +1 -0
  39. package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +18 -4
  40. package/vscode/src/vs/workbench/services/history/browser/historyService.js +2 -2
  41. package/vscode/src/vs/workbench/services/progress/browser/progressService.js +15 -4
  42. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +2 -2
  43. package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +6 -2
  44. package/vscode/src/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.css.js +0 -6
  45. package/vscode/src/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.js +0 -290
  46. package/vscode/src/vs/workbench/browser/parts/editor/breadcrumbsControl.js +0 -801
  47. package/vscode/src/vs/workbench/browser/parts/editor/breadcrumbsModel.js +0 -142
  48. package/vscode/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.js +0 -412
  49. package/vscode/src/vs/workbench/browser/parts/editor/editorGroupView.js +0 -1315
  50. package/vscode/src/vs/workbench/browser/parts/editor/editorGroupWatermark.js +0 -186
  51. package/vscode/src/vs/workbench/browser/parts/editor/editorPanes.js +0 -346
  52. package/vscode/src/vs/workbench/browser/parts/editor/editorTitleControl.js +0 -154
  53. package/vscode/src/vs/workbench/browser/parts/editor/media/breadcrumbscontrol.css.js +0 -6
  54. package/vscode/src/vs/workbench/browser/parts/editor/media/editorgroupview.css.js +0 -6
  55. package/vscode/src/vs/workbench/browser/parts/editor/media/editortitlecontrol.css.js +0 -6
  56. package/vscode/src/vs/workbench/browser/parts/editor/media/multieditortabscontrol.css.js +0 -6
  57. package/vscode/src/vs/workbench/browser/parts/editor/media/singleeditortabscontrol.css.js +0 -6
  58. package/vscode/src/vs/workbench/browser/parts/editor/multiEditorTabsControl.js +0 -1623
  59. package/vscode/src/vs/workbench/browser/parts/editor/multiRowEditorTabsControl.js +0 -152
  60. package/vscode/src/vs/workbench/browser/parts/editor/noEditorTabsControl.js +0 -54
  61. package/vscode/src/vs/workbench/browser/parts/editor/singleEditorTabsControl.js +0 -259
  62. package/vscode/src/vs/workbench/common/editor/filteredEditorGroupModel.js +0 -109
  63. package/vscode/src/vs/workbench/services/hover/browser/hoverService.js +0 -195
  64. package/vscode/src/vs/workbench/services/hover/browser/hoverWidget.js +0 -528
  65. package/vscode/src/vs/workbench/services/hover/browser/media/hover.css.js +0 -6
@@ -1,152 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { Dimension } from 'vscode/vscode/vs/base/browser/dom';
3
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
4
- import { MultiEditorTabsControl } from './multiEditorTabsControl.js';
5
- import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
6
- import { StickyEditorGroupModel, UnstickyEditorGroupModel } from '../../../common/editor/filteredEditorGroupModel.js';
7
-
8
- let MultiRowEditorControl = class MultiRowEditorControl extends Disposable {
9
- constructor(parent, editorPartsView, groupsView, groupView, model, instantiationService) {
10
- super();
11
- this.parent = parent;
12
- this.groupsView = groupsView;
13
- this.groupView = groupView;
14
- this.model = model;
15
- this.instantiationService = instantiationService;
16
- const stickyModel = this._register(( new StickyEditorGroupModel(this.model)));
17
- const unstickyModel = this._register(( new UnstickyEditorGroupModel(this.model)));
18
- this.stickyEditorTabsControl = this._register(this.instantiationService.createInstance(MultiEditorTabsControl, this.parent, editorPartsView, this.groupsView, this.groupView, stickyModel));
19
- this.unstickyEditorTabsControl = this._register(this.instantiationService.createInstance(MultiEditorTabsControl, this.parent, editorPartsView, this.groupsView, this.groupView, unstickyModel));
20
- this.handlePinnedTabsSeparateRowToolbars();
21
- }
22
- handlePinnedTabsSeparateRowToolbars() {
23
- if (this.groupView.count === 0) {
24
- return;
25
- }
26
- if (this.groupView.count === this.groupView.stickyCount) {
27
- this.parent.classList.toggle('two-tab-bars', false);
28
- }
29
- else {
30
- this.parent.classList.toggle('two-tab-bars', true);
31
- }
32
- }
33
- getEditorTabsController(editor) {
34
- return this.model.isSticky(editor) ? this.stickyEditorTabsControl : this.unstickyEditorTabsControl;
35
- }
36
- openEditor(editor, options) {
37
- const [editorTabController, otherTabController] = this.model.isSticky(editor) ? [this.stickyEditorTabsControl, this.unstickyEditorTabsControl] : [this.unstickyEditorTabsControl, this.stickyEditorTabsControl];
38
- const didChange = editorTabController.openEditor(editor, options);
39
- if (didChange) {
40
- otherTabController.openEditors([]);
41
- this.handleOpenedEditors();
42
- }
43
- return didChange;
44
- }
45
- openEditors(editors) {
46
- const stickyEditors = editors.filter(e => this.model.isSticky(e));
47
- const unstickyEditors = editors.filter(e => !this.model.isSticky(e));
48
- const didChangeOpenEditorsSticky = this.stickyEditorTabsControl.openEditors(stickyEditors);
49
- const didChangeOpenEditorsUnSticky = this.unstickyEditorTabsControl.openEditors(unstickyEditors);
50
- const didChange = didChangeOpenEditorsSticky || didChangeOpenEditorsUnSticky;
51
- if (didChange) {
52
- this.handleOpenedEditors();
53
- }
54
- return didChange;
55
- }
56
- handleOpenedEditors() {
57
- this.handlePinnedTabsSeparateRowToolbars();
58
- }
59
- beforeCloseEditor(editor) {
60
- this.getEditorTabsController(editor).beforeCloseEditor(editor);
61
- }
62
- closeEditor(editor) {
63
- this.stickyEditorTabsControl.closeEditor(editor);
64
- this.unstickyEditorTabsControl.closeEditor(editor);
65
- this.handleClosedEditors();
66
- }
67
- closeEditors(editors) {
68
- const stickyEditors = editors.filter(e => this.model.isSticky(e));
69
- const unstickyEditors = editors.filter(e => !this.model.isSticky(e));
70
- this.stickyEditorTabsControl.closeEditors(stickyEditors);
71
- this.unstickyEditorTabsControl.closeEditors(unstickyEditors);
72
- this.handleClosedEditors();
73
- }
74
- handleClosedEditors() {
75
- this.handlePinnedTabsSeparateRowToolbars();
76
- }
77
- moveEditor(editor, fromIndex, targetIndex, stickyStateChange) {
78
- if (stickyStateChange) {
79
- if (this.model.isSticky(editor)) {
80
- this.stickyEditorTabsControl.openEditor(editor);
81
- this.unstickyEditorTabsControl.closeEditor(editor);
82
- }
83
- else {
84
- this.stickyEditorTabsControl.closeEditor(editor);
85
- this.unstickyEditorTabsControl.openEditor(editor);
86
- }
87
- this.handlePinnedTabsSeparateRowToolbars();
88
- }
89
- else {
90
- if (this.model.isSticky(editor)) {
91
- this.stickyEditorTabsControl.moveEditor(editor, fromIndex, targetIndex, stickyStateChange);
92
- }
93
- else {
94
- this.unstickyEditorTabsControl.moveEditor(editor, fromIndex - this.model.stickyCount, targetIndex - this.model.stickyCount, stickyStateChange);
95
- }
96
- }
97
- }
98
- pinEditor(editor) {
99
- this.getEditorTabsController(editor).pinEditor(editor);
100
- }
101
- stickEditor(editor) {
102
- this.unstickyEditorTabsControl.closeEditor(editor);
103
- this.stickyEditorTabsControl.openEditor(editor);
104
- this.handlePinnedTabsSeparateRowToolbars();
105
- }
106
- unstickEditor(editor) {
107
- this.stickyEditorTabsControl.closeEditor(editor);
108
- this.unstickyEditorTabsControl.openEditor(editor);
109
- this.handlePinnedTabsSeparateRowToolbars();
110
- }
111
- setActive(isActive) {
112
- this.stickyEditorTabsControl.setActive(isActive);
113
- this.unstickyEditorTabsControl.setActive(isActive);
114
- }
115
- updateEditorLabel(editor) {
116
- this.getEditorTabsController(editor).updateEditorLabel(editor);
117
- }
118
- updateEditorDirty(editor) {
119
- this.getEditorTabsController(editor).updateEditorDirty(editor);
120
- }
121
- updateOptions(oldOptions, newOptions) {
122
- this.stickyEditorTabsControl.updateOptions(oldOptions, newOptions);
123
- this.unstickyEditorTabsControl.updateOptions(oldOptions, newOptions);
124
- }
125
- layout(dimensions) {
126
- const stickyDimensions = this.stickyEditorTabsControl.layout(dimensions);
127
- const unstickyAvailableDimensions = {
128
- container: dimensions.container,
129
- available: ( new Dimension(
130
- dimensions.available.width,
131
- dimensions.available.height - stickyDimensions.height
132
- ))
133
- };
134
- const unstickyDimensions = this.unstickyEditorTabsControl.layout(unstickyAvailableDimensions);
135
- return ( new Dimension(
136
- dimensions.container.width,
137
- stickyDimensions.height + unstickyDimensions.height
138
- ));
139
- }
140
- getHeight() {
141
- return this.stickyEditorTabsControl.getHeight() + this.unstickyEditorTabsControl.getHeight();
142
- }
143
- dispose() {
144
- this.parent.classList.toggle('two-tab-bars', false);
145
- super.dispose();
146
- }
147
- };
148
- MultiRowEditorControl = ( __decorate([
149
- ( __param(5, IInstantiationService))
150
- ], MultiRowEditorControl));
151
-
152
- export { MultiRowEditorControl };
@@ -1,54 +0,0 @@
1
- import './media/singleeditortabscontrol.css.js';
2
- import { EditorTabsControl } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorTabsControl';
3
- import { Dimension } from 'vscode/vscode/vs/base/browser/dom';
4
-
5
- class NoEditorTabsControl extends EditorTabsControl {
6
- constructor() {
7
- super(...arguments);
8
- this.activeEditor = null;
9
- }
10
- prepareEditorActions(editorActions) {
11
- return {
12
- primary: [],
13
- secondary: []
14
- };
15
- }
16
- openEditor(editor) {
17
- return this.handleOpenedEditors();
18
- }
19
- openEditors(editors) {
20
- return this.handleOpenedEditors();
21
- }
22
- handleOpenedEditors() {
23
- const didChange = this.activeEditorChanged();
24
- this.activeEditor = this.tabsModel.activeEditor;
25
- return didChange;
26
- }
27
- activeEditorChanged() {
28
- if (!this.activeEditor && this.tabsModel.activeEditor ||
29
- this.activeEditor && !this.tabsModel.activeEditor ||
30
- (!this.activeEditor || !this.tabsModel.isActive(this.activeEditor))
31
- ) {
32
- return true;
33
- }
34
- return false;
35
- }
36
- beforeCloseEditor(editor) { }
37
- closeEditor(editor) { }
38
- closeEditors(editors) { }
39
- moveEditor(editor, fromIndex, targetIndex) { }
40
- pinEditor(editor) { }
41
- stickEditor(editor) { }
42
- unstickEditor(editor) { }
43
- setActive(isActive) { }
44
- updateEditorLabel(editor) { }
45
- updateEditorDirty(editor) { }
46
- getHeight() {
47
- return 0;
48
- }
49
- layout(dimensions) {
50
- return ( new Dimension(dimensions.container.width, this.getHeight()));
51
- }
52
- }
53
-
54
- export { NoEditorTabsControl };
@@ -1,259 +0,0 @@
1
- import './media/singleeditortabscontrol.css.js';
2
- import { preventEditorClose, EditorCloseMethod, EditorResourceAccessor, SideBySideEditor } from 'vscode/vscode/vs/workbench/common/editor';
3
- import { EditorTabsControl } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorTabsControl';
4
- import { ResourceLabel } from 'vscode/vscode/vs/workbench/browser/labels';
5
- import { TAB_ACTIVE_FOREGROUND, TAB_UNFOCUSED_ACTIVE_FOREGROUND } from 'vscode/vscode/vs/workbench/common/theme';
6
- import { Gesture, EventType as EventType$1 } from 'vscode/vscode/vs/base/browser/touch';
7
- import { addDisposableListener, EventType, DragAndDropObserver, EventHelper, isAncestor, Dimension } from 'vscode/vscode/vs/base/browser/dom';
8
- import { CLOSE_EDITOR_COMMAND_ID, UNLOCK_GROUP_COMMAND_ID } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorCommands';
9
- import { Color } from 'vscode/vscode/vs/base/common/color';
10
- import { assertIsDefined, assertAllDefined } from 'vscode/vscode/vs/base/common/types';
11
- import { equals } from 'vscode/vscode/vs/base/common/objects';
12
- import { toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
13
- import { defaultBreadcrumbsWidgetStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
14
- import { BreadcrumbsControlFactory } from './breadcrumbsControl.js';
15
-
16
- class SingleEditorTabsControl extends EditorTabsControl {
17
- constructor() {
18
- super(...arguments);
19
- this.activeLabel = Object.create(null);
20
- }
21
- get breadcrumbsControl() { return this.breadcrumbsControlFactory?.control; }
22
- create(parent) {
23
- super.create(parent);
24
- const titleContainer = this.titleContainer = parent;
25
- titleContainer.draggable = true;
26
- this.registerContainerListeners(titleContainer);
27
- this._register(Gesture.addTarget(titleContainer));
28
- const labelContainer = document.createElement('div');
29
- labelContainer.classList.add('label-container');
30
- titleContainer.appendChild(labelContainer);
31
- this.editorLabel = this._register(this.instantiationService.createInstance(ResourceLabel, labelContainer, undefined)).element;
32
- this._register(addDisposableListener(this.editorLabel.element, EventType.CLICK, e => this.onTitleLabelClick(e)));
33
- this.breadcrumbsControlFactory = this._register(this.instantiationService.createInstance(BreadcrumbsControlFactory, labelContainer, this.groupView, {
34
- showFileIcons: false,
35
- showSymbolIcons: true,
36
- showDecorationColors: false,
37
- widgetStyles: { ...defaultBreadcrumbsWidgetStyles, breadcrumbsBackground: ( Color.transparent.toString()) },
38
- showPlaceholder: false
39
- }));
40
- this._register(this.breadcrumbsControlFactory.onDidEnablementChange(() => this.handleBreadcrumbsEnablementChange()));
41
- titleContainer.classList.toggle('breadcrumbs', Boolean(this.breadcrumbsControl));
42
- this._register(toDisposable(() => titleContainer.classList.remove('breadcrumbs')));
43
- this.createEditorActionsToolBar(titleContainer, ['title-actions']);
44
- }
45
- registerContainerListeners(titleContainer) {
46
- let lastDragEvent = undefined;
47
- this._register(( new DragAndDropObserver(titleContainer, {
48
- onDragStart: e => this.onGroupDragStart(e, titleContainer),
49
- onDrag: e => { lastDragEvent = e; },
50
- onDragEnd: e => { this.onGroupDragEnd(e, lastDragEvent, titleContainer); },
51
- })));
52
- this._register(addDisposableListener(titleContainer, EventType.DBLCLICK, e => this.onTitleDoubleClick(e)));
53
- this._register(addDisposableListener(titleContainer, EventType.AUXCLICK, e => this.onTitleAuxClick(e)));
54
- this._register(addDisposableListener(titleContainer, EventType$1.Tap, (e) => this.onTitleTap(e)));
55
- for (const event of [EventType.CONTEXT_MENU, EventType$1.Contextmenu]) {
56
- this._register(addDisposableListener(titleContainer, event, e => {
57
- if (this.tabsModel.activeEditor) {
58
- this.onTabContextMenu(this.tabsModel.activeEditor, e, titleContainer);
59
- }
60
- }));
61
- }
62
- }
63
- onTitleLabelClick(e) {
64
- EventHelper.stop(e, false);
65
- setTimeout(() => this.quickInputService.quickAccess.show());
66
- }
67
- onTitleDoubleClick(e) {
68
- EventHelper.stop(e);
69
- this.groupView.pinEditor();
70
- }
71
- onTitleAuxClick(e) {
72
- if (e.button === 1 && this.tabsModel.activeEditor) {
73
- EventHelper.stop(e, true );
74
- if (!preventEditorClose(this.tabsModel, this.tabsModel.activeEditor, EditorCloseMethod.MOUSE, this.groupsView.partOptions)) {
75
- this.groupView.closeEditor(this.tabsModel.activeEditor);
76
- }
77
- }
78
- }
79
- onTitleTap(e) {
80
- const target = e.initialTarget;
81
- if (!(target instanceof HTMLElement) || !this.editorLabel || !isAncestor(target, this.editorLabel.element)) {
82
- return;
83
- }
84
- setTimeout(() => this.quickInputService.quickAccess.show(), 50);
85
- }
86
- openEditor(editor) {
87
- return this.doHandleOpenEditor();
88
- }
89
- openEditors(editors) {
90
- return this.doHandleOpenEditor();
91
- }
92
- doHandleOpenEditor() {
93
- const activeEditorChanged = this.ifActiveEditorChanged(() => this.redraw());
94
- if (!activeEditorChanged) {
95
- this.ifActiveEditorPropertiesChanged(() => this.redraw());
96
- }
97
- return activeEditorChanged;
98
- }
99
- beforeCloseEditor(editor) {
100
- }
101
- closeEditor(editor) {
102
- this.ifActiveEditorChanged(() => this.redraw());
103
- }
104
- closeEditors(editors) {
105
- this.ifActiveEditorChanged(() => this.redraw());
106
- }
107
- moveEditor(editor, fromIndex, targetIndex) {
108
- this.ifActiveEditorChanged(() => this.redraw());
109
- }
110
- pinEditor(editor) {
111
- this.ifEditorIsActive(editor, () => this.redraw());
112
- }
113
- stickEditor(editor) {
114
- }
115
- unstickEditor(editor) {
116
- }
117
- setActive(isActive) {
118
- this.redraw();
119
- }
120
- updateEditorLabel(editor) {
121
- this.ifEditorIsActive(editor, () => this.redraw());
122
- }
123
- updateEditorDirty(editor) {
124
- this.ifEditorIsActive(editor, () => {
125
- const titleContainer = assertIsDefined(this.titleContainer);
126
- if (editor.isDirty() && !editor.isSaving()) {
127
- titleContainer.classList.add('dirty');
128
- }
129
- else {
130
- titleContainer.classList.remove('dirty');
131
- }
132
- });
133
- }
134
- updateOptions(oldOptions, newOptions) {
135
- super.updateOptions(oldOptions, newOptions);
136
- if (oldOptions.labelFormat !== newOptions.labelFormat || !equals(oldOptions.decorations, newOptions.decorations)) {
137
- this.redraw();
138
- }
139
- }
140
- updateStyles() {
141
- this.redraw();
142
- }
143
- handleBreadcrumbsEnablementChange() {
144
- const titleContainer = assertIsDefined(this.titleContainer);
145
- titleContainer.classList.toggle('breadcrumbs', Boolean(this.breadcrumbsControl));
146
- this.redraw();
147
- }
148
- ifActiveEditorChanged(fn) {
149
- if (!this.activeLabel.editor && this.tabsModel.activeEditor ||
150
- this.activeLabel.editor && !this.tabsModel.activeEditor ||
151
- (!this.activeLabel.editor || !this.tabsModel.isActive(this.activeLabel.editor))
152
- ) {
153
- fn();
154
- return true;
155
- }
156
- return false;
157
- }
158
- ifActiveEditorPropertiesChanged(fn) {
159
- if (!this.activeLabel.editor || !this.tabsModel.activeEditor) {
160
- return;
161
- }
162
- if (this.activeLabel.pinned !== this.tabsModel.isPinned(this.tabsModel.activeEditor)) {
163
- fn();
164
- }
165
- }
166
- ifEditorIsActive(editor, fn) {
167
- if (this.tabsModel.isActive(editor)) {
168
- fn();
169
- }
170
- }
171
- redraw() {
172
- const editor = this.tabsModel.activeEditor ?? undefined;
173
- const options = this.groupsView.partOptions;
174
- const isEditorPinned = editor ? this.tabsModel.isPinned(editor) : false;
175
- const isGroupActive = this.groupsView.activeGroup === this.groupView;
176
- this.activeLabel = { editor, pinned: isEditorPinned };
177
- if (this.breadcrumbsControl) {
178
- if (isGroupActive) {
179
- this.breadcrumbsControl.update();
180
- this.breadcrumbsControl.domNode.classList.toggle('preview', !isEditorPinned);
181
- }
182
- else {
183
- this.breadcrumbsControl.hide();
184
- }
185
- }
186
- const [titleContainer, editorLabel] = assertAllDefined(this.titleContainer, this.editorLabel);
187
- if (!editor) {
188
- titleContainer.classList.remove('dirty');
189
- editorLabel.clear();
190
- this.clearEditorActionsToolbar();
191
- }
192
- else {
193
- this.updateEditorDirty(editor);
194
- const { labelFormat } = this.groupsView.partOptions;
195
- let description;
196
- if (this.breadcrumbsControl && !this.breadcrumbsControl.isHidden()) {
197
- description = '';
198
- }
199
- else if (labelFormat === 'default' && !isGroupActive) {
200
- description = '';
201
- }
202
- else {
203
- description = editor.getDescription(this.getVerbosity(labelFormat)) || '';
204
- }
205
- let title = editor.getTitle(2 );
206
- if (description === title) {
207
- title = '';
208
- }
209
- editorLabel.setResource({
210
- resource: EditorResourceAccessor.getOriginalUri(editor, { supportSideBySide: SideBySideEditor.BOTH }),
211
- name: editor.getName(),
212
- description
213
- }, {
214
- title,
215
- italic: !isEditorPinned,
216
- extraClasses: ['single-tab', 'title-label'].concat(editor.getLabelExtraClasses()),
217
- fileDecorations: {
218
- colors: Boolean(options.decorations?.colors),
219
- badges: Boolean(options.decorations?.badges)
220
- },
221
- });
222
- if (isGroupActive) {
223
- titleContainer.style.color = this.getColor(TAB_ACTIVE_FOREGROUND) || '';
224
- }
225
- else {
226
- titleContainer.style.color = this.getColor(TAB_UNFOCUSED_ACTIVE_FOREGROUND) || '';
227
- }
228
- this.updateEditorActionsToolbar();
229
- }
230
- }
231
- getVerbosity(style) {
232
- switch (style) {
233
- case 'short': return 0 ;
234
- case 'long': return 2 ;
235
- default: return 1 ;
236
- }
237
- }
238
- prepareEditorActions(editorActions) {
239
- const isGroupActive = this.groupsView.activeGroup === this.groupView;
240
- if (isGroupActive) {
241
- return editorActions;
242
- }
243
- else {
244
- return {
245
- primary: editorActions.primary.filter(action => action.id === CLOSE_EDITOR_COMMAND_ID || action.id === UNLOCK_GROUP_COMMAND_ID),
246
- secondary: editorActions.secondary
247
- };
248
- }
249
- }
250
- getHeight() {
251
- return this.tabHeight;
252
- }
253
- layout(dimensions) {
254
- this.breadcrumbsControl?.layout(undefined);
255
- return ( new Dimension(dimensions.container.width, this.getHeight()));
256
- }
257
- }
258
-
259
- export { SingleEditorTabsControl };
@@ -1,109 +0,0 @@
1
- import { Emitter } from 'vscode/vscode/vs/base/common/event';
2
- import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
3
-
4
- class FilteredEditorGroupModel extends Disposable {
5
- constructor(model) {
6
- super();
7
- this.model = model;
8
- this._onDidModelChange = this._register(( new Emitter()));
9
- this.onDidModelChange = this._onDidModelChange.event;
10
- this._register(this.model.onDidModelChange(e => {
11
- const candidateOrIndex = e.editorIndex ?? e.editor;
12
- if (candidateOrIndex !== undefined) {
13
- if (!this.filter(candidateOrIndex)) {
14
- return;
15
- }
16
- }
17
- this._onDidModelChange.fire(e);
18
- }));
19
- }
20
- get id() { return this.model.id; }
21
- get isLocked() { return this.model.isLocked; }
22
- get stickyCount() { return this.model.stickyCount; }
23
- get activeEditor() { return this.model.activeEditor && this.filter(this.model.activeEditor) ? this.model.activeEditor : null; }
24
- get previewEditor() { return this.model.previewEditor && this.filter(this.model.previewEditor) ? this.model.previewEditor : null; }
25
- isPinned(editorOrIndex) { return this.model.isPinned(editorOrIndex); }
26
- isSticky(editorOrIndex) { return this.model.isSticky(editorOrIndex); }
27
- isActive(editor) { return this.model.isActive(editor); }
28
- isFirst(editor) {
29
- return this.model.isFirst(editor, this.getEditors(1 ));
30
- }
31
- isLast(editor) {
32
- return this.model.isLast(editor, this.getEditors(1 ));
33
- }
34
- getEditors(order, options) {
35
- const editors = this.model.getEditors(order, options);
36
- return editors.filter(e => this.filter(e));
37
- }
38
- findEditor(candidate, options) {
39
- const result = this.model.findEditor(candidate, options);
40
- if (!result) {
41
- return undefined;
42
- }
43
- return this.filter(result[1]) ? result : undefined;
44
- }
45
- }
46
- class StickyEditorGroupModel extends FilteredEditorGroupModel {
47
- get count() { return this.model.stickyCount; }
48
- getEditors(order, options) {
49
- if (options?.excludeSticky) {
50
- return [];
51
- }
52
- if (order === 1 ) {
53
- return this.model.getEditors(1 ).slice(0, this.model.stickyCount);
54
- }
55
- return super.getEditors(order, options);
56
- }
57
- isSticky(editorOrIndex) {
58
- return true;
59
- }
60
- getEditorByIndex(index) {
61
- return index < this.count ? this.model.getEditorByIndex(index) : undefined;
62
- }
63
- indexOf(editor, editors, options) {
64
- const editorIndex = this.model.indexOf(editor, editors, options);
65
- if (editorIndex < 0 || editorIndex >= this.model.stickyCount) {
66
- return -1;
67
- }
68
- return editorIndex;
69
- }
70
- contains(candidate, options) {
71
- const editorIndex = this.model.indexOf(candidate, undefined, options);
72
- return editorIndex >= 0 && editorIndex < this.model.stickyCount;
73
- }
74
- filter(candidateOrIndex) {
75
- return this.model.isSticky(candidateOrIndex);
76
- }
77
- }
78
- class UnstickyEditorGroupModel extends FilteredEditorGroupModel {
79
- get count() { return this.model.count - this.model.stickyCount; }
80
- get stickyCount() { return 0; }
81
- isSticky(editorOrIndex) {
82
- return false;
83
- }
84
- getEditors(order, options) {
85
- if (order === 1 ) {
86
- return this.model.getEditors(1 ).slice(this.model.stickyCount);
87
- }
88
- return super.getEditors(order, options);
89
- }
90
- getEditorByIndex(index) {
91
- return index >= 0 ? this.model.getEditorByIndex(index + this.model.stickyCount) : undefined;
92
- }
93
- indexOf(editor, editors, options) {
94
- const editorIndex = this.model.indexOf(editor, editors, options);
95
- if (editorIndex < this.model.stickyCount || editorIndex >= this.model.count) {
96
- return -1;
97
- }
98
- return editorIndex - this.model.stickyCount;
99
- }
100
- contains(candidate, options) {
101
- const editorIndex = this.model.indexOf(candidate, undefined, options);
102
- return editorIndex >= this.model.stickyCount && editorIndex < this.model.count;
103
- }
104
- filter(candidateOrIndex) {
105
- return !this.model.isSticky(candidateOrIndex);
106
- }
107
- }
108
-
109
- export { StickyEditorGroupModel, UnstickyEditorGroupModel };