@codingame/monaco-vscode-views-service-override 2.1.3 → 2.2.0-next.1

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 (108) hide show
  1. package/index.d.ts +11 -9
  2. package/index.js +8 -6
  3. package/package.json +11 -11
  4. package/tools/editor.js +3 -1
  5. package/tools/views.d.ts +102 -0
  6. package/tools/views.js +253 -0
  7. package/views.d.ts +4 -99
  8. package/views.js +52 -280
  9. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
  10. package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +0 -180
  11. package/vscode/src/vs/base/browser/ui/grid/grid.js +0 -494
  12. package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +0 -6
  13. package/vscode/src/vs/base/browser/ui/grid/gridview.js +0 -1112
  14. package/vscode/src/vs/base/common/codicons.d.ts +0 -579
  15. package/vscode/src/vs/platform/webview/common/mimeTypes.js +0 -24
  16. package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +0 -64
  17. package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +0 -790
  18. package/vscode/src/vs/workbench/browser/actions/listCommands.js +0 -764
  19. package/vscode/src/vs/workbench/browser/layout.d.ts +0 -26
  20. package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +0 -612
  21. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +0 -6
  22. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +0 -6
  23. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +0 -150
  24. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +0 -6
  25. package/vscode/src/vs/workbench/browser/parts/compositeBar.js +0 -605
  26. package/vscode/src/vs/workbench/browser/parts/compositePart.js +0 -335
  27. package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +0 -223
  28. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +0 -1407
  29. package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +0 -186
  30. package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +0 -511
  31. package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +0 -112
  32. package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +0 -1020
  33. package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +0 -391
  34. package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +0 -6
  35. package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +0 -6
  36. package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +0 -6
  37. package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +0 -645
  38. package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +0 -379
  39. package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +0 -68
  40. package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +0 -146
  41. package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +0 -6
  42. package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +0 -222
  43. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +0 -299
  44. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +0 -365
  45. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +0 -135
  46. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +0 -6
  47. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +0 -17
  48. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +0 -145
  49. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +0 -214
  50. package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +0 -6
  51. package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +0 -78
  52. package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +0 -63
  53. package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +0 -119
  54. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +0 -6
  55. package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +0 -79
  56. package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +0 -74
  57. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +0 -256
  58. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +0 -99
  59. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +0 -444
  60. package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +0 -432
  61. package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +0 -786
  62. package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +0 -488
  63. package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +0 -522
  64. package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +0 -152
  65. package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +0 -63
  66. package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +0 -409
  67. package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +0 -6
  68. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +0 -693
  69. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +0 -240
  70. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +0 -77
  71. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +0 -42
  72. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +0 -71
  73. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +0 -348
  74. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +0 -98
  75. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +0 -146
  76. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +0 -105
  77. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +0 -401
  78. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +0 -197
  79. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +0 -41
  80. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +0 -128
  81. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +0 -6
  82. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +0 -612
  83. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +0 -158
  84. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +0 -264
  85. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +0 -173
  86. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +0 -6
  87. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +0 -282
  88. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +0 -360
  89. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +0 -133
  90. package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +0 -290
  91. package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +0 -96
  92. package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +0 -88
  93. package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +0 -79
  94. package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +0 -648
  95. package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +0 -65
  96. package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +0 -59
  97. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +0 -142
  98. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +0 -121
  99. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +0 -68
  100. package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +0 -235
  101. package/vscode/src/vs/workbench/services/activity/browser/activityService.js +0 -145
  102. package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +0 -670
  103. package/vscode/src/vs/workbench/services/history/browser/historyService.js +0 -1484
  104. package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +0 -6
  105. package/vscode/src/vs/workbench/services/progress/browser/progressService.js +0 -523
  106. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +0 -101
  107. package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +0 -713
  108. package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +0 -598
