@codingame/monaco-vscode-views-service-override 2.1.4 → 2.2.0-next.2

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 (107) hide show
  1. package/index.d.ts +11 -9
  2. package/index.js +8 -6
  3. package/package.json +11 -11
  4. package/tools/views.d.ts +102 -0
  5. package/tools/views.js +253 -0
  6. package/views.d.ts +4 -99
  7. package/views.js +52 -280
  8. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
  9. package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +0 -180
  10. package/vscode/src/vs/base/browser/ui/grid/grid.js +0 -494
  11. package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +0 -6
  12. package/vscode/src/vs/base/browser/ui/grid/gridview.js +0 -1112
  13. package/vscode/src/vs/base/common/codicons.d.ts +0 -579
  14. package/vscode/src/vs/platform/webview/common/mimeTypes.js +0 -24
  15. package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +0 -64
  16. package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +0 -790
  17. package/vscode/src/vs/workbench/browser/actions/listCommands.js +0 -764
  18. package/vscode/src/vs/workbench/browser/layout.d.ts +0 -26
  19. package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +0 -612
  20. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +0 -6
  21. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +0 -6
  22. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +0 -150
  23. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +0 -6
  24. package/vscode/src/vs/workbench/browser/parts/compositeBar.js +0 -605
  25. package/vscode/src/vs/workbench/browser/parts/compositePart.js +0 -335
  26. package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +0 -223
  27. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +0 -1407
  28. package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +0 -186
  29. package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +0 -511
  30. package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +0 -112
  31. package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +0 -1020
  32. package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +0 -391
  33. package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +0 -6
  34. package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +0 -6
  35. package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +0 -6
  36. package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +0 -645
  37. package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +0 -379
  38. package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +0 -68
  39. package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +0 -146
  40. package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +0 -6
  41. package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +0 -222
  42. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +0 -299
  43. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +0 -365
  44. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +0 -135
  45. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +0 -6
  46. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +0 -17
  47. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +0 -145
  48. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +0 -214
  49. package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +0 -6
  50. package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +0 -78
  51. package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +0 -63
  52. package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +0 -119
  53. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +0 -6
  54. package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +0 -79
  55. package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +0 -74
  56. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +0 -256
  57. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +0 -99
  58. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +0 -444
  59. package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +0 -432
  60. package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +0 -786
  61. package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +0 -488
  62. package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +0 -522
  63. package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +0 -152
  64. package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +0 -63
  65. package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +0 -409
  66. package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +0 -6
  67. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +0 -693
  68. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +0 -240
  69. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +0 -77
  70. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +0 -42
  71. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +0 -71
  72. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +0 -348
  73. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +0 -98
  74. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +0 -146
  75. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +0 -105
  76. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +0 -401
  77. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +0 -197
  78. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +0 -41
  79. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +0 -128
  80. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +0 -6
  81. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +0 -612
  82. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +0 -158
  83. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +0 -264
  84. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +0 -173
  85. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +0 -6
  86. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +0 -282
  87. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +0 -360
  88. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +0 -133
  89. package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +0 -290
  90. package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +0 -96
  91. package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +0 -88
  92. package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +0 -79
  93. package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +0 -648
  94. package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +0 -65
  95. package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +0 -59
  96. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +0 -142
  97. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +0 -121
  98. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +0 -68
  99. package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +0 -235
  100. package/vscode/src/vs/workbench/services/activity/browser/activityService.js +0 -145
  101. package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +0 -670
  102. package/vscode/src/vs/workbench/services/history/browser/historyService.js +0 -1484
  103. package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +0 -6
  104. package/vscode/src/vs/workbench/services/progress/browser/progressService.js +0 -523
  105. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +0 -101
  106. package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +0 -713
  107. package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +0 -598
