@codingame/monaco-vscode-notebook-service-override 4.1.0 → 4.1.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 (77) hide show
  1. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
  2. package/external/tslib/tslib.es6.js +11 -0
  3. package/notebook.js +12 -12
  4. package/override/vs/platform/dialogs/common/dialogs.js +10 -0
  5. package/package.json +2 -2
  6. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +6 -0
  7. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +391 -0
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +109 -0
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +173 -0
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +544 -0
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +106 -0
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +67 -0
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +165 -0
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +67 -0
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +320 -0
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +72 -0
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +6 -0
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +168 -0
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +209 -0
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +84 -0
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +82 -0
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +67 -0
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +101 -0
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +393 -0
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +5 -0
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +97 -0
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +120 -0
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +60 -0
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +150 -0
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +656 -0
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +77 -0
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +517 -0
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +159 -0
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +56 -0
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +94 -0
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +51 -0
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +652 -0
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +721 -0
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +351 -0
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +315 -0
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +199 -0
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +47 -0
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1297 -0
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +284 -0
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +563 -0
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +115 -0
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +39 -0
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +6 -0
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +313 -0
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +911 -0
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +13 -0
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +395 -0
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +185 -0
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +1187 -0
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +159 -0
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +451 -0
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +192 -0
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +106 -0
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +510 -0
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +130 -0
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +341 -0
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +111 -0
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +28 -0
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +65 -0
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +641 -0
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +200 -0
  67. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +90 -0
  68. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +1002 -0
  69. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +103 -0
  70. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +203 -0
  71. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +80 -0
  72. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +98 -0
  73. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +89 -0
  74. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +386 -0
  75. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +408 -0
  76. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +144 -0
  77. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +129 -0
