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