@@ -1,256 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
- import { mark } from 'vscode/vscode/vs/base/common/performance';
4
- import { assertIsDefined } from 'vscode/vscode/vs/base/common/types';
5
- import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService';
6
- import { toAction } from 'vscode/vscode/vs/base/common/actions';
7
- import { TEXT_FILE_EDITOR_ID, VIEWLET_ID, BINARY_TEXT_FILE_MODE } from 'vscode/vscode/vs/workbench/contrib/files/common/files';
8
- import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles';
9
- import { AbstractTextCodeEditor } from 'vscode/vscode/vs/workbench/browser/parts/editor/textCodeEditor';
10
- import { isTextEditorViewState, createEditorOpenError, createTooLargeFileError, DEFAULT_EDITOR_ASSOCIATION } from 'vscode/vscode/vs/workbench/common/editor';
11
- import { applyTextEditorOptions } from 'vscode/vscode/vs/workbench/common/editor/editorOptions';
12
- import { BinaryEditorModel } from 'vscode/vscode/vs/workbench/common/editor/binaryEditorModel';
13
- import { FileEditorInput } from 'vscode/vscode/vs/workbench/contrib/files/browser/editors/fileEditorInput';
14
- import { TooLargeFileOperationError, ByteSize, FileOperationError, IFileService } from 'vscode/vscode/vs/platform/files/common/files';
15
- import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
16
- import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
17
- import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
18
- import { ITextResourceConfigurationService } from 'vscode/vscode/vs/editor/common/services/textResourceConfiguration';
19
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
20
- import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
21
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
22
- import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
23
- import { EditorActivation } from 'vscode/vscode/vs/platform/editor/common/editor';
24
- import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
25
- import { IExplorerService } from 'vscode/vscode/vs/workbench/contrib/files/browser/files';
26
- import { IPaneCompositePartService } from 'vscode/vscode/vs/workbench/services/panecomposite/browser/panecomposite';
27
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
28
- import { IPreferencesService } from 'vscode/vscode/vs/workbench/services/preferences/common/preferences';
29
- import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host';
30
- import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService';
31
-
32
- var TextFileEditor_1;
33
- let TextFileEditor = class TextFileEditor extends AbstractTextCodeEditor {
34
- static { TextFileEditor_1 = this; }
35
- static { this.ID = TEXT_FILE_EDITOR_ID; }
36
- constructor(telemetryService, fileService, paneCompositeService, instantiationService, contextService, storageService, textResourceConfigurationService, editorService, themeService, editorGroupService, textFileService, explorerService, uriIdentityService, pathService, configurationService, preferencesService, hostService, filesConfigurationService) {
37
- super(TextFileEditor_1.ID, telemetryService, instantiationService, storageService, textResourceConfigurationService, themeService, editorService, editorGroupService, fileService);
38
- this.paneCompositeService = paneCompositeService;
39
- this.contextService = contextService;
40
- this.textFileService = textFileService;
41
- this.explorerService = explorerService;
42
- this.uriIdentityService = uriIdentityService;
43
- this.pathService = pathService;
44
- this.configurationService = configurationService;
45
- this.preferencesService = preferencesService;
46
- this.hostService = hostService;
47
- this.filesConfigurationService = filesConfigurationService;
48
- this._register(this.fileService.onDidFilesChange(e => this.onDidFilesChange(e)));
49
- this._register(this.fileService.onDidRunOperation(e => this.onDidRunOperation(e)));
50
- }
51
- onDidFilesChange(e) {
52
- for (const resource of e.rawDeleted) {
53
- this.clearEditorViewState(resource);
54
- }
55
- }
56
- onDidRunOperation(e) {
57
- if (e.operation === 2 && e.target) {
58
- this.moveEditorViewState(e.resource, e.target.resource, this.uriIdentityService.extUri);
59
- }
60
- }
61
- getTitle() {
62
- if (this.input) {
63
- return this.input.getName();
64
- }
65
- return ( localizeWithPath(
66
- 'vs/workbench/contrib/files/browser/editors/textFileEditor',
67
- 'textFileEditor',
68
- "Text File Editor"
69
- ));
70
- }
71
- get input() {
72
- return this._input;
73
- }
74
- async setInput(input, options, context, token) {
75
- mark('code/willSetInputToTextFileEditor');
76
- await super.setInput(input, options, context, token);
77
- try {
78
- const resolvedModel = await input.resolve(options);
79
- if (token.isCancellationRequested) {
80
- return;
81
- }
82
- if (resolvedModel instanceof BinaryEditorModel) {
83
- return this.openAsBinary(input, options);
84
- }
85
- const textFileModel = resolvedModel;
86
- const control = assertIsDefined(this.editorControl);
87
- control.setModel(textFileModel.textEditorModel);
88
- if (!isTextEditorViewState(options?.viewState)) {
89
- const editorViewState = this.loadEditorViewState(input, context);
90
- if (editorViewState) {
91
- if (options?.selection) {
92
- editorViewState.cursorState = [];
93
- }
94
- control.restoreViewState(editorViewState);
95
- }
96
- }
97
- if (options) {
98
- applyTextEditorOptions(options, control, 1 );
99
- }
100
- control.updateOptions(this.getReadonlyConfiguration(textFileModel.isReadonly()));
101
- if (control.handleInitialized) {
102
- control.handleInitialized();
103
- }
104
- }
105
- catch (error) {
106
- await this.handleSetInputError(error, input, options);
107
- }
108
- mark('code/didSetInputToTextFileEditor');
109
- }
110
- async handleSetInputError(error, input, options) {
111
- if (error.textFileOperationResult === 0 ) {
112
- return this.openAsBinary(input, options);
113
- }
114
- if (error.fileOperationResult === 0 ) {
115
- const actions = [];
116
- actions.push(toAction({
117
- id: 'workbench.files.action.openFolder', label: ( localizeWithPath(
118
- 'vs/workbench/contrib/files/browser/editors/textFileEditor',
119
- 'openFolder',
120
- "Open Folder"
121
- )), run: async () => {
122
- return this.hostService.openWindow([{ folderUri: input.resource }], { forceNewWindow: true });
123
- }
124
- }));
125
- if (this.contextService.isInsideWorkspace(input.preferredResource)) {
126
- actions.push(toAction({
127
- id: 'workbench.files.action.reveal', label: ( localizeWithPath(
128
- 'vs/workbench/contrib/files/browser/editors/textFileEditor',
129
- 'reveal',
130
- "Reveal Folder"
131
- )), run: async () => {
132
- await this.paneCompositeService.openPaneComposite(VIEWLET_ID, 0 , true);
133
- return this.explorerService.select(input.preferredResource, true);
134
- }
135
- }));
136
- }
137
- throw createEditorOpenError(localizeWithPath('vs/workbench/contrib/files/browser/editors/textFileEditor', 'fileIsDirectory', "The file is not displayed in the text editor because it is a directory."), actions, { forceMessage: true });
138
- }
139
- if (error.fileOperationResult === 7 && this.group) {
140
- let message;
141
- if (error instanceof TooLargeFileOperationError) {
142
- message = ( localizeWithPath(
143
- 'vs/workbench/contrib/files/browser/editors/textFileEditor',
144
- 'fileTooLargeForHeapErrorWithSize',
145
- "The file is not displayed in the text editor because it is very large ({0}).",
146
- ByteSize.formatSize(error.size)
147
- ));
148
- }
149
- else {
150
- message = ( localizeWithPath(
151
- 'vs/workbench/contrib/files/browser/editors/textFileEditor',
152
- 'fileTooLargeForHeapErrorWithoutSize',
153
- "The file is not displayed in the text editor because it is very large."
154
- ));
155
- }
156
- throw createTooLargeFileError(this.group, input, options, message, this.preferencesService);
157
- }
158
- if (error.fileOperationResult === 1 &&
159
- !this.filesConfigurationService.isReadonly(input.preferredResource) &&
160
- (await this.pathService.hasValidBasename(input.preferredResource))) {
161
- const fileNotFoundError = createEditorOpenError(( new FileOperationError(( localizeWithPath(
162
- 'vs/workbench/contrib/files/browser/editors/textFileEditor',
163
- 'unavailableResourceErrorEditorText',
164
- "The editor could not be opened because the file was not found."
165
- )), 1 )), [
166
- toAction({
167
- id: 'workbench.files.action.createMissingFile', label: ( localizeWithPath(
168
- 'vs/workbench/contrib/files/browser/editors/textFileEditor',
169
- 'createFile',
170
- "Create File"
171
- )), run: async () => {
172
- await this.textFileService.create([{ resource: input.preferredResource }]);
173
- return this.editorService.openEditor({
174
- resource: input.preferredResource,
175
- options: {
176
- pinned: true
177
- }
178
- });
179
- }
180
- })
181
- ], {
182
- allowDialog: true
183
- });
184
- throw fileNotFoundError;
185
- }
186
- throw error;
187
- }
188
- openAsBinary(input, options) {
189
- const defaultBinaryEditor = this.configurationService.getValue('workbench.editor.defaultBinaryEditor');
190
- const group = this.group ?? this.editorGroupService.activeGroup;
191
- const editorOptions = {
192
- ...options,
193
- activation: EditorActivation.PRESERVE
194
- };
195
- if (defaultBinaryEditor && defaultBinaryEditor !== '' && defaultBinaryEditor !== DEFAULT_EDITOR_ASSOCIATION.id) {
196
- this.doOpenAsBinaryInDifferentEditor(group, defaultBinaryEditor, input, editorOptions);
197
- }
198
- else {
199
- this.doOpenAsBinaryInSameEditor(group, defaultBinaryEditor, input, editorOptions);
200
- }
201
- }
202
- doOpenAsBinaryInDifferentEditor(group, editorId, editor, editorOptions) {
203
- this.editorService.replaceEditors([{
204
- editor,
205
- replacement: { resource: editor.resource, options: { ...editorOptions, override: editorId } }
206
- }], group);
207
- }
208
- doOpenAsBinaryInSameEditor(group, editorId, editor, editorOptions) {
209
- if (editorId === DEFAULT_EDITOR_ASSOCIATION.id) {
210
- editor.setForceOpenAsText();
211
- editor.setPreferredLanguageId(BINARY_TEXT_FILE_MODE);
212
- editorOptions = { ...editorOptions, forceReload: true };
213
- }
214
- else {
215
- editor.setForceOpenAsBinary();
216
- }
217
- group.openEditor(editor, editorOptions);
218
- }
219
- clearInput() {
220
- super.clearInput();
221
- this.editorControl?.setModel(null);
222
- }
223
- createEditorControl(parent, initialOptions) {
224
- mark('code/willCreateTextFileEditorControl');
225
- super.createEditorControl(parent, initialOptions);
226
- mark('code/didCreateTextFileEditorControl');
227
- }
228
- tracksEditorViewState(input) {
229
- return input instanceof FileEditorInput;
230
- }
231
- tracksDisposedEditorViewState() {
232
- return true;
233
- }
234
- };
235
- TextFileEditor = TextFileEditor_1 = ( __decorate([
236
- ( __param(0, ITelemetryService)),
237
- ( __param(1, IFileService)),
238
- ( __param(2, IPaneCompositePartService)),
239
- ( __param(3, IInstantiationService)),
240
- ( __param(4, IWorkspaceContextService)),
241
- ( __param(5, IStorageService)),
242
- ( __param(6, ITextResourceConfigurationService)),
243
- ( __param(7, IEditorService)),
244
- ( __param(8, IThemeService)),
245
- ( __param(9, IEditorGroupsService)),
246
- ( __param(10, ITextFileService)),
247
- ( __param(11, IExplorerService)),
248
- ( __param(12, IUriIdentityService)),
249
- ( __param(13, IPathService)),
250
- ( __param(14, IConfigurationService)),
251
- ( __param(15, IPreferencesService)),
252
- ( __param(16, IHostService)),
253
- ( __param(17, IFilesConfigurationService))
254
- ], TextFileEditor));
255
-
256
- export { TextFileEditor };
@@ -1,99 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
- import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles';
3
- import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
4
- import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
5
- import { distinct, coalesce } from 'vscode/vscode/vs/base/common/arrays';
6
- import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host';
7
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
8
- import { RunOnceWorker } from 'vscode/vscode/vs/base/common/async';
9
- import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
10
- import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService';
11
- import { FILE_EDITOR_INPUT_ID } from 'vscode/vscode/vs/workbench/contrib/files/common/files';
12
- import { Schemas } from 'vscode/vscode/vs/base/common/network';
13
- import { UntitledTextEditorInput } from 'vscode/vscode/vs/workbench/services/untitled/common/untitledTextEditorInput';
14
- import { IWorkingCopyEditorService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyEditorService';
15
- import { DEFAULT_EDITOR_ASSOCIATION } from 'vscode/vscode/vs/workbench/common/editor';
16
-
17
- let TextFileEditorTracker = class TextFileEditorTracker extends Disposable {
18
- constructor(editorService, textFileService, lifecycleService, hostService, codeEditorService, filesConfigurationService, workingCopyEditorService) {
19
- super();
20
- this.editorService = editorService;
21
- this.textFileService = textFileService;
22
- this.lifecycleService = lifecycleService;
23
- this.hostService = hostService;
24
- this.codeEditorService = codeEditorService;
25
- this.filesConfigurationService = filesConfigurationService;
26
- this.workingCopyEditorService = workingCopyEditorService;
27
- this.ensureDirtyFilesAreOpenedWorker = this._register(( new RunOnceWorker(
28
- units => this.ensureDirtyTextFilesAreOpened(units),
29
- this.getDirtyTextFileTrackerDelay()
30
- )));
31
- this.registerListeners();
32
- }
33
- registerListeners() {
34
- this._register(this.textFileService.files.onDidChangeDirty(model => this.ensureDirtyFilesAreOpenedWorker.work(model.resource)));
35
- this._register(this.textFileService.files.onDidSaveError(model => this.ensureDirtyFilesAreOpenedWorker.work(model.resource)));
36
- this._register(this.textFileService.untitled.onDidChangeDirty(model => this.ensureDirtyFilesAreOpenedWorker.work(model.resource)));
37
- this._register(this.hostService.onDidChangeFocus(hasFocus => hasFocus ? this.reloadVisibleTextFileEditors() : undefined));
38
- this._register(this.lifecycleService.onDidShutdown(() => this.dispose()));
39
- }
40
- getDirtyTextFileTrackerDelay() {
41
- return 800;
42
- }
43
- ensureDirtyTextFilesAreOpened(resources) {
44
- this.doEnsureDirtyTextFilesAreOpened(distinct(resources.filter(resource => {
45
- if (!this.textFileService.isDirty(resource)) {
46
- return false;
47
- }
48
- const fileModel = this.textFileService.files.get(resource);
49
- if (fileModel?.hasState(2 )) {
50
- return false;
51
- }
52
- if (resource.scheme !== Schemas.untitled && !fileModel?.hasState(5 ) && this.filesConfigurationService.hasShortAutoSaveDelay(resource)) {
53
- return false;
54
- }
55
- if (this.editorService.isOpened({ resource, typeId: resource.scheme === Schemas.untitled ? UntitledTextEditorInput.ID : FILE_EDITOR_INPUT_ID, editorId: DEFAULT_EDITOR_ASSOCIATION.id })) {
56
- return false;
57
- }
58
- const model = fileModel ?? this.textFileService.untitled.get(resource);
59
- if (model && this.workingCopyEditorService.findEditor(model)) {
60
- return false;
61
- }
62
- return true;
63
- }), resource => ( resource.toString())));
64
- }
65
- doEnsureDirtyTextFilesAreOpened(resources) {
66
- if (!resources.length) {
67
- return;
68
- }
69
- this.editorService.openEditors(( resources.map(resource => ({
70
- resource,
71
- options: { inactive: true, pinned: true, preserveFocus: true }
72
- }))));
73
- }
74
- reloadVisibleTextFileEditors() {
75
- distinct(coalesce(( this.codeEditorService.listCodeEditors()
76
- .map(codeEditor => {
77
- const resource = codeEditor.getModel()?.uri;
78
- if (!resource) {
79
- return undefined;
80
- }
81
- const model = this.textFileService.files.get(resource);
82
- if (!model || model.isDirty() || !model.isResolved()) {
83
- return undefined;
84
- }
85
- return model;
86
- }))), model => ( model.resource.toString())).forEach(model => this.textFileService.files.resolve(model.resource, { reload: { async: true } }));
87
- }
88
- };
89
- TextFileEditorTracker = ( __decorate([
90
- ( __param(0, IEditorService)),
91
- ( __param(1, ITextFileService)),
92
- ( __param(2, ILifecycleService)),
93
- ( __param(3, IHostService)),
94
- ( __param(4, ICodeEditorService)),
95
- ( __param(5, IFilesConfigurationService)),
96
- ( __param(6, IWorkingCopyEditorService))
97
- ], TextFileEditorTracker));
98
-
99
- export { TextFileEditorTracker };