@@ -1,444 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
- import { toErrorMessage } from 'vscode/vscode/vs/base/common/errorMessage';
4
- import { isEqual, basename } from 'vscode/vscode/vs/base/common/resources';
5
- import { Action } from 'vscode/vscode/vs/base/common/actions';
6
- import { URI } from 'vscode/vscode/vs/base/common/uri';
7
- import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles';
8
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
9
- import { Disposable, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
10
- import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
11
- import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
12
- import { DiffEditorInput } from 'vscode/vscode/vs/workbench/common/editor/diffEditorInput';
13
- import { RawContextKey, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
14
- import { TextFileContentProvider } from 'vscode/vscode/vs/workbench/contrib/files/common/files';
15
- import { FileEditorInput } from 'vscode/vscode/vs/workbench/contrib/files/browser/editors/fileEditorInput';
16
- import { SAVE_FILE_AS_LABEL } from 'vscode/vscode/vs/workbench/contrib/files/browser/fileConstants';
17
- import { Severity, INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
18
- import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
19
- import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
20
- import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
21
- import { Event } from 'vscode/vscode/vs/base/common/event';
22
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
23
- import { isWindows } from 'vscode/vscode/vs/base/common/platform';
24
- import { Schemas } from 'vscode/vscode/vs/base/common/network';
25
- import { IPreferencesService } from 'vscode/vscode/vs/workbench/services/preferences/common/preferences';
26
- import { SideBySideEditor } from 'vscode/vscode/vs/workbench/common/editor';
27
- import { hash } from 'vscode/vscode/vs/base/common/hash';
28
-
29
- const CONFLICT_RESOLUTION_CONTEXT = 'saveConflictResolutionContext';
30
- const CONFLICT_RESOLUTION_SCHEME = 'conflictResolution';
31
- const LEARN_MORE_DIRTY_WRITE_IGNORE_KEY = 'learnMoreDirtyWriteError';
32
- const conflictEditorHelp = ( localizeWithPath(
33
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
34
- 'userGuide',
35
- "Use the actions in the editor tool bar to either undo your changes or overwrite the content of the file with your changes."
36
- ));
37
- let TextFileSaveErrorHandler = class TextFileSaveErrorHandler extends Disposable {
38
- constructor(notificationService, textFileService, contextKeyService, editorService, textModelService, instantiationService, storageService) {
39
- super();
40
- this.notificationService = notificationService;
41
- this.textFileService = textFileService;
42
- this.contextKeyService = contextKeyService;
43
- this.editorService = editorService;
44
- this.instantiationService = instantiationService;
45
- this.storageService = storageService;
46
- this.messages = ( new ResourceMap());
47
- this.conflictResolutionContext = ( new RawContextKey(CONFLICT_RESOLUTION_CONTEXT, false, true)).bindTo(this.contextKeyService);
48
- this.activeConflictResolutionResource = undefined;
49
- const provider = this._register(instantiationService.createInstance(TextFileContentProvider));
50
- this._register(textModelService.registerTextModelContentProvider(CONFLICT_RESOLUTION_SCHEME, provider));
51
- this.textFileService.files.saveErrorHandler = this;
52
- this.registerListeners();
53
- }
54
- registerListeners() {
55
- this._register(this.textFileService.files.onDidSave(e => this.onFileSavedOrReverted(e.model.resource)));
56
- this._register(this.textFileService.files.onDidRevert(model => this.onFileSavedOrReverted(model.resource)));
57
- this._register(this.editorService.onDidActiveEditorChange(() => this.onActiveEditorChanged()));
58
- }
59
- onActiveEditorChanged() {
60
- let isActiveEditorSaveConflictResolution = false;
61
- let activeConflictResolutionResource;
62
- const activeInput = this.editorService.activeEditor;
63
- if (activeInput instanceof DiffEditorInput) {
64
- const resource = activeInput.original.resource;
65
- if (resource?.scheme === CONFLICT_RESOLUTION_SCHEME) {
66
- isActiveEditorSaveConflictResolution = true;
67
- activeConflictResolutionResource = activeInput.modified.resource;
68
- }
69
- }
70
- this.conflictResolutionContext.set(isActiveEditorSaveConflictResolution);
71
- this.activeConflictResolutionResource = activeConflictResolutionResource;
72
- }
73
- onFileSavedOrReverted(resource) {
74
- const messageHandle = this.messages.get(resource);
75
- if (messageHandle) {
76
- messageHandle.close();
77
- this.messages.delete(resource);
78
- }
79
- }
80
- onSaveError(error, model) {
81
- const fileOperationError = error;
82
- const resource = model.resource;
83
- let message;
84
- const primaryActions = [];
85
- const secondaryActions = [];
86
- if (fileOperationError.fileOperationResult === 3 ) {
87
- if (this.activeConflictResolutionResource && isEqual(this.activeConflictResolutionResource, model.resource)) {
88
- if (this.storageService.getBoolean(LEARN_MORE_DIRTY_WRITE_IGNORE_KEY, -1 )) {
89
- return;
90
- }
91
- message = conflictEditorHelp;
92
- primaryActions.push(this.instantiationService.createInstance(ResolveConflictLearnMoreAction));
93
- secondaryActions.push(this.instantiationService.createInstance(DoNotShowResolveConflictLearnMoreAction));
94
- }
95
- else {
96
- message = ( localizeWithPath(
97
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
98
- 'staleSaveError',
99
- "Failed to save '{0}': The content of the file is newer. Please compare your version with the file contents or overwrite the content of the file with your changes.",
100
- basename(resource)
101
- ));
102
- primaryActions.push(this.instantiationService.createInstance(ResolveSaveConflictAction, model));
103
- primaryActions.push(this.instantiationService.createInstance(SaveModelIgnoreModifiedSinceAction, model));
104
- secondaryActions.push(this.instantiationService.createInstance(ConfigureSaveConflictAction));
105
- }
106
- }
107
- else {
108
- const isWriteLocked = fileOperationError.fileOperationResult === 5 ;
109
- const triedToUnlock = isWriteLocked && fileOperationError.options?.unlock;
110
- const isPermissionDenied = fileOperationError.fileOperationResult === 6 ;
111
- const canSaveElevated = resource.scheme === Schemas.file;
112
- if (canSaveElevated && (isPermissionDenied || triedToUnlock)) {
113
- primaryActions.push(this.instantiationService.createInstance(SaveModelElevatedAction, model, !!triedToUnlock));
114
- }
115
- else if (isWriteLocked) {
116
- primaryActions.push(this.instantiationService.createInstance(UnlockModelAction, model));
117
- }
118
- else {
119
- primaryActions.push(this.instantiationService.createInstance(RetrySaveModelAction, model));
120
- }
121
- primaryActions.push(this.instantiationService.createInstance(SaveModelAsAction, model));
122
- primaryActions.push(this.instantiationService.createInstance(DiscardModelAction, model));
123
- if (isWriteLocked) {
124
- if (triedToUnlock && canSaveElevated) {
125
- message = isWindows ? ( localizeWithPath(
126
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
127
- 'readonlySaveErrorAdmin',
128
- "Failed to save '{0}': File is read-only. Select 'Overwrite as Admin' to retry as administrator.",
129
- basename(resource)
130
- )) : ( localizeWithPath(
131
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
132
- 'readonlySaveErrorSudo',
133
- "Failed to save '{0}': File is read-only. Select 'Overwrite as Sudo' to retry as superuser.",
134
- basename(resource)
135
- ));
136
- }
137
- else {
138
- message = ( localizeWithPath(
139
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
140
- 'readonlySaveError',
141
- "Failed to save '{0}': File is read-only. Select 'Overwrite' to attempt to make it writeable.",
142
- basename(resource)
143
- ));
144
- }
145
- }
146
- else if (canSaveElevated && isPermissionDenied) {
147
- message = isWindows ? ( localizeWithPath(
148
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
149
- 'permissionDeniedSaveError',
150
- "Failed to save '{0}': Insufficient permissions. Select 'Retry as Admin' to retry as administrator.",
151
- basename(resource)
152
- )) : ( localizeWithPath(
153
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
154
- 'permissionDeniedSaveErrorSudo',
155
- "Failed to save '{0}': Insufficient permissions. Select 'Retry as Sudo' to retry as superuser.",
156
- basename(resource)
157
- ));
158
- }
159
- else {
160
- message = ( localizeWithPath(
161
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
162
- { key: 'genericSaveError', comment: ['{0} is the resource that failed to save and {1} the error message'] },
163
- "Failed to save '{0}': {1}",
164
- basename(resource),
165
- toErrorMessage(error, false)
166
- ));
167
- }
168
- }
169
- const actions = { primary: primaryActions, secondary: secondaryActions };
170
- const handle = this.notificationService.notify({
171
- id: `${hash(( model.resource.toString()))}`,
172
- severity: Severity.Error,
173
- message,
174
- actions
175
- });
176
- Event.once(handle.onDidClose)(() => { dispose(primaryActions); dispose(secondaryActions); });
177
- this.messages.set(model.resource, handle);
178
- }
179
- dispose() {
180
- super.dispose();
181
- this.messages.clear();
182
- }
183
- };
184
- TextFileSaveErrorHandler = ( __decorate([
185
- ( __param(0, INotificationService)),
186
- ( __param(1, ITextFileService)),
187
- ( __param(2, IContextKeyService)),
188
- ( __param(3, IEditorService)),
189
- ( __param(4, ITextModelService)),
190
- ( __param(5, IInstantiationService)),
191
- ( __param(6, IStorageService))
192
- ], TextFileSaveErrorHandler));
193
- const pendingResolveSaveConflictMessages = [];
194
- function clearPendingResolveSaveConflictMessages() {
195
- while (pendingResolveSaveConflictMessages.length > 0) {
196
- const item = pendingResolveSaveConflictMessages.pop();
197
- item?.close();
198
- }
199
- }
200
- let ResolveConflictLearnMoreAction = class ResolveConflictLearnMoreAction extends Action {
201
- constructor(openerService) {
202
- super('workbench.files.action.resolveConflictLearnMore', ( localizeWithPath(
203
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
204
- 'learnMore',
205
- "Learn More"
206
- )));
207
- this.openerService = openerService;
208
- }
209
- async run() {
210
- await this.openerService.open(( URI.parse('https://go.microsoft.com/fwlink/?linkid=868264')));
211
- }
212
- };
213
- ResolveConflictLearnMoreAction = ( __decorate([
214
- ( __param(0, IOpenerService))
215
- ], ResolveConflictLearnMoreAction));
216
- let DoNotShowResolveConflictLearnMoreAction = class DoNotShowResolveConflictLearnMoreAction extends Action {
217
- constructor(storageService) {
218
- super('workbench.files.action.resolveConflictLearnMoreDoNotShowAgain', ( localizeWithPath(
219
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
220
- 'dontShowAgain',
221
- "Don't Show Again"
222
- )));
223
- this.storageService = storageService;
224
- }
225
- async run(notification) {
226
- this.storageService.store(LEARN_MORE_DIRTY_WRITE_IGNORE_KEY, true, -1 , 0 );
227
- notification.dispose();
228
- }
229
- };
230
- DoNotShowResolveConflictLearnMoreAction = ( __decorate([
231
- ( __param(0, IStorageService))
232
- ], DoNotShowResolveConflictLearnMoreAction));
233
- let ResolveSaveConflictAction = class ResolveSaveConflictAction extends Action {
234
- constructor(model, editorService, notificationService, instantiationService, productService) {
235
- super('workbench.files.action.resolveConflict', ( localizeWithPath(
236
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
237
- 'compareChanges',
238
- "Compare"
239
- )));
240
- this.model = model;
241
- this.editorService = editorService;
242
- this.notificationService = notificationService;
243
- this.instantiationService = instantiationService;
244
- this.productService = productService;
245
- }
246
- async run() {
247
- if (!this.model.isDisposed()) {
248
- const resource = this.model.resource;
249
- const name = basename(resource);
250
- const editorLabel = ( localizeWithPath(
251
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
252
- 'saveConflictDiffLabel',
253
- "{0} (in file) ↔ {1} (in {2}) - Resolve save conflict",
254
- name,
255
- name,
256
- this.productService.nameLong
257
- ));
258
- await TextFileContentProvider.open(resource, CONFLICT_RESOLUTION_SCHEME, editorLabel, this.editorService, { pinned: true });
259
- const actions = { primary: [this.instantiationService.createInstance(ResolveConflictLearnMoreAction)] };
260
- const handle = this.notificationService.notify({
261
- id: `${hash(( resource.toString()))}`,
262
- severity: Severity.Info,
263
- message: conflictEditorHelp,
264
- actions,
265
- neverShowAgain: { id: LEARN_MORE_DIRTY_WRITE_IGNORE_KEY, isSecondary: true }
266
- });
267
- Event.once(handle.onDidClose)(() => dispose(actions.primary));
268
- pendingResolveSaveConflictMessages.push(handle);
269
- }
270
- }
271
- };
272
- ResolveSaveConflictAction = ( __decorate([
273
- ( __param(1, IEditorService)),
274
- ( __param(2, INotificationService)),
275
- ( __param(3, IInstantiationService)),
276
- ( __param(4, IProductService))
277
- ], ResolveSaveConflictAction));
278
- class SaveModelElevatedAction extends Action {
279
- constructor(model, triedToUnlock) {
280
- super('workbench.files.action.saveModelElevated', triedToUnlock ? isWindows ? ( localizeWithPath(
281
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
282
- 'overwriteElevated',
283
- "Overwrite as Admin..."
284
- )) : ( localizeWithPath(
285
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
286
- 'overwriteElevatedSudo',
287
- "Overwrite as Sudo..."
288
- )) : isWindows ? ( localizeWithPath(
289
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
290
- 'saveElevated',
291
- "Retry as Admin..."
292
- )) : ( localizeWithPath(
293
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
294
- 'saveElevatedSudo',
295
- "Retry as Sudo..."
296
- )));
297
- this.model = model;
298
- this.triedToUnlock = triedToUnlock;
299
- }
300
- async run() {
301
- if (!this.model.isDisposed()) {
302
- await this.model.save({
303
- writeElevated: true,
304
- writeUnlock: this.triedToUnlock,
305
- reason: 1
306
- });
307
- }
308
- }
309
- }
310
- class RetrySaveModelAction extends Action {
311
- constructor(model) {
312
- super('workbench.files.action.saveModel', ( localizeWithPath(
313
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
314
- 'retry',
315
- "Retry"
316
- )));
317
- this.model = model;
318
- }
319
- async run() {
320
- if (!this.model.isDisposed()) {
321
- await this.model.save({ reason: 1 });
322
- }
323
- }
324
- }
325
- class DiscardModelAction extends Action {
326
- constructor(model) {
327
- super('workbench.files.action.discardModel', ( localizeWithPath(
328
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
329
- 'discard',
330
- "Discard"
331
- )));
332
- this.model = model;
333
- }
334
- async run() {
335
- if (!this.model.isDisposed()) {
336
- await this.model.revert();
337
- }
338
- }
339
- }
340
- let SaveModelAsAction = class SaveModelAsAction extends Action {
341
- constructor(model, editorService) {
342
- super('workbench.files.action.saveModelAs', SAVE_FILE_AS_LABEL);
343
- this.model = model;
344
- this.editorService = editorService;
345
- }
346
- async run() {
347
- if (!this.model.isDisposed()) {
348
- const editor = this.findEditor();
349
- if (editor) {
350
- await this.editorService.save(editor, { saveAs: true, reason: 1 });
351
- }
352
- }
353
- }
354
- findEditor() {
355
- let preferredMatchingEditor;
356
- const editors = this.editorService.findEditors(this.model.resource, { supportSideBySide: SideBySideEditor.PRIMARY });
357
- for (const identifier of editors) {
358
- if (identifier.editor instanceof FileEditorInput) {
359
- preferredMatchingEditor = identifier;
360
- break;
361
- }
362
- else if (!preferredMatchingEditor) {
363
- preferredMatchingEditor = identifier;
364
- }
365
- }
366
- return preferredMatchingEditor;
367
- }
368
- };
369
- SaveModelAsAction = ( __decorate([
370
- ( __param(1, IEditorService))
371
- ], SaveModelAsAction));
372
- class UnlockModelAction extends Action {
373
- constructor(model) {
374
- super('workbench.files.action.unlock', ( localizeWithPath(
375
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
376
- 'overwrite',
377
- "Overwrite"
378
- )));
379
- this.model = model;
380
- }
381
- async run() {
382
- if (!this.model.isDisposed()) {
383
- await this.model.save({ writeUnlock: true, reason: 1 });
384
- }
385
- }
386
- }
387
- class SaveModelIgnoreModifiedSinceAction extends Action {
388
- constructor(model) {
389
- super('workbench.files.action.saveIgnoreModifiedSince', ( localizeWithPath(
390
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
391
- 'overwrite',
392
- "Overwrite"
393
- )));
394
- this.model = model;
395
- }
396
- async run() {
397
- if (!this.model.isDisposed()) {
398
- await this.model.save({ ignoreModifiedSince: true, reason: 1 });
399
- }
400
- }
401
- }
402
- let ConfigureSaveConflictAction = class ConfigureSaveConflictAction extends Action {
403
- constructor(preferencesService) {
404
- super('workbench.files.action.configureSaveConflict', ( localizeWithPath(
405
- 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler',
406
- 'configure',
407
- "Configure"
408
- )));
409
- this.preferencesService = preferencesService;
410
- }
411
- async run() {
412
- this.preferencesService.openSettings({ query: 'files.saveConflictResolution' });
413
- }
414
- };
415
- ConfigureSaveConflictAction = ( __decorate([
416
- ( __param(0, IPreferencesService))
417
- ], ConfigureSaveConflictAction));
418
- const acceptLocalChangesCommand = (accessor, resource) => {
419
- return acceptOrRevertLocalChangesCommand(accessor, resource, true);
420
- };
421
- const revertLocalChangesCommand = (accessor, resource) => {
422
- return acceptOrRevertLocalChangesCommand(accessor, resource, false);
423
- };
424
- async function acceptOrRevertLocalChangesCommand(accessor, resource, accept) {
425
- const editorService = accessor.get(IEditorService);
426
- const editorPane = editorService.activeEditorPane;
427
- if (!editorPane) {
428
- return;
429
- }
430
- const editor = editorPane.input;
431
- const group = editorPane.group;
432
- clearPendingResolveSaveConflictMessages();
433
- if (accept) {
434
- const options = { ignoreModifiedSince: true, reason: 1 };
435
- await editorService.save({ editor, groupId: group.id }, options);
436
- }
437
- else {
438
- await editorService.revert({ editor, groupId: group.id });
439
- }
440
- await editorService.openEditor({ resource }, group);
441
- return group.closeEditor(editor);
442
- }
443
-
444
- export { CONFLICT_RESOLUTION_CONTEXT, CONFLICT_RESOLUTION_SCHEME, TextFileSaveErrorHandler, acceptLocalChangesCommand, revertLocalChangesCommand };