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