@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,186 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
- import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
4
- import { isMacintosh, isWeb, OS } from 'vscode/vscode/vs/base/common/platform';
5
- import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
6
- import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
7
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
8
- import { h, append, $, clearNode } from 'vscode/vscode/vs/base/browser/dom';
9
- import { KeybindingLabel } from 'vscode/vscode/vs/base/browser/ui/keybindingLabel/keybindingLabel';
10
- import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/commands';
11
- import { ContextKeyExpr, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
12
- import { defaultKeybindingLabelStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
13
-
14
- const showCommands = { text: ( localizeWithPath(
15
- 'vs/workbench/browser/parts/editor/editorGroupWatermark',
16
- 'watermark.showCommands',
17
- "Show All Commands"
18
- )), id: 'workbench.action.showCommands' };
19
- const quickAccess = { text: ( localizeWithPath(
20
- 'vs/workbench/browser/parts/editor/editorGroupWatermark',
21
- 'watermark.quickAccess',
22
- "Go to File"
23
- )), id: 'workbench.action.quickOpen' };
24
- const openFileNonMacOnly = { text: ( localizeWithPath(
25
- 'vs/workbench/browser/parts/editor/editorGroupWatermark',
26
- 'watermark.openFile',
27
- "Open File"
28
- )), id: 'workbench.action.files.openFile', mac: false };
29
- const openFolderNonMacOnly = { text: ( localizeWithPath(
30
- 'vs/workbench/browser/parts/editor/editorGroupWatermark',
31
- 'watermark.openFolder',
32
- "Open Folder"
33
- )), id: 'workbench.action.files.openFolder', mac: false };
34
- const openFileOrFolderMacOnly = { text: ( localizeWithPath(
35
- 'vs/workbench/browser/parts/editor/editorGroupWatermark',
36
- 'watermark.openFileFolder',
37
- "Open File or Folder"
38
- )), id: 'workbench.action.files.openFileFolder', mac: true };
39
- const openRecent = { text: ( localizeWithPath(
40
- 'vs/workbench/browser/parts/editor/editorGroupWatermark',
41
- 'watermark.openRecent',
42
- "Open Recent"
43
- )), id: 'workbench.action.openRecent' };
44
- const newUntitledFileMacOnly = { text: ( localizeWithPath(
45
- 'vs/workbench/browser/parts/editor/editorGroupWatermark',
46
- 'watermark.newUntitledFile',
47
- "New Untitled Text File"
48
- )), id: 'workbench.action.files.newUntitledFile', mac: true };
49
- const findInFiles = { text: ( localizeWithPath(
50
- 'vs/workbench/browser/parts/editor/editorGroupWatermark',
51
- 'watermark.findInFiles',
52
- "Find in Files"
53
- )), id: 'workbench.action.findInFiles' };
54
- const toggleTerminal = { text: ( localizeWithPath(
55
- 'vs/workbench/browser/parts/editor/editorGroupWatermark',
56
- { key: 'watermark.toggleTerminal', comment: ['toggle is a verb here'] },
57
- "Toggle Terminal"
58
- )), id: 'workbench.action.terminal.toggleTerminal', when: ( ContextKeyExpr.equals('terminalProcessSupported', true)) };
59
- const startDebugging = { text: ( localizeWithPath(
60
- 'vs/workbench/browser/parts/editor/editorGroupWatermark',
61
- 'watermark.startDebugging',
62
- "Start Debugging"
63
- )), id: 'workbench.action.debug.start', when: ( ContextKeyExpr.equals('terminalProcessSupported', true)) };
64
- const toggleFullscreen = { text: ( localizeWithPath(
65
- 'vs/workbench/browser/parts/editor/editorGroupWatermark',
66
- { key: 'watermark.toggleFullscreen', comment: ['toggle is a verb here'] },
67
- "Toggle Full Screen"
68
- )), id: 'workbench.action.toggleFullScreen', when: ( ( ContextKeyExpr.equals('terminalProcessSupported', true)).negate()) };
69
- const showSettings = { text: ( localizeWithPath(
70
- 'vs/workbench/browser/parts/editor/editorGroupWatermark',
71
- 'watermark.showSettings',
72
- "Show Settings"
73
- )), id: 'workbench.action.openSettings', when: ( ( ContextKeyExpr.equals('terminalProcessSupported', true)).negate()) };
74
- const noFolderEntries = [
75
- showCommands,
76
- openFileNonMacOnly,
77
- openFolderNonMacOnly,
78
- openFileOrFolderMacOnly,
79
- openRecent,
80
- newUntitledFileMacOnly
81
- ];
82
- const folderEntries = [
83
- showCommands,
84
- quickAccess,
85
- findInFiles,
86
- startDebugging,
87
- toggleTerminal,
88
- toggleFullscreen,
89
- showSettings
90
- ];
91
- let EditorGroupWatermark = class EditorGroupWatermark extends Disposable {
92
- constructor(container, keybindingService, contextService, contextKeyService, configurationService) {
93
- super();
94
- this.keybindingService = keybindingService;
95
- this.contextService = contextService;
96
- this.contextKeyService = contextKeyService;
97
- this.configurationService = configurationService;
98
- this.transientDisposables = this._register(( new DisposableStore()));
99
- this.enabled = false;
100
- const elements = h('.editor-group-watermark', [
101
- h('.letterpress'),
102
- h('.shortcuts@shortcuts'),
103
- ]);
104
- append(container, elements.root);
105
- this.shortcuts = elements.shortcuts;
106
- this.registerListeners();
107
- this.workbenchState = contextService.getWorkbenchState();
108
- this.render();
109
- }
110
- registerListeners() {
111
- this._register(this.configurationService.onDidChangeConfiguration(e => {
112
- if (e.affectsConfiguration('workbench.tips.enabled')) {
113
- this.render();
114
- }
115
- }));
116
- this._register(this.contextService.onDidChangeWorkbenchState(workbenchState => {
117
- if (this.workbenchState === workbenchState) {
118
- return;
119
- }
120
- this.workbenchState = workbenchState;
121
- this.render();
122
- }));
123
- const allEntriesWhenClauses = ( [...noFolderEntries, ...folderEntries].filter(entry => entry.when !== undefined).map(entry => entry.when));
124
- const allKeys = ( new Set());
125
- allEntriesWhenClauses.forEach(when => ( when.keys()).forEach(key => allKeys.add(key)));
126
- this._register(this.contextKeyService.onDidChangeContext(e => {
127
- if (e.affectsSome(allKeys)) {
128
- this.render();
129
- }
130
- }));
131
- }
132
- render() {
133
- const enabled = this.configurationService.getValue('workbench.tips.enabled');
134
- if (enabled === this.enabled) {
135
- return;
136
- }
137
- this.enabled = enabled;
138
- this.clear();
139
- if (!enabled) {
140
- return;
141
- }
142
- const box = append(this.shortcuts, $('.watermark-box'));
143
- const folder = this.workbenchState !== 1 ;
144
- const selected = (folder ? folderEntries : noFolderEntries)
145
- .filter(entry => !('when' in entry) || this.contextKeyService.contextMatchesRules(entry.when))
146
- .filter(entry => !('mac' in entry) || entry.mac === (isMacintosh && !isWeb))
147
- .filter(entry => !!CommandsRegistry.getCommand(entry.id));
148
- const update = () => {
149
- clearNode(box);
150
- selected.forEach(entry => {
151
- const keys = this.keybindingService.lookupKeybinding(entry.id);
152
- if (!keys) {
153
- return;
154
- }
155
- const dl = append(box, $('dl'));
156
- const dt = append(dl, $('dt'));
157
- dt.textContent = entry.text;
158
- const dd = append(dl, $('dd'));
159
- const keybinding = ( new KeybindingLabel(
160
- dd,
161
- OS,
162
- { renderUnboundKeybindings: true, ...defaultKeybindingLabelStyles }
163
- ));
164
- keybinding.set(keys);
165
- });
166
- };
167
- update();
168
- this.transientDisposables.add(this.keybindingService.onDidUpdateKeybindings(update));
169
- }
170
- clear() {
171
- clearNode(this.shortcuts);
172
- this.transientDisposables.clear();
173
- }
174
- dispose() {
175
- super.dispose();
176
- this.clear();
177
- }
178
- };
179
- EditorGroupWatermark = ( __decorate([
180
- ( __param(1, IKeybindingService)),
181
- ( __param(2, IWorkspaceContextService)),
182
- ( __param(3, IContextKeyService)),
183
- ( __param(4, IConfigurationService))
184
- ], EditorGroupWatermark));
185
-
186
- export { EditorGroupWatermark };
@@ -1,346 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
- import { toAction } from 'vscode/vscode/vs/base/common/actions';
4
- import { Emitter } from 'vscode/vscode/vs/base/common/event';
5
- import Severity from 'vscode/vscode/vs/base/common/severity';
6
- import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
7
- import { EditorExtensions, createEditorOpenError, isEditorOpenError } from 'vscode/vscode/vs/workbench/common/editor';
8
- import { getWindow, isAncestor, show, Dimension, hide } from 'vscode/vscode/vs/base/browser/dom';
9
- import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
10
- import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
11
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
12
- import { LongRunningOperation, IEditorProgressService } from 'vscode/vscode/vs/platform/progress/common/progress';
13
- import { DEFAULT_EDITOR_MIN_DIMENSIONS, DEFAULT_EDITOR_MAX_DIMENSIONS } from 'vscode/vscode/vs/workbench/browser/parts/editor/editor';
14
- import { assertIsDefined } from 'vscode/vscode/vs/base/common/types';
15
- import { IWorkspaceTrustManagementService } from 'vscode/vscode/vs/platform/workspace/common/workspaceTrust';
16
- import { ErrorPlaceholderEditor, WorkspaceTrustRequiredPlaceholderEditor } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorPlaceholder';
17
- import { EditorOpenSource } from 'vscode/vscode/vs/platform/editor/common/editor';
18
- import { isCancellationError } from 'vscode/vscode/vs/base/common/errors';
19
- import { toErrorMessage } from 'vscode/vscode/vs/base/common/errorMessage';
20
- import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
21
- import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
22
- import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host';
23
- import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
24
- import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
25
-
26
- let EditorPanes = class EditorPanes extends Disposable {
27
- get minimumWidth() { return this._activeEditorPane?.minimumWidth ?? DEFAULT_EDITOR_MIN_DIMENSIONS.width; }
28
- get minimumHeight() { return this._activeEditorPane?.minimumHeight ?? DEFAULT_EDITOR_MIN_DIMENSIONS.height; }
29
- get maximumWidth() { return this._activeEditorPane?.maximumWidth ?? DEFAULT_EDITOR_MAX_DIMENSIONS.width; }
30
- get maximumHeight() { return this._activeEditorPane?.maximumHeight ?? DEFAULT_EDITOR_MAX_DIMENSIONS.height; }
31
- get activeEditorPane() { return this._activeEditorPane; }
32
- constructor(editorGroupParent, editorPanesParent, groupView, layoutService, instantiationService, editorProgressService, workspaceTrustService, logService, dialogService, hostService) {
33
- super();
34
- this.editorGroupParent = editorGroupParent;
35
- this.editorPanesParent = editorPanesParent;
36
- this.groupView = groupView;
37
- this.layoutService = layoutService;
38
- this.instantiationService = instantiationService;
39
- this.editorProgressService = editorProgressService;
40
- this.workspaceTrustService = workspaceTrustService;
41
- this.logService = logService;
42
- this.dialogService = dialogService;
43
- this.hostService = hostService;
44
- this._onDidFocus = this._register(( new Emitter()));
45
- this.onDidFocus = this._onDidFocus.event;
46
- this._onDidChangeSizeConstraints = this._register(( new Emitter()));
47
- this.onDidChangeSizeConstraints = this._onDidChangeSizeConstraints.event;
48
- this._activeEditorPane = null;
49
- this.editorPanes = [];
50
- this.activeEditorPaneDisposables = this._register(( new DisposableStore()));
51
- this.editorOperation = this._register(( new LongRunningOperation(this.editorProgressService)));
52
- this.editorPanesRegistry = ( Registry.as(EditorExtensions.EditorPane));
53
- this.registerListeners();
54
- }
55
- registerListeners() {
56
- this._register(this.workspaceTrustService.onDidChangeTrust(() => this.onDidChangeWorkspaceTrust()));
57
- }
58
- onDidChangeWorkspaceTrust() {
59
- const editor = this._activeEditorPane?.input;
60
- const options = this._activeEditorPane?.options;
61
- if (editor?.hasCapability(16 )) {
62
- this.groupView.openEditor(editor, options);
63
- }
64
- }
65
- async openEditor(editor, options, internalOptions, context = Object.create(null)) {
66
- try {
67
- if (getWindow(this.editorGroupParent) !== mainWindow && editor.hasCapability(1024 )) {
68
- return await this.doShowError(createEditorOpenError(( localizeWithPath(
69
- 'vs/workbench/browser/parts/editor/editorPanes',
70
- 'editorUnsupportedInAuxWindow',
71
- "This type of editor cannot be opened in other windows yet."
72
- )), [
73
- toAction({
74
- id: 'workbench.editor.action.closeEditor', label: ( localizeWithPath(
75
- 'vs/workbench/browser/parts/editor/editorPanes',
76
- 'openFolder',
77
- "Close Editor"
78
- )), run: async () => {
79
- return this.groupView.closeEditor(editor);
80
- }
81
- })
82
- ], { forceMessage: true, forceSeverity: Severity.Warning }), editor, options, internalOptions, context);
83
- }
84
- else {
85
- return await this.doOpenEditor(this.getEditorPaneDescriptor(editor), editor, options, internalOptions, context);
86
- }
87
- }
88
- catch (error) {
89
- if (options?.ignoreError) {
90
- return { error };
91
- }
92
- return this.doShowError(error, editor, options, internalOptions, context);
93
- }
94
- }
95
- async doShowError(error, editor, options, internalOptions, context) {
96
- this.logService.error(error);
97
- let errorHandled = false;
98
- if (options?.source === EditorOpenSource.USER && (!isEditorOpenError(error) || error.allowDialog)) {
99
- errorHandled = await this.doShowErrorDialog(error, editor);
100
- }
101
- if (errorHandled) {
102
- return { error };
103
- }
104
- const editorPlaceholderOptions = { ...options };
105
- if (!isCancellationError(error)) {
106
- editorPlaceholderOptions.error = error;
107
- }
108
- return {
109
- ...(await this.doOpenEditor(ErrorPlaceholderEditor.DESCRIPTOR, editor, editorPlaceholderOptions, internalOptions, context)),
110
- error
111
- };
112
- }
113
- async doShowErrorDialog(error, editor) {
114
- let severity = Severity.Error;
115
- let message = undefined;
116
- let detail = toErrorMessage(error);
117
- let errorActions = undefined;
118
- if (isEditorOpenError(error)) {
119
- errorActions = error.actions;
120
- severity = error.forceSeverity ?? Severity.Error;
121
- if (error.forceMessage) {
122
- message = error.message;
123
- detail = undefined;
124
- }
125
- }
126
- if (!message) {
127
- message = ( localizeWithPath(
128
- 'vs/workbench/browser/parts/editor/editorPanes',
129
- 'editorOpenErrorDialog',
130
- "Unable to open '{0}'",
131
- editor.getName()
132
- ));
133
- }
134
- const buttons = [];
135
- if (errorActions && errorActions.length > 0) {
136
- for (const errorAction of errorActions) {
137
- buttons.push({
138
- label: errorAction.label,
139
- run: () => errorAction
140
- });
141
- }
142
- }
143
- else {
144
- buttons.push({
145
- label: ( localizeWithPath(
146
- 'vs/workbench/browser/parts/editor/editorPanes',
147
- { key: 'ok', comment: ['&& denotes a mnemonic'] },
148
- "&&OK"
149
- )),
150
- run: () => undefined
151
- });
152
- }
153
- let cancelButton = undefined;
154
- if (buttons.length === 1) {
155
- cancelButton = {
156
- run: () => {
157
- errorHandled = true;
158
- return undefined;
159
- }
160
- };
161
- }
162
- let errorHandled = false;
163
- const { result } = await this.dialogService.prompt({
164
- type: severity,
165
- message,
166
- detail,
167
- buttons,
168
- cancelButton
169
- });
170
- if (result) {
171
- const errorActionResult = result.run();
172
- if (errorActionResult instanceof Promise) {
173
- errorActionResult.catch(error => this.dialogService.error(toErrorMessage(error)));
174
- }
175
- errorHandled = true;
176
- }
177
- return errorHandled;
178
- }
179
- async doOpenEditor(descriptor, editor, options, internalOptions, context = Object.create(null)) {
180
- const pane = this.doShowEditorPane(descriptor);
181
- const activeElement = this.editorPanesParent.ownerDocument.activeElement;
182
- const { changed, cancelled } = await this.doSetInput(pane, editor, options, context);
183
- if (!cancelled) {
184
- const focus = !options || !options.preserveFocus;
185
- if (focus && this.shouldRestoreFocus(activeElement)) {
186
- pane.focus();
187
- }
188
- else if (!internalOptions?.preserveWindowOrder) {
189
- this.hostService.moveTop(getWindow(this.editorGroupParent));
190
- }
191
- }
192
- return { pane, changed, cancelled };
193
- }
194
- shouldRestoreFocus(expectedActiveElement) {
195
- if (!this.layoutService.isRestored()) {
196
- return true;
197
- }
198
- if (!expectedActiveElement) {
199
- return true;
200
- }
201
- const activeElement = expectedActiveElement.ownerDocument.activeElement;
202
- if (!activeElement || activeElement === expectedActiveElement.ownerDocument.body) {
203
- return true;
204
- }
205
- const same = expectedActiveElement === activeElement;
206
- if (same) {
207
- return true;
208
- }
209
- if (activeElement.tagName !== 'INPUT' && activeElement.tagName !== 'TEXTAREA') {
210
- return true;
211
- }
212
- if (isAncestor(activeElement, this.editorGroupParent)) {
213
- return true;
214
- }
215
- return false;
216
- }
217
- getEditorPaneDescriptor(editor) {
218
- if (editor.hasCapability(16 ) && !this.workspaceTrustService.isWorkspaceTrusted()) {
219
- return WorkspaceTrustRequiredPlaceholderEditor.DESCRIPTOR;
220
- }
221
- return assertIsDefined(this.editorPanesRegistry.getEditorPane(editor));
222
- }
223
- doShowEditorPane(descriptor) {
224
- if (this._activeEditorPane && descriptor.describes(this._activeEditorPane)) {
225
- return this._activeEditorPane;
226
- }
227
- this.doHideActiveEditorPane();
228
- const editorPane = this.doCreateEditorPane(descriptor);
229
- this.doSetActiveEditorPane(editorPane);
230
- const container = assertIsDefined(editorPane.getContainer());
231
- this.editorPanesParent.appendChild(container);
232
- show(container);
233
- editorPane.setVisible(true, this.groupView);
234
- if (this.pagePosition) {
235
- editorPane.layout(( new Dimension(this.pagePosition.width, this.pagePosition.height)), { top: this.pagePosition.top, left: this.pagePosition.left });
236
- }
237
- if (this.boundarySashes) {
238
- editorPane.setBoundarySashes(this.boundarySashes);
239
- }
240
- return editorPane;
241
- }
242
- doCreateEditorPane(descriptor) {
243
- const editorPane = this.doInstantiateEditorPane(descriptor);
244
- if (!editorPane.getContainer()) {
245
- const editorPaneContainer = document.createElement('div');
246
- editorPaneContainer.classList.add('editor-instance');
247
- editorPane.create(editorPaneContainer);
248
- }
249
- return editorPane;
250
- }
251
- doInstantiateEditorPane(descriptor) {
252
- const existingEditorPane = this.editorPanes.find(editorPane => descriptor.describes(editorPane));
253
- if (existingEditorPane) {
254
- return existingEditorPane;
255
- }
256
- const editorPane = this._register(descriptor.instantiate(this.instantiationService));
257
- this.editorPanes.push(editorPane);
258
- return editorPane;
259
- }
260
- doSetActiveEditorPane(editorPane) {
261
- this._activeEditorPane = editorPane;
262
- this.activeEditorPaneDisposables.clear();
263
- if (editorPane) {
264
- this.activeEditorPaneDisposables.add(editorPane.onDidChangeSizeConstraints(e => this._onDidChangeSizeConstraints.fire(e)));
265
- this.activeEditorPaneDisposables.add(editorPane.onDidFocus(() => this._onDidFocus.fire()));
266
- }
267
- this._onDidChangeSizeConstraints.fire(undefined);
268
- }
269
- async doSetInput(editorPane, editor, options, context) {
270
- const inputMatches = editorPane.input?.matches(editor);
271
- if (inputMatches && !options?.forceReload) {
272
- editorPane.setOptions(options);
273
- return { changed: false, cancelled: false };
274
- }
275
- const operation = this.editorOperation.start(this.layoutService.isRestored() ? 800 : 3200);
276
- let cancelled = false;
277
- try {
278
- editorPane.clearInput();
279
- await editorPane.setInput(editor, options, context, operation.token);
280
- if (!operation.isCurrent()) {
281
- cancelled = true;
282
- }
283
- }
284
- catch (error) {
285
- if (!operation.isCurrent()) {
286
- cancelled = true;
287
- }
288
- else {
289
- throw error;
290
- }
291
- }
292
- finally {
293
- operation.stop();
294
- }
295
- return { changed: !inputMatches, cancelled };
296
- }
297
- doHideActiveEditorPane() {
298
- if (!this._activeEditorPane) {
299
- return;
300
- }
301
- this.editorOperation.stop();
302
- this.safeRun(() => this._activeEditorPane?.clearInput());
303
- this.safeRun(() => this._activeEditorPane?.setVisible(false, this.groupView));
304
- const editorPaneContainer = this._activeEditorPane.getContainer();
305
- if (editorPaneContainer) {
306
- this.editorPanesParent.removeChild(editorPaneContainer);
307
- hide(editorPaneContainer);
308
- }
309
- this.doSetActiveEditorPane(null);
310
- }
311
- closeEditor(editor) {
312
- if (this._activeEditorPane?.input && editor.matches(this._activeEditorPane.input)) {
313
- this.doHideActiveEditorPane();
314
- }
315
- }
316
- setVisible(visible) {
317
- this.safeRun(() => this._activeEditorPane?.setVisible(visible, this.groupView));
318
- }
319
- layout(pagePosition) {
320
- this.pagePosition = pagePosition;
321
- this.safeRun(() => this._activeEditorPane?.layout(( new Dimension(pagePosition.width, pagePosition.height)), pagePosition));
322
- }
323
- setBoundarySashes(sashes) {
324
- this.boundarySashes = sashes;
325
- this.safeRun(() => this._activeEditorPane?.setBoundarySashes(sashes));
326
- }
327
- safeRun(fn) {
328
- try {
329
- fn();
330
- }
331
- catch (error) {
332
- this.logService.error(error);
333
- }
334
- }
335
- };
336
- EditorPanes = ( __decorate([
337
- ( __param(3, IWorkbenchLayoutService)),
338
- ( __param(4, IInstantiationService)),
339
- ( __param(5, IEditorProgressService)),
340
- ( __param(6, IWorkspaceTrustManagementService)),
341
- ( __param(7, ILogService)),
342
- ( __param(8, IDialogService)),
343
- ( __param(9, IHostService))
344
- ], EditorPanes));
345
-
346
- export { EditorPanes };
@@ -1,154 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import './media/editortitlecontrol.css.js';
3
- import { clearNode, Dimension } from 'vscode/vscode/vs/base/browser/dom';
4
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
5
- import { Themable, IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
6
- import { BreadcrumbsControlFactory, BreadcrumbsControl } from './breadcrumbsControl.js';
7
- import { MultiEditorTabsControl } from './multiEditorTabsControl.js';
8
- import { SingleEditorTabsControl } from './singleEditorTabsControl.js';
9
- import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
10
- import { MultiRowEditorControl } from './multiRowEditorTabsControl.js';
11
- import { NoEditorTabsControl } from './noEditorTabsControl.js';
12
-
13
- let EditorTitleControl = class EditorTitleControl extends Themable {
14
- get breadcrumbsControl() { return this.breadcrumbsControlFactory?.control; }
15
- constructor(parent, editorPartsView, groupsView, groupView, model, instantiationService, themeService) {
16
- super(themeService);
17
- this.parent = parent;
18
- this.editorPartsView = editorPartsView;
19
- this.groupsView = groupsView;
20
- this.groupView = groupView;
21
- this.model = model;
22
- this.instantiationService = instantiationService;
23
- this.editorTabsControlDisposable = this._register(( new DisposableStore()));
24
- this.breadcrumbsControlDisposables = this._register(( new DisposableStore()));
25
- this.editorTabsControl = this.createEditorTabsControl();
26
- this.breadcrumbsControlFactory = this.createBreadcrumbsControl();
27
- }
28
- createEditorTabsControl() {
29
- let tabsControlType;
30
- switch (this.groupsView.partOptions.showTabs) {
31
- case 'none':
32
- tabsControlType = NoEditorTabsControl;
33
- break;
34
- case 'single':
35
- tabsControlType = SingleEditorTabsControl;
36
- break;
37
- case 'multiple':
38
- default:
39
- tabsControlType = this.groupsView.partOptions.pinnedTabsOnSeparateRow ? MultiRowEditorControl : MultiEditorTabsControl;
40
- break;
41
- }
42
- const control = this.instantiationService.createInstance(tabsControlType, this.parent, this.editorPartsView, this.groupsView, this.groupView, this.model);
43
- return this.editorTabsControlDisposable.add(control);
44
- }
45
- createBreadcrumbsControl() {
46
- if (this.groupsView.partOptions.showTabs === 'single') {
47
- return undefined;
48
- }
49
- const breadcrumbsContainer = document.createElement('div');
50
- breadcrumbsContainer.classList.add('breadcrumbs-below-tabs');
51
- this.parent.appendChild(breadcrumbsContainer);
52
- const breadcrumbsControlFactory = this.breadcrumbsControlDisposables.add(this.instantiationService.createInstance(BreadcrumbsControlFactory, breadcrumbsContainer, this.groupView, {
53
- showFileIcons: true,
54
- showSymbolIcons: true,
55
- showDecorationColors: false,
56
- showPlaceholder: true
57
- }));
58
- this.breadcrumbsControlDisposables.add(breadcrumbsControlFactory.onDidEnablementChange(() => this.groupView.relayout()));
59
- this.breadcrumbsControlDisposables.add(breadcrumbsControlFactory.onDidVisibilityChange(() => this.groupView.relayout()));
60
- return breadcrumbsControlFactory;
61
- }
62
- openEditor(editor, options) {
63
- const didChange = this.editorTabsControl.openEditor(editor, options);
64
- this.handleOpenedEditors(didChange);
65
- }
66
- openEditors(editors) {
67
- const didChange = this.editorTabsControl.openEditors(editors);
68
- this.handleOpenedEditors(didChange);
69
- }
70
- handleOpenedEditors(didChange) {
71
- if (didChange) {
72
- this.breadcrumbsControl?.update();
73
- }
74
- else {
75
- this.breadcrumbsControl?.revealLast();
76
- }
77
- }
78
- beforeCloseEditor(editor) {
79
- return this.editorTabsControl.beforeCloseEditor(editor);
80
- }
81
- closeEditor(editor) {
82
- this.editorTabsControl.closeEditor(editor);
83
- this.handleClosedEditors();
84
- }
85
- closeEditors(editors) {
86
- this.editorTabsControl.closeEditors(editors);
87
- this.handleClosedEditors();
88
- }
89
- handleClosedEditors() {
90
- if (!this.groupView.activeEditor) {
91
- this.breadcrumbsControl?.update();
92
- }
93
- }
94
- moveEditor(editor, fromIndex, targetIndex, stickyStateChange) {
95
- return this.editorTabsControl.moveEditor(editor, fromIndex, targetIndex, stickyStateChange);
96
- }
97
- pinEditor(editor) {
98
- return this.editorTabsControl.pinEditor(editor);
99
- }
100
- stickEditor(editor) {
101
- return this.editorTabsControl.stickEditor(editor);
102
- }
103
- unstickEditor(editor) {
104
- return this.editorTabsControl.unstickEditor(editor);
105
- }
106
- setActive(isActive) {
107
- return this.editorTabsControl.setActive(isActive);
108
- }
109
- updateEditorLabel(editor) {
110
- return this.editorTabsControl.updateEditorLabel(editor);
111
- }
112
- updateEditorDirty(editor) {
113
- return this.editorTabsControl.updateEditorDirty(editor);
114
- }
115
- updateOptions(oldOptions, newOptions) {
116
- if (oldOptions.showTabs !== newOptions.showTabs ||
117
- (newOptions.showTabs !== 'single' && oldOptions.pinnedTabsOnSeparateRow !== newOptions.pinnedTabsOnSeparateRow)) {
118
- this.editorTabsControlDisposable.clear();
119
- this.breadcrumbsControlDisposables.clear();
120
- clearNode(this.parent);
121
- this.editorTabsControl = this.createEditorTabsControl();
122
- this.breadcrumbsControlFactory = this.createBreadcrumbsControl();
123
- }
124
- else {
125
- this.editorTabsControl.updateOptions(oldOptions, newOptions);
126
- }
127
- }
128
- layout(dimensions) {
129
- const tabsControlDimension = this.editorTabsControl.layout(dimensions);
130
- let breadcrumbsControlDimension = undefined;
131
- if (this.breadcrumbsControl?.isHidden() === false) {
132
- breadcrumbsControlDimension = ( new Dimension(dimensions.container.width, BreadcrumbsControl.HEIGHT));
133
- this.breadcrumbsControl.layout(breadcrumbsControlDimension);
134
- }
135
- return ( new Dimension(
136
- dimensions.container.width,
137
- tabsControlDimension.height + (breadcrumbsControlDimension ? breadcrumbsControlDimension.height : 0)
138
- ));
139
- }
140
- getHeight() {
141
- const tabsControlHeight = this.editorTabsControl.getHeight();
142
- const breadcrumbsControlHeight = this.breadcrumbsControl?.isHidden() === false ? BreadcrumbsControl.HEIGHT : 0;
143
- return {
144
- total: tabsControlHeight + breadcrumbsControlHeight,
145
- offset: tabsControlHeight
146
- };
147
- }
148
- };
149
- EditorTitleControl = ( __decorate([
150
- ( __param(5, IInstantiationService)),
151
- ( __param(6, IThemeService))
152
- ], EditorTitleControl));
153
-
154
- export { EditorTitleControl };