@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,62 @@
|
|
|
1
|
+
import { decodeBase64, VSBuffer } from '../../../../base/common/buffer.js';
|
|
2
|
+
import { Codicon } from '../../../../base/common/codicons.js';
|
|
3
|
+
import { localize2WithPath, localizeWithPath } from '../../../../nls.js';
|
|
4
|
+
import { RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';
|
|
5
|
+
import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';
|
|
6
|
+
import { registerIcon } from '../../../../platform/theme/common/iconRegistry.js';
|
|
7
|
+
import { StringSHA1 } from '../../../../base/common/hash.js';
|
|
8
|
+
const EDIT_SESSION_SYNC_CATEGORY = {
|
|
9
|
+
original: 'Cloud Changes',
|
|
10
|
+
value: ( localizeWithPath(
|
|
11
|
+
'vs/workbench/contrib/editSessions/common/editSessions',
|
|
12
|
+
'cloud changes',
|
|
13
|
+
'Cloud Changes'
|
|
14
|
+
))
|
|
15
|
+
};
|
|
16
|
+
const IEditSessionsStorageService = ( createDecorator('IEditSessionsStorageService'));
|
|
17
|
+
const IEditSessionsLogService = ( createDecorator('IEditSessionsLogService'));
|
|
18
|
+
var ChangeType;
|
|
19
|
+
( (function(ChangeType) {
|
|
20
|
+
ChangeType[ChangeType["Addition"] = 1] = "Addition";
|
|
21
|
+
ChangeType[ChangeType["Deletion"] = 2] = "Deletion";
|
|
22
|
+
})(ChangeType || (ChangeType = {})));
|
|
23
|
+
var FileType;
|
|
24
|
+
( (function(FileType) {
|
|
25
|
+
FileType[FileType["File"] = 1] = "File";
|
|
26
|
+
})(FileType || (FileType = {})));
|
|
27
|
+
const EditSessionSchemaVersion = 3;
|
|
28
|
+
const EDIT_SESSIONS_SIGNED_IN_KEY = 'editSessionsSignedIn';
|
|
29
|
+
const EDIT_SESSIONS_SIGNED_IN = ( new RawContextKey(EDIT_SESSIONS_SIGNED_IN_KEY, false));
|
|
30
|
+
const EDIT_SESSIONS_PENDING_KEY = 'editSessionsPending';
|
|
31
|
+
const EDIT_SESSIONS_PENDING = ( new RawContextKey(EDIT_SESSIONS_PENDING_KEY, false));
|
|
32
|
+
const EDIT_SESSIONS_CONTAINER_ID = 'workbench.view.editSessions';
|
|
33
|
+
const EDIT_SESSIONS_DATA_VIEW_ID = 'workbench.views.editSessions.data';
|
|
34
|
+
const EDIT_SESSIONS_TITLE = ( localize2WithPath(
|
|
35
|
+
'vs/workbench/contrib/editSessions/common/editSessions',
|
|
36
|
+
'cloud changes',
|
|
37
|
+
'Cloud Changes'
|
|
38
|
+
));
|
|
39
|
+
const EDIT_SESSIONS_VIEW_ICON = registerIcon('edit-sessions-view-icon', Codicon.cloudDownload, ( localizeWithPath(
|
|
40
|
+
'vs/workbench/contrib/editSessions/common/editSessions',
|
|
41
|
+
'editSessionViewIcon',
|
|
42
|
+
'View icon of the cloud changes view.'
|
|
43
|
+
)));
|
|
44
|
+
const EDIT_SESSIONS_SHOW_VIEW = ( new RawContextKey('editSessionsShowView', false));
|
|
45
|
+
const EDIT_SESSIONS_SCHEME = 'vscode-edit-sessions';
|
|
46
|
+
function decodeEditSessionFileContent(version, content) {
|
|
47
|
+
switch (version) {
|
|
48
|
+
case 1:
|
|
49
|
+
return VSBuffer.fromString(content);
|
|
50
|
+
case 2:
|
|
51
|
+
return decodeBase64(content);
|
|
52
|
+
default:
|
|
53
|
+
throw new Error('Upgrade to a newer version to decode this content.');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function hashedEditSessionId(editSessionId) {
|
|
57
|
+
const sha1 = ( new StringSHA1());
|
|
58
|
+
sha1.update(editSessionId);
|
|
59
|
+
return sha1.digest();
|
|
60
|
+
}
|
|
61
|
+
const editSessionsLogId = 'editSessions';
|
|
62
|
+
export { ChangeType, EDIT_SESSIONS_CONTAINER_ID, EDIT_SESSIONS_DATA_VIEW_ID, EDIT_SESSIONS_PENDING, EDIT_SESSIONS_PENDING_KEY, EDIT_SESSIONS_SCHEME, EDIT_SESSIONS_SHOW_VIEW, EDIT_SESSIONS_SIGNED_IN, EDIT_SESSIONS_SIGNED_IN_KEY, EDIT_SESSIONS_TITLE, EDIT_SESSIONS_VIEW_ICON, EDIT_SESSION_SYNC_CATEGORY, EditSessionSchemaVersion, FileType, IEditSessionsLogService, IEditSessionsStorageService, decodeEditSessionFileContent, editSessionsLogId, hashedEditSessionId };
|
package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Extensions } from '../../../../platform/configuration/common/configurationRegistry.js';
|
|
2
|
+
import { Registry } from '../../../../platform/registry/common/platform.js';
|
|
3
|
+
import { externalUriOpenersConfigurationNode } from './configuration.js';
|
|
4
|
+
( Registry.as(Extensions.Configuration))
|
|
5
|
+
.registerConfiguration(externalUriOpenersConfigurationNode);
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { localizeWithPath } from '../../../../../nls.js';
|
|
3
|
+
import { BaseBinaryResourceEditor } from '../../../../browser/parts/editor/binaryEditor.js';
|
|
4
|
+
import { ITelemetryService } from '../../../../../platform/telemetry/common/telemetry.js';
|
|
5
|
+
import { IThemeService } from '../../../../../platform/theme/common/themeService.js';
|
|
6
|
+
import { FileEditorInput } from './fileEditorInput.js';
|
|
7
|
+
import { BINARY_FILE_EDITOR_ID, BINARY_TEXT_FILE_MODE } from '../../common/files.js';
|
|
8
|
+
import { IStorageService } from '../../../../../platform/storage/common/storage.js';
|
|
9
|
+
import { EditorResolution } from '../../../../../platform/editor/common/editor.js';
|
|
10
|
+
import { IEditorResolverService } from '../../../../services/editor/common/editorResolverService.js';
|
|
11
|
+
import { isEditorInputWithOptions } from '../../../../common/editor.js';
|
|
12
|
+
import { DiffEditorInput } from '../../../../common/editor/diffEditorInput.js';
|
|
13
|
+
import { IEditorGroupsService } from '../../../../services/editor/common/editorGroupsService.js';
|
|
14
|
+
var BinaryFileEditor_1;
|
|
15
|
+
let BinaryFileEditor = class BinaryFileEditor extends BaseBinaryResourceEditor {
|
|
16
|
+
static { BinaryFileEditor_1 = this; }
|
|
17
|
+
static { this.ID = BINARY_FILE_EDITOR_ID; }
|
|
18
|
+
constructor(telemetryService, themeService, editorResolverService, storageService, editorGroupService) {
|
|
19
|
+
super(BinaryFileEditor_1.ID, {
|
|
20
|
+
openInternal: (input, options) => this.openInternal(input, options)
|
|
21
|
+
}, telemetryService, themeService, storageService);
|
|
22
|
+
this.editorResolverService = editorResolverService;
|
|
23
|
+
this.editorGroupService = editorGroupService;
|
|
24
|
+
}
|
|
25
|
+
async openInternal(input, options) {
|
|
26
|
+
if (input instanceof FileEditorInput && this.group?.activeEditor) {
|
|
27
|
+
const activeEditor = this.group.activeEditor;
|
|
28
|
+
const untypedActiveEditor = activeEditor?.toUntyped();
|
|
29
|
+
if (!untypedActiveEditor) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
let resolvedEditor = await this.editorResolverService.resolveEditor({
|
|
33
|
+
...untypedActiveEditor,
|
|
34
|
+
options: {
|
|
35
|
+
...options,
|
|
36
|
+
override: EditorResolution.PICK
|
|
37
|
+
}
|
|
38
|
+
}, this.group);
|
|
39
|
+
if (resolvedEditor === 2 ) {
|
|
40
|
+
resolvedEditor = undefined;
|
|
41
|
+
}
|
|
42
|
+
else if (resolvedEditor === 1 ) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (isEditorInputWithOptions(resolvedEditor)) {
|
|
46
|
+
for (const editor of resolvedEditor.editor instanceof DiffEditorInput ? [resolvedEditor.editor.original, resolvedEditor.editor.modified] : [resolvedEditor.editor]) {
|
|
47
|
+
if (editor instanceof FileEditorInput) {
|
|
48
|
+
editor.setForceOpenAsText();
|
|
49
|
+
editor.setPreferredLanguageId(BINARY_TEXT_FILE_MODE);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
await (this.group ?? this.editorGroupService.activeGroup).replaceEditors([{
|
|
54
|
+
editor: activeEditor,
|
|
55
|
+
replacement: resolvedEditor?.editor ?? input,
|
|
56
|
+
options: {
|
|
57
|
+
...(resolvedEditor?.options ?? options)
|
|
58
|
+
}
|
|
59
|
+
}]);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
getTitle() {
|
|
63
|
+
return this.input ? this.input.getName() : ( localizeWithPath(
|
|
64
|
+
'vs/workbench/contrib/files/browser/editors/binaryFileEditor',
|
|
65
|
+
'binaryFileEditor',
|
|
66
|
+
"Binary File Viewer"
|
|
67
|
+
));
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
BinaryFileEditor = BinaryFileEditor_1 = ( __decorate([
|
|
71
|
+
( __param(0, ITelemetryService)),
|
|
72
|
+
( __param(1, IThemeService)),
|
|
73
|
+
( __param(2, IEditorResolverService)),
|
|
74
|
+
( __param(3, IStorageService)),
|
|
75
|
+
( __param(4, IEditorGroupsService))
|
|
76
|
+
], BinaryFileEditor));
|
|
77
|
+
export { BinaryFileEditor };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Disposable } from '../../../../../base/common/lifecycle.js';
|
|
3
|
+
import { URI } from '../../../../../base/common/uri.js';
|
|
4
|
+
import { ITextEditorService } from '../../../../services/textfile/common/textEditorService.js';
|
|
5
|
+
import { isEqual } from '../../../../../base/common/resources.js';
|
|
6
|
+
import { NO_TYPE_ID } from '../../../../services/workingCopy/common/workingCopy.js';
|
|
7
|
+
import { IWorkingCopyEditorService } from '../../../../services/workingCopy/common/workingCopyEditorService.js';
|
|
8
|
+
import { IFileService } from '../../../../../platform/files/common/files.js';
|
|
9
|
+
class FileEditorInputSerializer {
|
|
10
|
+
canSerialize(editorInput) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
serialize(editorInput) {
|
|
14
|
+
const fileEditorInput = editorInput;
|
|
15
|
+
const resource = fileEditorInput.resource;
|
|
16
|
+
const preferredResource = fileEditorInput.preferredResource;
|
|
17
|
+
const serializedFileEditorInput = {
|
|
18
|
+
resourceJSON: resource.toJSON(),
|
|
19
|
+
preferredResourceJSON: isEqual(resource, preferredResource) ? undefined : preferredResource,
|
|
20
|
+
name: fileEditorInput.getPreferredName(),
|
|
21
|
+
description: fileEditorInput.getPreferredDescription(),
|
|
22
|
+
encoding: fileEditorInput.getEncoding(),
|
|
23
|
+
modeId: fileEditorInput.getPreferredLanguageId()
|
|
24
|
+
};
|
|
25
|
+
return JSON.stringify(serializedFileEditorInput);
|
|
26
|
+
}
|
|
27
|
+
deserialize(instantiationService, serializedEditorInput) {
|
|
28
|
+
return instantiationService.invokeFunction(accessor => {
|
|
29
|
+
const serializedFileEditorInput = JSON.parse(serializedEditorInput);
|
|
30
|
+
const resource = URI.revive(serializedFileEditorInput.resourceJSON);
|
|
31
|
+
const preferredResource = URI.revive(serializedFileEditorInput.preferredResourceJSON);
|
|
32
|
+
const name = serializedFileEditorInput.name;
|
|
33
|
+
const description = serializedFileEditorInput.description;
|
|
34
|
+
const encoding = serializedFileEditorInput.encoding;
|
|
35
|
+
const languageId = serializedFileEditorInput.modeId;
|
|
36
|
+
const fileEditorInput = accessor.get(ITextEditorService).createTextEditor({ resource, label: name, description, encoding, languageId, forceFile: true });
|
|
37
|
+
if (preferredResource) {
|
|
38
|
+
fileEditorInput.setPreferredResource(preferredResource);
|
|
39
|
+
}
|
|
40
|
+
return fileEditorInput;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
let FileEditorWorkingCopyEditorHandler = class FileEditorWorkingCopyEditorHandler extends Disposable {
|
|
45
|
+
constructor(workingCopyEditorService, textEditorService, fileService) {
|
|
46
|
+
super();
|
|
47
|
+
this.textEditorService = textEditorService;
|
|
48
|
+
this.fileService = fileService;
|
|
49
|
+
this._register(workingCopyEditorService.registerHandler(this));
|
|
50
|
+
}
|
|
51
|
+
handles(workingCopy) {
|
|
52
|
+
return workingCopy.typeId === NO_TYPE_ID && this.fileService.canHandleResource(workingCopy.resource);
|
|
53
|
+
}
|
|
54
|
+
handlesSync(workingCopy) {
|
|
55
|
+
return workingCopy.typeId === NO_TYPE_ID && this.fileService.hasProvider(workingCopy.resource);
|
|
56
|
+
}
|
|
57
|
+
isOpen(workingCopy, editor) {
|
|
58
|
+
if (!this.handlesSync(workingCopy)) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
return isEqual(workingCopy.resource, editor.resource);
|
|
62
|
+
}
|
|
63
|
+
createEditor(workingCopy) {
|
|
64
|
+
return this.textEditorService.createTextEditor({ resource: workingCopy.resource, forceFile: true });
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
FileEditorWorkingCopyEditorHandler = ( __decorate([
|
|
68
|
+
( __param(0, IWorkingCopyEditorService)),
|
|
69
|
+
( __param(1, ITextEditorService)),
|
|
70
|
+
( __param(2, IFileService))
|
|
71
|
+
], FileEditorWorkingCopyEditorHandler));
|
|
72
|
+
export { FileEditorInputSerializer, FileEditorWorkingCopyEditorHandler };
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { localizeWithPath } from '../../../../../nls.js';
|
|
3
|
+
import { mark } from '../../../../../base/common/performance.js';
|
|
4
|
+
import { assertIsDefined } from '../../../../../base/common/types.js';
|
|
5
|
+
import { IPathService } from '../../../../services/path/common/pathService.js';
|
|
6
|
+
import { toAction } from '../../../../../base/common/actions.js';
|
|
7
|
+
import { TEXT_FILE_EDITOR_ID, BINARY_TEXT_FILE_MODE, VIEWLET_ID } from '../../common/files.js';
|
|
8
|
+
import { ITextFileService } from '../../../../services/textfile/common/textfiles.js';
|
|
9
|
+
import { AbstractTextCodeEditor } from '../../../../browser/parts/editor/textCodeEditor.js';
|
|
10
|
+
import { isTextEditorViewState, createEditorOpenError, createTooLargeFileError, DEFAULT_EDITOR_ASSOCIATION } from '../../../../common/editor.js';
|
|
11
|
+
import { applyTextEditorOptions } from '../../../../common/editor/editorOptions.js';
|
|
12
|
+
import { BinaryEditorModel } from '../../../../common/editor/binaryEditorModel.js';
|
|
13
|
+
import { FileEditorInput } from './fileEditorInput.js';
|
|
14
|
+
import { TooLargeFileOperationError, ByteSize, FileOperationError, IFileService } from '../../../../../platform/files/common/files.js';
|
|
15
|
+
import { ITelemetryService } from '../../../../../platform/telemetry/common/telemetry.js';
|
|
16
|
+
import { IWorkspaceContextService } from '../../../../../platform/workspace/common/workspace.js';
|
|
17
|
+
import { IStorageService } from '../../../../../platform/storage/common/storage.js';
|
|
18
|
+
import { ITextResourceConfigurationService } from '../../../../../editor/common/services/textResourceConfiguration.js';
|
|
19
|
+
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
|
|
20
|
+
import { IThemeService } from '../../../../../platform/theme/common/themeService.js';
|
|
21
|
+
import { IEditorService } from '../../../../services/editor/common/editorService.js';
|
|
22
|
+
import { IEditorGroupsService } from '../../../../services/editor/common/editorGroupsService.js';
|
|
23
|
+
import { EditorActivation } from '../../../../../platform/editor/common/editor.js';
|
|
24
|
+
import { IUriIdentityService } from '../../../../../platform/uriIdentity/common/uriIdentity.js';
|
|
25
|
+
import { IExplorerService } from '../files.js';
|
|
26
|
+
import { IPaneCompositePartService } from '../../../../services/panecomposite/browser/panecomposite.js';
|
|
27
|
+
import { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js';
|
|
28
|
+
import { IPreferencesService } from '../../../../services/preferences/common/preferences.js';
|
|
29
|
+
import { IHostService } from '../../../../services/host/browser/host.js';
|
|
30
|
+
import { IFilesConfigurationService } from '../../../../services/filesConfiguration/common/filesConfigurationService.js';
|
|
31
|
+
var TextFileEditor_1;
|
|
32
|
+
let TextFileEditor = class TextFileEditor extends AbstractTextCodeEditor {
|
|
33
|
+
static { TextFileEditor_1 = this; }
|
|
34
|
+
static { this.ID = TEXT_FILE_EDITOR_ID; }
|
|
35
|
+
constructor(telemetryService, fileService, paneCompositeService, instantiationService, contextService, storageService, textResourceConfigurationService, editorService, themeService, editorGroupService, textFileService, explorerService, uriIdentityService, pathService, configurationService, preferencesService, hostService, filesConfigurationService) {
|
|
36
|
+
super(TextFileEditor_1.ID, telemetryService, instantiationService, storageService, textResourceConfigurationService, themeService, editorService, editorGroupService, fileService);
|
|
37
|
+
this.paneCompositeService = paneCompositeService;
|
|
38
|
+
this.contextService = contextService;
|
|
39
|
+
this.textFileService = textFileService;
|
|
40
|
+
this.explorerService = explorerService;
|
|
41
|
+
this.uriIdentityService = uriIdentityService;
|
|
42
|
+
this.pathService = pathService;
|
|
43
|
+
this.configurationService = configurationService;
|
|
44
|
+
this.preferencesService = preferencesService;
|
|
45
|
+
this.hostService = hostService;
|
|
46
|
+
this.filesConfigurationService = filesConfigurationService;
|
|
47
|
+
this._register(this.fileService.onDidFilesChange(e => this.onDidFilesChange(e)));
|
|
48
|
+
this._register(this.fileService.onDidRunOperation(e => this.onDidRunOperation(e)));
|
|
49
|
+
}
|
|
50
|
+
onDidFilesChange(e) {
|
|
51
|
+
for (const resource of e.rawDeleted) {
|
|
52
|
+
this.clearEditorViewState(resource);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
onDidRunOperation(e) {
|
|
56
|
+
if (e.operation === 2 && e.target) {
|
|
57
|
+
this.moveEditorViewState(e.resource, e.target.resource, this.uriIdentityService.extUri);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
getTitle() {
|
|
61
|
+
if (this.input) {
|
|
62
|
+
return this.input.getName();
|
|
63
|
+
}
|
|
64
|
+
return ( localizeWithPath(
|
|
65
|
+
'vs/workbench/contrib/files/browser/editors/textFileEditor',
|
|
66
|
+
'textFileEditor',
|
|
67
|
+
"Text File Editor"
|
|
68
|
+
));
|
|
69
|
+
}
|
|
70
|
+
get input() {
|
|
71
|
+
return this._input;
|
|
72
|
+
}
|
|
73
|
+
async setInput(input, options, context, token) {
|
|
74
|
+
mark('code/willSetInputToTextFileEditor');
|
|
75
|
+
await super.setInput(input, options, context, token);
|
|
76
|
+
try {
|
|
77
|
+
const resolvedModel = await input.resolve(options);
|
|
78
|
+
if (token.isCancellationRequested) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (resolvedModel instanceof BinaryEditorModel) {
|
|
82
|
+
return this.openAsBinary(input, options);
|
|
83
|
+
}
|
|
84
|
+
const textFileModel = resolvedModel;
|
|
85
|
+
const control = assertIsDefined(this.editorControl);
|
|
86
|
+
control.setModel(textFileModel.textEditorModel);
|
|
87
|
+
if (!isTextEditorViewState(options?.viewState)) {
|
|
88
|
+
const editorViewState = this.loadEditorViewState(input, context);
|
|
89
|
+
if (editorViewState) {
|
|
90
|
+
if (options?.selection) {
|
|
91
|
+
editorViewState.cursorState = [];
|
|
92
|
+
}
|
|
93
|
+
control.restoreViewState(editorViewState);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (options) {
|
|
97
|
+
applyTextEditorOptions(options, control, 1 );
|
|
98
|
+
}
|
|
99
|
+
control.updateOptions(this.getReadonlyConfiguration(textFileModel.isReadonly()));
|
|
100
|
+
if (control.handleInitialized) {
|
|
101
|
+
control.handleInitialized();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
await this.handleSetInputError(error, input, options);
|
|
106
|
+
}
|
|
107
|
+
mark('code/didSetInputToTextFileEditor');
|
|
108
|
+
}
|
|
109
|
+
async handleSetInputError(error, input, options) {
|
|
110
|
+
if (error.textFileOperationResult === 0 ) {
|
|
111
|
+
return this.openAsBinary(input, options);
|
|
112
|
+
}
|
|
113
|
+
if (error.fileOperationResult === 0 ) {
|
|
114
|
+
const actions = [];
|
|
115
|
+
actions.push(toAction({
|
|
116
|
+
id: 'workbench.files.action.openFolder', label: ( localizeWithPath(
|
|
117
|
+
'vs/workbench/contrib/files/browser/editors/textFileEditor',
|
|
118
|
+
'openFolder',
|
|
119
|
+
"Open Folder"
|
|
120
|
+
)), run: async () => {
|
|
121
|
+
return this.hostService.openWindow([{ folderUri: input.resource }], { forceNewWindow: true });
|
|
122
|
+
}
|
|
123
|
+
}));
|
|
124
|
+
if (this.contextService.isInsideWorkspace(input.preferredResource)) {
|
|
125
|
+
actions.push(toAction({
|
|
126
|
+
id: 'workbench.files.action.reveal', label: ( localizeWithPath(
|
|
127
|
+
'vs/workbench/contrib/files/browser/editors/textFileEditor',
|
|
128
|
+
'reveal',
|
|
129
|
+
"Reveal Folder"
|
|
130
|
+
)), run: async () => {
|
|
131
|
+
await this.paneCompositeService.openPaneComposite(VIEWLET_ID, 0 , true);
|
|
132
|
+
return this.explorerService.select(input.preferredResource, true);
|
|
133
|
+
}
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
throw createEditorOpenError(localizeWithPath('vs/workbench/contrib/files/browser/editors/textFileEditor', 'fileIsDirectory', "The file is not displayed in the text editor because it is a directory."), actions, { forceMessage: true });
|
|
137
|
+
}
|
|
138
|
+
if (error.fileOperationResult === 7 && this.group) {
|
|
139
|
+
let message;
|
|
140
|
+
if (error instanceof TooLargeFileOperationError) {
|
|
141
|
+
message = ( localizeWithPath(
|
|
142
|
+
'vs/workbench/contrib/files/browser/editors/textFileEditor',
|
|
143
|
+
'fileTooLargeForHeapErrorWithSize',
|
|
144
|
+
"The file is not displayed in the text editor because it is very large ({0}).",
|
|
145
|
+
ByteSize.formatSize(error.size)
|
|
146
|
+
));
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
message = ( localizeWithPath(
|
|
150
|
+
'vs/workbench/contrib/files/browser/editors/textFileEditor',
|
|
151
|
+
'fileTooLargeForHeapErrorWithoutSize',
|
|
152
|
+
"The file is not displayed in the text editor because it is very large."
|
|
153
|
+
));
|
|
154
|
+
}
|
|
155
|
+
throw createTooLargeFileError(this.group, input, options, message, this.preferencesService);
|
|
156
|
+
}
|
|
157
|
+
if (error.fileOperationResult === 1 &&
|
|
158
|
+
!this.filesConfigurationService.isReadonly(input.preferredResource) &&
|
|
159
|
+
(await this.pathService.hasValidBasename(input.preferredResource))) {
|
|
160
|
+
const fileNotFoundError = createEditorOpenError(( new FileOperationError(( localizeWithPath(
|
|
161
|
+
'vs/workbench/contrib/files/browser/editors/textFileEditor',
|
|
162
|
+
'unavailableResourceErrorEditorText',
|
|
163
|
+
"The editor could not be opened because the file was not found."
|
|
164
|
+
)), 1 )), [
|
|
165
|
+
toAction({
|
|
166
|
+
id: 'workbench.files.action.createMissingFile', label: ( localizeWithPath(
|
|
167
|
+
'vs/workbench/contrib/files/browser/editors/textFileEditor',
|
|
168
|
+
'createFile',
|
|
169
|
+
"Create File"
|
|
170
|
+
)), run: async () => {
|
|
171
|
+
await this.textFileService.create([{ resource: input.preferredResource }]);
|
|
172
|
+
return this.editorService.openEditor({
|
|
173
|
+
resource: input.preferredResource,
|
|
174
|
+
options: {
|
|
175
|
+
pinned: true
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
})
|
|
180
|
+
], {
|
|
181
|
+
allowDialog: true
|
|
182
|
+
});
|
|
183
|
+
throw fileNotFoundError;
|
|
184
|
+
}
|
|
185
|
+
throw error;
|
|
186
|
+
}
|
|
187
|
+
openAsBinary(input, options) {
|
|
188
|
+
const defaultBinaryEditor = this.configurationService.getValue('workbench.editor.defaultBinaryEditor');
|
|
189
|
+
const group = this.group ?? this.editorGroupService.activeGroup;
|
|
190
|
+
const editorOptions = {
|
|
191
|
+
...options,
|
|
192
|
+
activation: EditorActivation.PRESERVE
|
|
193
|
+
};
|
|
194
|
+
if (defaultBinaryEditor && defaultBinaryEditor !== '' && defaultBinaryEditor !== DEFAULT_EDITOR_ASSOCIATION.id) {
|
|
195
|
+
this.doOpenAsBinaryInDifferentEditor(group, defaultBinaryEditor, input, editorOptions);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
this.doOpenAsBinaryInSameEditor(group, defaultBinaryEditor, input, editorOptions);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
doOpenAsBinaryInDifferentEditor(group, editorId, editor, editorOptions) {
|
|
202
|
+
this.editorService.replaceEditors([{
|
|
203
|
+
editor,
|
|
204
|
+
replacement: { resource: editor.resource, options: { ...editorOptions, override: editorId } }
|
|
205
|
+
}], group);
|
|
206
|
+
}
|
|
207
|
+
doOpenAsBinaryInSameEditor(group, editorId, editor, editorOptions) {
|
|
208
|
+
if (editorId === DEFAULT_EDITOR_ASSOCIATION.id) {
|
|
209
|
+
editor.setForceOpenAsText();
|
|
210
|
+
editor.setPreferredLanguageId(BINARY_TEXT_FILE_MODE);
|
|
211
|
+
editorOptions = { ...editorOptions, forceReload: true };
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
editor.setForceOpenAsBinary();
|
|
215
|
+
}
|
|
216
|
+
group.openEditor(editor, editorOptions);
|
|
217
|
+
}
|
|
218
|
+
clearInput() {
|
|
219
|
+
super.clearInput();
|
|
220
|
+
this.editorControl?.setModel(null);
|
|
221
|
+
}
|
|
222
|
+
createEditorControl(parent, initialOptions) {
|
|
223
|
+
mark('code/willCreateTextFileEditorControl');
|
|
224
|
+
super.createEditorControl(parent, initialOptions);
|
|
225
|
+
mark('code/didCreateTextFileEditorControl');
|
|
226
|
+
}
|
|
227
|
+
tracksEditorViewState(input) {
|
|
228
|
+
return input instanceof FileEditorInput;
|
|
229
|
+
}
|
|
230
|
+
tracksDisposedEditorViewState() {
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
TextFileEditor = TextFileEditor_1 = ( __decorate([
|
|
235
|
+
( __param(0, ITelemetryService)),
|
|
236
|
+
( __param(1, IFileService)),
|
|
237
|
+
( __param(2, IPaneCompositePartService)),
|
|
238
|
+
( __param(3, IInstantiationService)),
|
|
239
|
+
( __param(4, IWorkspaceContextService)),
|
|
240
|
+
( __param(5, IStorageService)),
|
|
241
|
+
( __param(6, ITextResourceConfigurationService)),
|
|
242
|
+
( __param(7, IEditorService)),
|
|
243
|
+
( __param(8, IThemeService)),
|
|
244
|
+
( __param(9, IEditorGroupsService)),
|
|
245
|
+
( __param(10, ITextFileService)),
|
|
246
|
+
( __param(11, IExplorerService)),
|
|
247
|
+
( __param(12, IUriIdentityService)),
|
|
248
|
+
( __param(13, IPathService)),
|
|
249
|
+
( __param(14, IConfigurationService)),
|
|
250
|
+
( __param(15, IPreferencesService)),
|
|
251
|
+
( __param(16, IHostService)),
|
|
252
|
+
( __param(17, IFilesConfigurationService))
|
|
253
|
+
], TextFileEditor));
|
|
254
|
+
export { TextFileEditor };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { ITextFileService } from '../../../../services/textfile/common/textfiles.js';
|
|
3
|
+
import { ILifecycleService } from '../../../../services/lifecycle/common/lifecycle.js';
|
|
4
|
+
import { Disposable } from '../../../../../base/common/lifecycle.js';
|
|
5
|
+
import { distinct, coalesce } from '../../../../../base/common/arrays.js';
|
|
6
|
+
import { IHostService } from '../../../../services/host/browser/host.js';
|
|
7
|
+
import { IEditorService } from '../../../../services/editor/common/editorService.js';
|
|
8
|
+
import { RunOnceWorker } from '../../../../../base/common/async.js';
|
|
9
|
+
import { ICodeEditorService } from '../../../../../editor/browser/services/codeEditorService.js';
|
|
10
|
+
import { IFilesConfigurationService } from '../../../../services/filesConfiguration/common/filesConfigurationService.js';
|
|
11
|
+
import { FILE_EDITOR_INPUT_ID } from '../../common/files.js';
|
|
12
|
+
import { Schemas } from '../../../../../base/common/network.js';
|
|
13
|
+
import { UntitledTextEditorInput } from '../../../../services/untitled/common/untitledTextEditorInput.js';
|
|
14
|
+
import { IWorkingCopyEditorService } from '../../../../services/workingCopy/common/workingCopyEditorService.js';
|
|
15
|
+
import { DEFAULT_EDITOR_ASSOCIATION } from '../../../../common/editor.js';
|
|
16
|
+
let TextFileEditorTracker = class TextFileEditorTracker extends Disposable {
|
|
17
|
+
constructor(editorService, textFileService, lifecycleService, hostService, codeEditorService, filesConfigurationService, workingCopyEditorService) {
|
|
18
|
+
super();
|
|
19
|
+
this.editorService = editorService;
|
|
20
|
+
this.textFileService = textFileService;
|
|
21
|
+
this.lifecycleService = lifecycleService;
|
|
22
|
+
this.hostService = hostService;
|
|
23
|
+
this.codeEditorService = codeEditorService;
|
|
24
|
+
this.filesConfigurationService = filesConfigurationService;
|
|
25
|
+
this.workingCopyEditorService = workingCopyEditorService;
|
|
26
|
+
this.ensureDirtyFilesAreOpenedWorker = this._register(( new RunOnceWorker(
|
|
27
|
+
units => this.ensureDirtyTextFilesAreOpened(units),
|
|
28
|
+
this.getDirtyTextFileTrackerDelay()
|
|
29
|
+
)));
|
|
30
|
+
this.registerListeners();
|
|
31
|
+
}
|
|
32
|
+
registerListeners() {
|
|
33
|
+
this._register(this.textFileService.files.onDidChangeDirty(model => this.ensureDirtyFilesAreOpenedWorker.work(model.resource)));
|
|
34
|
+
this._register(this.textFileService.files.onDidSaveError(model => this.ensureDirtyFilesAreOpenedWorker.work(model.resource)));
|
|
35
|
+
this._register(this.textFileService.untitled.onDidChangeDirty(model => this.ensureDirtyFilesAreOpenedWorker.work(model.resource)));
|
|
36
|
+
this._register(this.hostService.onDidChangeFocus(hasFocus => hasFocus ? this.reloadVisibleTextFileEditors() : undefined));
|
|
37
|
+
this._register(this.lifecycleService.onDidShutdown(() => this.dispose()));
|
|
38
|
+
}
|
|
39
|
+
getDirtyTextFileTrackerDelay() {
|
|
40
|
+
return 800;
|
|
41
|
+
}
|
|
42
|
+
ensureDirtyTextFilesAreOpened(resources) {
|
|
43
|
+
this.doEnsureDirtyTextFilesAreOpened(distinct(resources.filter(resource => {
|
|
44
|
+
if (!this.textFileService.isDirty(resource)) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
const fileModel = this.textFileService.files.get(resource);
|
|
48
|
+
if (fileModel?.hasState(2 )) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
if (resource.scheme !== Schemas.untitled && !fileModel?.hasState(5 ) && this.filesConfigurationService.hasShortAutoSaveDelay(resource)) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
if (this.editorService.isOpened({ resource, typeId: resource.scheme === Schemas.untitled ? UntitledTextEditorInput.ID : FILE_EDITOR_INPUT_ID, editorId: DEFAULT_EDITOR_ASSOCIATION.id })) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
const model = fileModel ?? this.textFileService.untitled.get(resource);
|
|
58
|
+
if (model && this.workingCopyEditorService.findEditor(model)) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
}), resource => ( resource.toString())));
|
|
63
|
+
}
|
|
64
|
+
doEnsureDirtyTextFilesAreOpened(resources) {
|
|
65
|
+
if (!resources.length) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
this.editorService.openEditors(( resources.map(resource => ({
|
|
69
|
+
resource,
|
|
70
|
+
options: { inactive: true, pinned: true, preserveFocus: true }
|
|
71
|
+
}))));
|
|
72
|
+
}
|
|
73
|
+
reloadVisibleTextFileEditors() {
|
|
74
|
+
distinct(coalesce(( this.codeEditorService.listCodeEditors()
|
|
75
|
+
.map(codeEditor => {
|
|
76
|
+
const resource = codeEditor.getModel()?.uri;
|
|
77
|
+
if (!resource) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
const model = this.textFileService.files.get(resource);
|
|
81
|
+
if (!model || model.isDirty() || !model.isResolved()) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
return model;
|
|
85
|
+
}))), model => ( model.resource.toString())).forEach(model => this.textFileService.files.resolve(model.resource, { reload: { async: true } }));
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
TextFileEditorTracker = ( __decorate([
|
|
89
|
+
( __param(0, IEditorService)),
|
|
90
|
+
( __param(1, ITextFileService)),
|
|
91
|
+
( __param(2, ILifecycleService)),
|
|
92
|
+
( __param(3, IHostService)),
|
|
93
|
+
( __param(4, ICodeEditorService)),
|
|
94
|
+
( __param(5, IFilesConfigurationService)),
|
|
95
|
+
( __param(6, IWorkingCopyEditorService))
|
|
96
|
+
], TextFileEditorTracker));
|
|
97
|
+
export { TextFileEditorTracker };
|