@@ -0,0 +1,386 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
+ import { Event, Emitter } from 'vscode/vscode/vs/base/common/event';
4
+ import { Promises } from 'vscode/vscode/vs/base/common/async';
5
+ import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
6
+ import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
7
+ import { isEqual, toLocalResource, basename, dirname, joinPath } from 'vscode/vscode/vs/base/common/resources';
8
+ import { URI } from 'vscode/vscode/vs/base/common/uri';
9
+ import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
10
+ import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
11
+ import { SaveSourceRegistry } from 'vscode/vscode/vs/workbench/common/editor';
12
+ import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
13
+ import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService';
14
+ import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
15
+ import { StoredFileWorkingCopyManager } from './storedFileWorkingCopyManager.js';
16
+ import { UntitledFileWorkingCopy } from './untitledFileWorkingCopy.js';
17
+ import { UntitledFileWorkingCopyManager } from './untitledFileWorkingCopyManager.js';
18
+ import { IWorkingCopyFileService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService';
19
+ import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
20
+ import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
21
+ import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
22
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
23
+ import { IElevatedFileService } from 'vscode/vscode/vs/workbench/services/files/common/elevatedFileService';
24
+ import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService';
25
+ import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
26
+ import { IWorkingCopyBackupService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyBackup';
27
+ import { IWorkingCopyEditorService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyEditorService';
28
+ import { IWorkingCopyService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService';
29
+ import { Schemas } from 'vscode/vscode/vs/base/common/network';
30
+ import { IDecorationsService } from 'vscode/vscode/vs/workbench/services/decorations/common/decorations';
31
+ import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
32
+ import 'vscode/vscode/vs/platform/theme/common/colorUtils';
33
+ import 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
34
+ import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
35
+ import 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
36
+ import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
37
+ import { listErrorForeground } from 'vscode/vscode/vs/platform/theme/common/colors/listColors';
38
+ import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
39
+ import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
40
+ import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
41
+ import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
42
+ import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
43
+ import { IFileDialogService, IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
44
+
45
+ var FileWorkingCopyManager_1;
46
+ let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
47
+ static { FileWorkingCopyManager_1 = this; }
48
+ static { this.FILE_WORKING_COPY_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource('fileWorkingCopyCreate.source', ( localizeWithPath(
49
+ 'vs/workbench/services/workingCopy/common/fileWorkingCopyManager',
50
+ 'fileWorkingCopyCreate.source',
51
+ "File Created"
52
+ ))); }
53
+ static { this.FILE_WORKING_COPY_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource('fileWorkingCopyReplace.source', ( localizeWithPath(
54
+ 'vs/workbench/services/workingCopy/common/fileWorkingCopyManager',
55
+ 'fileWorkingCopyReplace.source',
56
+ "File Replaced"
57
+ ))); }
58
+ constructor(workingCopyTypeId, storedWorkingCopyModelFactory, untitledWorkingCopyModelFactory, fileService, lifecycleService, labelService, logService, workingCopyFileService, workingCopyBackupService, uriIdentityService, fileDialogService, filesConfigurationService, workingCopyService, notificationService, workingCopyEditorService, editorService, elevatedFileService, pathService, environmentService, dialogService, decorationsService) {
59
+ super();
60
+ this.workingCopyTypeId = workingCopyTypeId;
61
+ this.storedWorkingCopyModelFactory = storedWorkingCopyModelFactory;
62
+ this.untitledWorkingCopyModelFactory = untitledWorkingCopyModelFactory;
63
+ this.fileService = fileService;
64
+ this.logService = logService;
65
+ this.workingCopyFileService = workingCopyFileService;
66
+ this.uriIdentityService = uriIdentityService;
67
+ this.fileDialogService = fileDialogService;
68
+ this.filesConfigurationService = filesConfigurationService;
69
+ this.pathService = pathService;
70
+ this.environmentService = environmentService;
71
+ this.dialogService = dialogService;
72
+ this.decorationsService = decorationsService;
73
+ this.stored = this._register(( new StoredFileWorkingCopyManager(
74
+ this.workingCopyTypeId,
75
+ this.storedWorkingCopyModelFactory,
76
+ fileService,
77
+ lifecycleService,
78
+ labelService,
79
+ logService,
80
+ workingCopyFileService,
81
+ workingCopyBackupService,
82
+ uriIdentityService,
83
+ filesConfigurationService,
84
+ workingCopyService,
85
+ notificationService,
86
+ workingCopyEditorService,
87
+ editorService,
88
+ elevatedFileService
89
+ )));
90
+ this.untitled = this._register(( new UntitledFileWorkingCopyManager(
91
+ this.workingCopyTypeId,
92
+ this.untitledWorkingCopyModelFactory,
93
+ async (workingCopy, options) => {
94
+ const result = await this.saveAs(workingCopy.resource, undefined, options);
95
+ return result ? true : false;
96
+ },
97
+ fileService,
98
+ labelService,
99
+ logService,
100
+ workingCopyBackupService,
101
+ workingCopyService
102
+ )));
103
+ this.onDidCreate = Event.any(this.stored.onDidCreate, this.untitled.onDidCreate);
104
+ this.provideDecorations();
105
+ }
106
+ provideDecorations() {
107
+ const provider = this._register(new (class extends Disposable {
108
+ constructor(stored) {
109
+ super();
110
+ this.stored = stored;
111
+ this.label = ( localizeWithPath(
112
+ 'vs/workbench/services/workingCopy/common/fileWorkingCopyManager',
113
+ 'fileWorkingCopyDecorations',
114
+ "File Working Copy Decorations"
115
+ ));
116
+ this._onDidChange = this._register(( new Emitter()));
117
+ this.onDidChange = this._onDidChange.event;
118
+ this.registerListeners();
119
+ }
120
+ registerListeners() {
121
+ this._register(this.stored.onDidResolve(workingCopy => {
122
+ if (workingCopy.isReadonly() || workingCopy.hasState(4 )) {
123
+ this._onDidChange.fire([workingCopy.resource]);
124
+ }
125
+ }));
126
+ this._register(this.stored.onDidRemove(workingCopyUri => this._onDidChange.fire([workingCopyUri])));
127
+ this._register(this.stored.onDidChangeReadonly(workingCopy => this._onDidChange.fire([workingCopy.resource])));
128
+ this._register(this.stored.onDidChangeOrphaned(workingCopy => this._onDidChange.fire([workingCopy.resource])));
129
+ }
130
+ provideDecorations(uri) {
131
+ const workingCopy = this.stored.get(uri);
132
+ if (!workingCopy || workingCopy.isDisposed()) {
133
+ return undefined;
134
+ }
135
+ const isReadonly = workingCopy.isReadonly();
136
+ const isOrphaned = workingCopy.hasState(4 );
137
+ if (isReadonly && isOrphaned) {
138
+ return {
139
+ color: listErrorForeground,
140
+ letter: Codicon.lockSmall,
141
+ strikethrough: true,
142
+ tooltip: ( localizeWithPath(
143
+ 'vs/workbench/services/workingCopy/common/fileWorkingCopyManager',
144
+ 'readonlyAndDeleted',
145
+ "Deleted, Read-only"
146
+ )),
147
+ };
148
+ }
149
+ else if (isReadonly) {
150
+ return {
151
+ letter: Codicon.lockSmall,
152
+ tooltip: ( localizeWithPath(
153
+ 'vs/workbench/services/workingCopy/common/fileWorkingCopyManager',
154
+ 'readonly',
155
+ "Read-only"
156
+ )),
157
+ };
158
+ }
159
+ else if (isOrphaned) {
160
+ return {
161
+ color: listErrorForeground,
162
+ strikethrough: true,
163
+ tooltip: ( localizeWithPath(
164
+ 'vs/workbench/services/workingCopy/common/fileWorkingCopyManager',
165
+ 'deleted',
166
+ "Deleted"
167
+ )),
168
+ };
169
+ }
170
+ return undefined;
171
+ }
172
+ })(this.stored));
173
+ this._register(this.decorationsService.registerDecorationsProvider(provider));
174
+ }
175
+ get workingCopies() {
176
+ return [...this.stored.workingCopies, ...this.untitled.workingCopies];
177
+ }
178
+ get(resource) {
179
+ return this.stored.get(resource) ?? this.untitled.get(resource);
180
+ }
181
+ resolve(arg1, arg2) {
182
+ if (URI.isUri(arg1)) {
183
+ if (arg1.scheme === Schemas.untitled) {
184
+ return this.untitled.resolve({ untitledResource: arg1 });
185
+ }
186
+ else {
187
+ return this.stored.resolve(arg1, arg2);
188
+ }
189
+ }
190
+ return this.untitled.resolve(arg1);
191
+ }
192
+ async saveAs(source, target, options) {
193
+ if (!target) {
194
+ const workingCopy = this.get(source);
195
+ if (workingCopy instanceof UntitledFileWorkingCopy && workingCopy.hasAssociatedFilePath) {
196
+ target = await this.suggestSavePath(source);
197
+ }
198
+ else {
199
+ target = await this.fileDialogService.pickFileToSave(await this.suggestSavePath(options?.suggestedTarget ?? source), options?.availableFileSystems);
200
+ }
201
+ }
202
+ if (!target) {
203
+ return;
204
+ }
205
+ if (this.filesConfigurationService.isReadonly(target)) {
206
+ const confirmed = await this.confirmMakeWriteable(target);
207
+ if (!confirmed) {
208
+ return;
209
+ }
210
+ else {
211
+ this.filesConfigurationService.updateReadonly(target, false);
212
+ }
213
+ }
214
+ if (this.fileService.hasProvider(source) && isEqual(source, target)) {
215
+ return this.doSave(source, { ...options, force: true });
216
+ }
217
+ if (this.fileService.hasProvider(source) && this.uriIdentityService.extUri.isEqual(source, target) && (await this.fileService.exists(source))) {
218
+ await this.workingCopyFileService.move([{ file: { source, target } }], CancellationToken.None);
219
+ return (await this.doSave(source, options)) ?? (await this.doSave(target, options));
220
+ }
221
+ return this.doSaveAs(source, target, options);
222
+ }
223
+ async doSave(resource, options) {
224
+ const storedFileWorkingCopy = this.stored.get(resource);
225
+ if (storedFileWorkingCopy) {
226
+ const success = await storedFileWorkingCopy.save(options);
227
+ if (success) {
228
+ return storedFileWorkingCopy;
229
+ }
230
+ }
231
+ return undefined;
232
+ }
233
+ async doSaveAs(source, target, options) {
234
+ let sourceContents;
235
+ const sourceWorkingCopy = this.get(source);
236
+ if (sourceWorkingCopy?.isResolved()) {
237
+ sourceContents = await sourceWorkingCopy.model.snapshot(CancellationToken.None);
238
+ }
239
+ else {
240
+ sourceContents = (await this.fileService.readFileStream(source)).value;
241
+ }
242
+ const { targetFileExists, targetStoredFileWorkingCopy } = await this.doResolveSaveTarget(source, target);
243
+ if (sourceWorkingCopy instanceof UntitledFileWorkingCopy &&
244
+ sourceWorkingCopy.hasAssociatedFilePath &&
245
+ targetFileExists &&
246
+ this.uriIdentityService.extUri.isEqual(target, toLocalResource(sourceWorkingCopy.resource, this.environmentService.remoteAuthority, this.pathService.defaultUriScheme))) {
247
+ const overwrite = await this.confirmOverwrite(target);
248
+ if (!overwrite) {
249
+ return undefined;
250
+ }
251
+ }
252
+ await targetStoredFileWorkingCopy.model?.update(sourceContents, CancellationToken.None);
253
+ if (!options?.source) {
254
+ options = {
255
+ ...options,
256
+ source: targetFileExists ? FileWorkingCopyManager_1.FILE_WORKING_COPY_SAVE_REPLACE_SOURCE : FileWorkingCopyManager_1.FILE_WORKING_COPY_SAVE_CREATE_SOURCE
257
+ };
258
+ }
259
+ const success = await targetStoredFileWorkingCopy.save({
260
+ ...options,
261
+ from: source,
262
+ force: true
263
+ });
264
+ if (!success) {
265
+ return undefined;
266
+ }
267
+ try {
268
+ await sourceWorkingCopy?.revert();
269
+ }
270
+ catch (error) {
271
+ this.logService.error(error);
272
+ }
273
+ return targetStoredFileWorkingCopy;
274
+ }
275
+ async doResolveSaveTarget(source, target) {
276
+ let targetFileExists = false;
277
+ let targetStoredFileWorkingCopy = this.stored.get(target);
278
+ if (targetStoredFileWorkingCopy?.isResolved()) {
279
+ targetFileExists = true;
280
+ }
281
+ else {
282
+ targetFileExists = await this.fileService.exists(target);
283
+ if (!targetFileExists) {
284
+ await this.workingCopyFileService.create([{ resource: target }], CancellationToken.None);
285
+ }
286
+ if (this.uriIdentityService.extUri.isEqual(source, target) && this.get(source)) {
287
+ targetStoredFileWorkingCopy = await this.stored.resolve(source);
288
+ }
289
+ else {
290
+ targetStoredFileWorkingCopy = await this.stored.resolve(target);
291
+ }
292
+ }
293
+ return { targetFileExists, targetStoredFileWorkingCopy };
294
+ }
295
+ async confirmOverwrite(resource) {
296
+ const { confirmed } = await this.dialogService.confirm({
297
+ type: 'warning',
298
+ message: ( localizeWithPath(
299
+ 'vs/workbench/services/workingCopy/common/fileWorkingCopyManager',
300
+ 'confirmOverwrite',
301
+ "'{0}' already exists. Do you want to replace it?",
302
+ basename(resource)
303
+ )),
304
+ detail: ( localizeWithPath(
305
+ 'vs/workbench/services/workingCopy/common/fileWorkingCopyManager',
306
+ 'overwriteIrreversible',
307
+ "A file or folder with the name '{0}' already exists in the folder '{1}'. Replacing it will overwrite its current contents.",
308
+ basename(resource),
309
+ basename(dirname(resource))
310
+ )),
311
+ primaryButton: ( localizeWithPath(
312
+ 'vs/workbench/services/workingCopy/common/fileWorkingCopyManager',
313
+ { key: 'replaceButtonLabel', comment: ['&& denotes a mnemonic'] },
314
+ "&&Replace"
315
+ ))
316
+ });
317
+ return confirmed;
318
+ }
319
+ async confirmMakeWriteable(resource) {
320
+ const { confirmed } = await this.dialogService.confirm({
321
+ type: 'warning',
322
+ message: ( localizeWithPath(
323
+ 'vs/workbench/services/workingCopy/common/fileWorkingCopyManager',
324
+ 'confirmMakeWriteable',
325
+ "'{0}' is marked as read-only. Do you want to save anyway?",
326
+ basename(resource)
327
+ )),
328
+ detail: ( localizeWithPath(
329
+ 'vs/workbench/services/workingCopy/common/fileWorkingCopyManager',
330
+ 'confirmMakeWriteableDetail',
331
+ "Paths can be configured as read-only via settings."
332
+ )),
333
+ primaryButton: ( localizeWithPath(
334
+ 'vs/workbench/services/workingCopy/common/fileWorkingCopyManager',
335
+ { key: 'makeWriteableButtonLabel', comment: ['&& denotes a mnemonic'] },
336
+ "&&Save Anyway"
337
+ ))
338
+ });
339
+ return confirmed;
340
+ }
341
+ async suggestSavePath(resource) {
342
+ if (this.fileService.hasProvider(resource)) {
343
+ return resource;
344
+ }
345
+ const workingCopy = this.get(resource);
346
+ if (workingCopy instanceof UntitledFileWorkingCopy && workingCopy.hasAssociatedFilePath) {
347
+ return toLocalResource(resource, this.environmentService.remoteAuthority, this.pathService.defaultUriScheme);
348
+ }
349
+ const defaultFilePath = await this.fileDialogService.defaultFilePath();
350
+ if (workingCopy) {
351
+ const candidatePath = joinPath(defaultFilePath, workingCopy.name);
352
+ if (await this.pathService.hasValidBasename(candidatePath, workingCopy.name)) {
353
+ return candidatePath;
354
+ }
355
+ }
356
+ return joinPath(defaultFilePath, basename(resource));
357
+ }
358
+ async destroy() {
359
+ await Promises.settled([
360
+ this.stored.destroy(),
361
+ this.untitled.destroy()
362
+ ]);
363
+ }
364
+ };
365
+ FileWorkingCopyManager = FileWorkingCopyManager_1 = ( __decorate([
366
+ ( __param(3, IFileService)),
367
+ ( __param(4, ILifecycleService)),
368
+ ( __param(5, ILabelService)),
369
+ ( __param(6, ILogService)),
370
+ ( __param(7, IWorkingCopyFileService)),
371
+ ( __param(8, IWorkingCopyBackupService)),
372
+ ( __param(9, IUriIdentityService)),
373
+ ( __param(10, IFileDialogService)),
374
+ ( __param(11, IFilesConfigurationService)),
375
+ ( __param(12, IWorkingCopyService)),
376
+ ( __param(13, INotificationService)),
377
+ ( __param(14, IWorkingCopyEditorService)),
378
+ ( __param(15, IEditorService)),
379
+ ( __param(16, IElevatedFileService)),
380
+ ( __param(17, IPathService)),
381
+ ( __param(18, IWorkbenchEnvironmentService)),
382
+ ( __param(19, IDialogService)),
383
+ ( __param(20, IDecorationsService))
384
+ ], FileWorkingCopyManager));
385
+
386
+ export { FileWorkingCopyManager };