@codingame/monaco-vscode-views-service-override 2.1.4 → 2.2.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +11 -9
- package/index.js +8 -6
- package/package.json +11 -11
- package/tools/views.d.ts +102 -0
- package/tools/views.js +253 -0
- package/views.d.ts +4 -99
- package/views.js +52 -280
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +0 -180
- package/vscode/src/vs/base/browser/ui/grid/grid.js +0 -494
- package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +0 -6
- package/vscode/src/vs/base/browser/ui/grid/gridview.js +0 -1112
- package/vscode/src/vs/base/common/codicons.d.ts +0 -579
- package/vscode/src/vs/platform/webview/common/mimeTypes.js +0 -24
- package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +0 -64
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +0 -790
- package/vscode/src/vs/workbench/browser/actions/listCommands.js +0 -764
- package/vscode/src/vs/workbench/browser/layout.d.ts +0 -26
- package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +0 -612
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +0 -150
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/compositeBar.js +0 -605
- package/vscode/src/vs/workbench/browser/parts/compositePart.js +0 -335
- package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +0 -223
- package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +0 -1407
- package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +0 -186
- package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +0 -511
- package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +0 -112
- package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +0 -1020
- package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +0 -391
- package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +0 -645
- package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +0 -379
- package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +0 -68
- package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +0 -146
- package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +0 -222
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +0 -299
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +0 -365
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +0 -135
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +0 -17
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +0 -145
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +0 -214
- package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +0 -78
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +0 -63
- package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +0 -119
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +0 -6
- package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +0 -79
- package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +0 -74
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +0 -256
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +0 -99
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +0 -444
- package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +0 -432
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +0 -786
- package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +0 -488
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +0 -522
- package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +0 -152
- package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +0 -63
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +0 -409
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +0 -693
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +0 -240
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +0 -77
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +0 -42
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +0 -71
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +0 -348
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +0 -98
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +0 -146
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +0 -105
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +0 -401
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +0 -197
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +0 -41
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +0 -128
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +0 -612
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +0 -158
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +0 -264
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +0 -173
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +0 -282
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +0 -360
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +0 -133
- package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +0 -290
- package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +0 -96
- package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +0 -88
- package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +0 -79
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +0 -648
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +0 -65
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +0 -59
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +0 -142
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +0 -121
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +0 -68
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +0 -235
- package/vscode/src/vs/workbench/services/activity/browser/activityService.js +0 -145
- package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +0 -670
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +0 -1484
- package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +0 -6
- package/vscode/src/vs/workbench/services/progress/browser/progressService.js +0 -523
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +0 -101
- package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +0 -713
- package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +0 -598
|
@@ -1,670 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { isRelativePattern } from 'vscode/vscode/vs/base/common/glob';
|
|
3
|
-
import { insert, flatten, distinct, firstOrDefault } from 'vscode/vscode/vs/base/common/arrays';
|
|
4
|
-
import { Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
|
-
import { isEqual, extname, basename } from 'vscode/vscode/vs/base/common/resources';
|
|
6
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
7
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
8
|
-
import { EditorResolution, EditorActivation } from 'vscode/vscode/vs/platform/editor/common/editor';
|
|
9
|
-
import { isResourceSideBySideEditorInput, EditorResourceAccessor, SideBySideEditor, isEditorInputWithOptions, DEFAULT_EDITOR_ASSOCIATION, isResourceDiffEditorInput, isEditorInputWithOptionsAndGroup, isResourceMergeEditorInput, isResourceDiffListEditorInput, isUntitledResourceEditorInput } from 'vscode/vscode/vs/workbench/common/editor';
|
|
10
|
-
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
11
|
-
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
12
|
-
import { globMatchesResource, editorsAssociationsSettingId, RegisteredEditorPriority, priorityToRank } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService';
|
|
13
|
-
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
|
|
14
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
15
|
-
import { Severity, INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
|
|
16
|
-
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
17
|
-
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
18
|
-
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
19
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
20
|
-
import { findGroup } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupFinder';
|
|
21
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
22
|
-
import { SideBySideEditorInput } from 'vscode/vscode/vs/workbench/common/editor/sideBySideEditorInput';
|
|
23
|
-
import { PauseableEmitter } from 'vscode/vscode/vs/base/common/event';
|
|
24
|
-
|
|
25
|
-
var EditorResolverService_1;
|
|
26
|
-
let EditorResolverService = class EditorResolverService extends Disposable {
|
|
27
|
-
static { EditorResolverService_1 = this; }
|
|
28
|
-
static { this.configureDefaultID = 'promptOpenWith.configureDefault'; }
|
|
29
|
-
static { this.cacheStorageID = 'editorOverrideService.cache'; }
|
|
30
|
-
static { this.conflictingDefaultsStorageID = 'editorOverrideService.conflictingDefaults'; }
|
|
31
|
-
constructor(editorGroupService, instantiationService, configurationService, quickInputService, notificationService, telemetryService, storageService, extensionService, logService) {
|
|
32
|
-
super();
|
|
33
|
-
this.editorGroupService = editorGroupService;
|
|
34
|
-
this.instantiationService = instantiationService;
|
|
35
|
-
this.configurationService = configurationService;
|
|
36
|
-
this.quickInputService = quickInputService;
|
|
37
|
-
this.notificationService = notificationService;
|
|
38
|
-
this.telemetryService = telemetryService;
|
|
39
|
-
this.storageService = storageService;
|
|
40
|
-
this.extensionService = extensionService;
|
|
41
|
-
this.logService = logService;
|
|
42
|
-
this._onDidChangeEditorRegistrations = this._register(( new PauseableEmitter()));
|
|
43
|
-
this.onDidChangeEditorRegistrations = this._onDidChangeEditorRegistrations.event;
|
|
44
|
-
this._editors = ( new Map());
|
|
45
|
-
this._flattenedEditors = ( new Map());
|
|
46
|
-
this._shouldReFlattenEditors = true;
|
|
47
|
-
this.cache = ( new Set(
|
|
48
|
-
JSON.parse(this.storageService.get(EditorResolverService_1.cacheStorageID, 0 , JSON.stringify([])))
|
|
49
|
-
));
|
|
50
|
-
this.storageService.remove(EditorResolverService_1.cacheStorageID, 0 );
|
|
51
|
-
this._register(this.storageService.onWillSaveState(() => {
|
|
52
|
-
this.cacheEditors();
|
|
53
|
-
}));
|
|
54
|
-
this.extensionService.onDidRegisterExtensions(() => {
|
|
55
|
-
this.cache = undefined;
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
resolveUntypedInputAndGroup(editor, preferredGroup) {
|
|
59
|
-
const untypedEditor = editor;
|
|
60
|
-
const findGroupResult = this.instantiationService.invokeFunction(findGroup, untypedEditor, preferredGroup);
|
|
61
|
-
if (findGroupResult instanceof Promise) {
|
|
62
|
-
return findGroupResult.then(([group, activation]) => [untypedEditor, group, activation]);
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
const [group, activation] = findGroupResult;
|
|
66
|
-
return [untypedEditor, group, activation];
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async resolveEditor(editor, preferredGroup) {
|
|
70
|
-
this._flattenedEditors = this._flattenEditorsMap();
|
|
71
|
-
if (isResourceSideBySideEditorInput(editor)) {
|
|
72
|
-
return this.doResolveSideBySideEditor(editor, preferredGroup);
|
|
73
|
-
}
|
|
74
|
-
let resolvedUntypedAndGroup;
|
|
75
|
-
const resolvedUntypedAndGroupResult = this.resolveUntypedInputAndGroup(editor, preferredGroup);
|
|
76
|
-
if (resolvedUntypedAndGroupResult instanceof Promise) {
|
|
77
|
-
resolvedUntypedAndGroup = await resolvedUntypedAndGroupResult;
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
resolvedUntypedAndGroup = resolvedUntypedAndGroupResult;
|
|
81
|
-
}
|
|
82
|
-
if (!resolvedUntypedAndGroup) {
|
|
83
|
-
return 2 ;
|
|
84
|
-
}
|
|
85
|
-
const [untypedEditor, group, activation] = resolvedUntypedAndGroup;
|
|
86
|
-
if (activation) {
|
|
87
|
-
untypedEditor.options = { ...untypedEditor.options, activation };
|
|
88
|
-
}
|
|
89
|
-
let resource = EditorResourceAccessor.getCanonicalUri(untypedEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
90
|
-
if (this.cache && resource && this.resourceMatchesCache(resource)) {
|
|
91
|
-
await this.extensionService.whenInstalledExtensionsRegistered();
|
|
92
|
-
}
|
|
93
|
-
if (resource === undefined) {
|
|
94
|
-
resource = ( URI.from({ scheme: Schemas.untitled }));
|
|
95
|
-
}
|
|
96
|
-
else if (resource.scheme === undefined || resource === null) {
|
|
97
|
-
return 2 ;
|
|
98
|
-
}
|
|
99
|
-
if (untypedEditor.options?.override === EditorResolution.PICK) {
|
|
100
|
-
const picked = await this.doPickEditor(untypedEditor);
|
|
101
|
-
if (!picked) {
|
|
102
|
-
return 1 ;
|
|
103
|
-
}
|
|
104
|
-
untypedEditor.options = picked;
|
|
105
|
-
}
|
|
106
|
-
let { editor: selectedEditor, conflictingDefault } = this.getEditor(resource, untypedEditor.options?.override);
|
|
107
|
-
if (!selectedEditor && (untypedEditor.options?.override || isEditorInputWithOptions(editor))) {
|
|
108
|
-
return 2 ;
|
|
109
|
-
}
|
|
110
|
-
else if (!selectedEditor) {
|
|
111
|
-
const resolvedEditor = this.getEditor(resource, DEFAULT_EDITOR_ASSOCIATION.id);
|
|
112
|
-
selectedEditor = resolvedEditor?.editor;
|
|
113
|
-
conflictingDefault = resolvedEditor?.conflictingDefault;
|
|
114
|
-
if (!selectedEditor) {
|
|
115
|
-
return 2 ;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
if (isResourceDiffEditorInput(untypedEditor) && untypedEditor.options?.override === undefined) {
|
|
119
|
-
let resource2 = EditorResourceAccessor.getCanonicalUri(untypedEditor, { supportSideBySide: SideBySideEditor.SECONDARY });
|
|
120
|
-
if (!resource2) {
|
|
121
|
-
resource2 = ( URI.from({ scheme: Schemas.untitled }));
|
|
122
|
-
}
|
|
123
|
-
const { editor: selectedEditor2 } = this.getEditor(resource2, undefined);
|
|
124
|
-
if (!selectedEditor2 || selectedEditor.editorInfo.id !== selectedEditor2.editorInfo.id) {
|
|
125
|
-
const { editor: selectedDiff, conflictingDefault: conflictingDefaultDiff } = this.getEditor(resource, DEFAULT_EDITOR_ASSOCIATION.id);
|
|
126
|
-
selectedEditor = selectedDiff;
|
|
127
|
-
conflictingDefault = conflictingDefaultDiff;
|
|
128
|
-
}
|
|
129
|
-
if (!selectedEditor) {
|
|
130
|
-
return 2 ;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
untypedEditor.options = { override: selectedEditor.editorInfo.id, ...untypedEditor.options };
|
|
134
|
-
if (selectedEditor.editorFactoryObject.createDiffEditorInput === undefined && isResourceDiffEditorInput(untypedEditor)) {
|
|
135
|
-
return 2 ;
|
|
136
|
-
}
|
|
137
|
-
const input = await this.doResolveEditor(untypedEditor, group, selectedEditor);
|
|
138
|
-
if (conflictingDefault && input) {
|
|
139
|
-
await this.doHandleConflictingDefaults(resource, selectedEditor.editorInfo.label, untypedEditor, input.editor, group);
|
|
140
|
-
}
|
|
141
|
-
if (input) {
|
|
142
|
-
this.sendEditorResolutionTelemetry(input.editor);
|
|
143
|
-
if (input.editor.editorId !== selectedEditor.editorInfo.id) {
|
|
144
|
-
this.logService.warn(`Editor ID Mismatch: ${input.editor.editorId} !== ${selectedEditor.editorInfo.id}. This will cause bugs. Please ensure editorInput.editorId matches the registered id`);
|
|
145
|
-
}
|
|
146
|
-
return { ...input, group };
|
|
147
|
-
}
|
|
148
|
-
return 1 ;
|
|
149
|
-
}
|
|
150
|
-
async doResolveSideBySideEditor(editor, preferredGroup) {
|
|
151
|
-
const primaryResolvedEditor = await this.resolveEditor(editor.primary, preferredGroup);
|
|
152
|
-
if (!isEditorInputWithOptionsAndGroup(primaryResolvedEditor)) {
|
|
153
|
-
return 2 ;
|
|
154
|
-
}
|
|
155
|
-
const secondaryResolvedEditor = await this.resolveEditor(editor.secondary, primaryResolvedEditor.group ?? preferredGroup);
|
|
156
|
-
if (!isEditorInputWithOptionsAndGroup(secondaryResolvedEditor)) {
|
|
157
|
-
return 2 ;
|
|
158
|
-
}
|
|
159
|
-
return {
|
|
160
|
-
group: primaryResolvedEditor.group ?? secondaryResolvedEditor.group,
|
|
161
|
-
editor: this.instantiationService.createInstance(SideBySideEditorInput, editor.label, editor.description, secondaryResolvedEditor.editor, primaryResolvedEditor.editor),
|
|
162
|
-
options: editor.options
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
bufferChangeEvents(callback) {
|
|
166
|
-
this._onDidChangeEditorRegistrations.pause();
|
|
167
|
-
try {
|
|
168
|
-
callback();
|
|
169
|
-
}
|
|
170
|
-
finally {
|
|
171
|
-
this._onDidChangeEditorRegistrations.resume();
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
registerEditor(globPattern, editorInfo, options, editorFactoryObject) {
|
|
175
|
-
let registeredEditor = this._editors.get(globPattern);
|
|
176
|
-
if (registeredEditor === undefined) {
|
|
177
|
-
registeredEditor = ( new Map());
|
|
178
|
-
this._editors.set(globPattern, registeredEditor);
|
|
179
|
-
}
|
|
180
|
-
let editorsWithId = registeredEditor.get(editorInfo.id);
|
|
181
|
-
if (editorsWithId === undefined) {
|
|
182
|
-
editorsWithId = [];
|
|
183
|
-
}
|
|
184
|
-
const remove = insert(editorsWithId, {
|
|
185
|
-
globPattern,
|
|
186
|
-
editorInfo,
|
|
187
|
-
options,
|
|
188
|
-
editorFactoryObject
|
|
189
|
-
});
|
|
190
|
-
registeredEditor.set(editorInfo.id, editorsWithId);
|
|
191
|
-
this._shouldReFlattenEditors = true;
|
|
192
|
-
this._onDidChangeEditorRegistrations.fire();
|
|
193
|
-
return toDisposable(() => {
|
|
194
|
-
remove();
|
|
195
|
-
if (editorsWithId && editorsWithId.length === 0) {
|
|
196
|
-
registeredEditor?.delete(editorInfo.id);
|
|
197
|
-
}
|
|
198
|
-
this._shouldReFlattenEditors = true;
|
|
199
|
-
this._onDidChangeEditorRegistrations.fire();
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
getAssociationsForResource(resource) {
|
|
203
|
-
const associations = this.getAllUserAssociations();
|
|
204
|
-
let matchingAssociations = associations.filter(association => association.filenamePattern && globMatchesResource(association.filenamePattern, resource));
|
|
205
|
-
matchingAssociations = matchingAssociations.sort((a, b) => (b.filenamePattern?.length ?? 0) - (a.filenamePattern?.length ?? 0));
|
|
206
|
-
const allEditors = this._registeredEditors;
|
|
207
|
-
return matchingAssociations.filter(association => allEditors.find(c => c.editorInfo.id === association.viewType));
|
|
208
|
-
}
|
|
209
|
-
getAllUserAssociations() {
|
|
210
|
-
const inspectedEditorAssociations = this.configurationService.inspect(editorsAssociationsSettingId) || {};
|
|
211
|
-
const defaultAssociations = inspectedEditorAssociations.defaultValue ?? {};
|
|
212
|
-
const workspaceAssociations = inspectedEditorAssociations.workspaceValue ?? {};
|
|
213
|
-
const userAssociations = inspectedEditorAssociations.userValue ?? {};
|
|
214
|
-
const rawAssociations = { ...workspaceAssociations };
|
|
215
|
-
for (const [key, value] of Object.entries({ ...defaultAssociations, ...userAssociations })) {
|
|
216
|
-
if (rawAssociations[key] === undefined) {
|
|
217
|
-
rawAssociations[key] = value;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
const associations = [];
|
|
221
|
-
for (const [key, value] of Object.entries(rawAssociations)) {
|
|
222
|
-
const association = {
|
|
223
|
-
filenamePattern: key,
|
|
224
|
-
viewType: value
|
|
225
|
-
};
|
|
226
|
-
associations.push(association);
|
|
227
|
-
}
|
|
228
|
-
return associations;
|
|
229
|
-
}
|
|
230
|
-
_flattenEditorsMap() {
|
|
231
|
-
if (!this._shouldReFlattenEditors) {
|
|
232
|
-
return this._flattenedEditors;
|
|
233
|
-
}
|
|
234
|
-
this._shouldReFlattenEditors = false;
|
|
235
|
-
const editors = ( new Map());
|
|
236
|
-
for (const [glob, value] of this._editors) {
|
|
237
|
-
const registeredEditors = [];
|
|
238
|
-
for (const editors of ( value.values())) {
|
|
239
|
-
let registeredEditor = undefined;
|
|
240
|
-
for (const editor of editors) {
|
|
241
|
-
if (!registeredEditor) {
|
|
242
|
-
registeredEditor = {
|
|
243
|
-
editorInfo: editor.editorInfo,
|
|
244
|
-
globPattern: editor.globPattern,
|
|
245
|
-
options: {},
|
|
246
|
-
editorFactoryObject: {}
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
registeredEditor.options = { ...registeredEditor.options, ...editor.options };
|
|
250
|
-
registeredEditor.editorFactoryObject = { ...registeredEditor.editorFactoryObject, ...editor.editorFactoryObject };
|
|
251
|
-
}
|
|
252
|
-
if (registeredEditor) {
|
|
253
|
-
registeredEditors.push(registeredEditor);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
editors.set(glob, registeredEditors);
|
|
257
|
-
}
|
|
258
|
-
return editors;
|
|
259
|
-
}
|
|
260
|
-
get _registeredEditors() {
|
|
261
|
-
return flatten(Array.from(( this._flattenedEditors.values())));
|
|
262
|
-
}
|
|
263
|
-
updateUserAssociations(globPattern, editorID) {
|
|
264
|
-
const newAssociation = { viewType: editorID, filenamePattern: globPattern };
|
|
265
|
-
const currentAssociations = this.getAllUserAssociations();
|
|
266
|
-
const newSettingObject = Object.create(null);
|
|
267
|
-
for (const association of [...currentAssociations, newAssociation]) {
|
|
268
|
-
if (association.filenamePattern) {
|
|
269
|
-
newSettingObject[association.filenamePattern] = association.viewType;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
this.configurationService.updateValue(editorsAssociationsSettingId, newSettingObject);
|
|
273
|
-
}
|
|
274
|
-
findMatchingEditors(resource) {
|
|
275
|
-
const userSettings = this.getAssociationsForResource(resource);
|
|
276
|
-
const matchingEditors = [];
|
|
277
|
-
for (const [key, editors] of this._flattenedEditors) {
|
|
278
|
-
for (const editor of editors) {
|
|
279
|
-
const foundInSettings = userSettings.find(setting => setting.viewType === editor.editorInfo.id);
|
|
280
|
-
if ((foundInSettings && editor.editorInfo.priority !== RegisteredEditorPriority.exclusive) || globMatchesResource(key, resource)) {
|
|
281
|
-
matchingEditors.push(editor);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
return matchingEditors.sort((a, b) => {
|
|
286
|
-
if (priorityToRank(b.editorInfo.priority) === priorityToRank(a.editorInfo.priority) && typeof b.globPattern === 'string' && typeof a.globPattern === 'string') {
|
|
287
|
-
return b.globPattern.length - a.globPattern.length;
|
|
288
|
-
}
|
|
289
|
-
return priorityToRank(b.editorInfo.priority) - priorityToRank(a.editorInfo.priority);
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
getEditors(resource) {
|
|
293
|
-
this._flattenedEditors = this._flattenEditorsMap();
|
|
294
|
-
if (URI.isUri(resource)) {
|
|
295
|
-
const editors = this.findMatchingEditors(resource);
|
|
296
|
-
if (editors.find(e => e.editorInfo.priority === RegisteredEditorPriority.exclusive)) {
|
|
297
|
-
return [];
|
|
298
|
-
}
|
|
299
|
-
return ( editors.map(editor => editor.editorInfo));
|
|
300
|
-
}
|
|
301
|
-
return distinct(( this._registeredEditors.map(editor => editor.editorInfo)), editor => editor.id);
|
|
302
|
-
}
|
|
303
|
-
getEditor(resource, editorId) {
|
|
304
|
-
const findMatchingEditor = (editors, viewType) => {
|
|
305
|
-
return editors.find((editor) => {
|
|
306
|
-
if (editor.options && editor.options.canSupportResource !== undefined) {
|
|
307
|
-
return editor.editorInfo.id === viewType && editor.options.canSupportResource(resource);
|
|
308
|
-
}
|
|
309
|
-
return editor.editorInfo.id === viewType;
|
|
310
|
-
});
|
|
311
|
-
};
|
|
312
|
-
if (editorId && editorId !== EditorResolution.EXCLUSIVE_ONLY) {
|
|
313
|
-
const registeredEditors = this._registeredEditors;
|
|
314
|
-
return {
|
|
315
|
-
editor: findMatchingEditor(registeredEditors, editorId),
|
|
316
|
-
conflictingDefault: false
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
const editors = this.findMatchingEditors(resource);
|
|
320
|
-
const associationsFromSetting = this.getAssociationsForResource(resource);
|
|
321
|
-
const minPriority = editorId === EditorResolution.EXCLUSIVE_ONLY ? RegisteredEditorPriority.exclusive : RegisteredEditorPriority.builtin;
|
|
322
|
-
let possibleEditors = editors.filter(editor => priorityToRank(editor.editorInfo.priority) >= priorityToRank(minPriority) && editor.editorInfo.id !== DEFAULT_EDITOR_ASSOCIATION.id);
|
|
323
|
-
if (possibleEditors.length === 0) {
|
|
324
|
-
return {
|
|
325
|
-
editor: associationsFromSetting[0] && minPriority !== RegisteredEditorPriority.exclusive ? findMatchingEditor(editors, associationsFromSetting[0].viewType) : undefined,
|
|
326
|
-
conflictingDefault: false
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
const selectedViewType = possibleEditors[0].editorInfo.priority === RegisteredEditorPriority.exclusive ?
|
|
330
|
-
possibleEditors[0].editorInfo.id :
|
|
331
|
-
associationsFromSetting[0]?.viewType || possibleEditors[0].editorInfo.id;
|
|
332
|
-
let conflictingDefault = false;
|
|
333
|
-
possibleEditors = possibleEditors.filter(editor => editor.editorInfo.priority !== RegisteredEditorPriority.exclusive);
|
|
334
|
-
if (associationsFromSetting.length === 0 && possibleEditors.length > 1) {
|
|
335
|
-
conflictingDefault = true;
|
|
336
|
-
}
|
|
337
|
-
return {
|
|
338
|
-
editor: findMatchingEditor(editors, selectedViewType),
|
|
339
|
-
conflictingDefault
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
async doResolveEditor(editor, group, selectedEditor) {
|
|
343
|
-
let options = editor.options;
|
|
344
|
-
const resource = EditorResourceAccessor.getCanonicalUri(editor, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
345
|
-
if (options && typeof options.activation === 'undefined') {
|
|
346
|
-
options = { ...options, activation: options.preserveFocus ? EditorActivation.RESTORE : undefined };
|
|
347
|
-
}
|
|
348
|
-
if (isResourceMergeEditorInput(editor)) {
|
|
349
|
-
if (!selectedEditor.editorFactoryObject.createMergeEditorInput) {
|
|
350
|
-
return;
|
|
351
|
-
}
|
|
352
|
-
const inputWithOptions = await selectedEditor.editorFactoryObject.createMergeEditorInput(editor, group);
|
|
353
|
-
return { editor: inputWithOptions.editor, options: inputWithOptions.options ?? options };
|
|
354
|
-
}
|
|
355
|
-
if (isResourceDiffEditorInput(editor)) {
|
|
356
|
-
if (!selectedEditor.editorFactoryObject.createDiffEditorInput) {
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
const inputWithOptions = await selectedEditor.editorFactoryObject.createDiffEditorInput(editor, group);
|
|
360
|
-
return { editor: inputWithOptions.editor, options: inputWithOptions.options ?? options };
|
|
361
|
-
}
|
|
362
|
-
if (isResourceDiffListEditorInput(editor)) {
|
|
363
|
-
if (!selectedEditor.editorFactoryObject.createMultiDiffEditorInput) {
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
|
-
const inputWithOptions = await selectedEditor.editorFactoryObject.createMultiDiffEditorInput(editor, group);
|
|
367
|
-
return { editor: inputWithOptions.editor, options: inputWithOptions.options ?? options };
|
|
368
|
-
}
|
|
369
|
-
if (isResourceSideBySideEditorInput(editor)) {
|
|
370
|
-
throw new Error(`Untyped side by side editor input not supported here.`);
|
|
371
|
-
}
|
|
372
|
-
if (isUntitledResourceEditorInput(editor)) {
|
|
373
|
-
if (!selectedEditor.editorFactoryObject.createUntitledEditorInput) {
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
const inputWithOptions = await selectedEditor.editorFactoryObject.createUntitledEditorInput(editor, group);
|
|
377
|
-
return { editor: inputWithOptions.editor, options: inputWithOptions.options ?? options };
|
|
378
|
-
}
|
|
379
|
-
if (resource === undefined) {
|
|
380
|
-
throw new Error(`Undefined resource on non untitled editor input.`);
|
|
381
|
-
}
|
|
382
|
-
const singleEditorPerResource = typeof selectedEditor.options?.singlePerResource === 'function' ? selectedEditor.options.singlePerResource() : selectedEditor.options?.singlePerResource;
|
|
383
|
-
if (singleEditorPerResource) {
|
|
384
|
-
const foundInput = await this.moveExistingEditorForResource(resource, selectedEditor.editorInfo.id, group);
|
|
385
|
-
if (foundInput) {
|
|
386
|
-
return { editor: foundInput, options };
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
if (!selectedEditor.editorFactoryObject.createEditorInput) {
|
|
390
|
-
return;
|
|
391
|
-
}
|
|
392
|
-
const inputWithOptions = await selectedEditor.editorFactoryObject.createEditorInput(editor, group);
|
|
393
|
-
options = inputWithOptions.options ?? options;
|
|
394
|
-
const input = inputWithOptions.editor;
|
|
395
|
-
return { editor: input, options };
|
|
396
|
-
}
|
|
397
|
-
async moveExistingEditorForResource(resource, viewType, targetGroup) {
|
|
398
|
-
const editorInfoForResource = this.findExistingEditorsForResource(resource, viewType);
|
|
399
|
-
if (!editorInfoForResource.length) {
|
|
400
|
-
return;
|
|
401
|
-
}
|
|
402
|
-
const editorToUse = editorInfoForResource[0];
|
|
403
|
-
for (const { editor, group } of editorInfoForResource) {
|
|
404
|
-
if (editor !== editorToUse.editor) {
|
|
405
|
-
const closed = await group.closeEditor(editor);
|
|
406
|
-
if (!closed) {
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
if (targetGroup.id !== editorToUse.group.id) {
|
|
412
|
-
editorToUse.group.moveEditor(editorToUse.editor, targetGroup);
|
|
413
|
-
return editorToUse.editor;
|
|
414
|
-
}
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
417
|
-
findExistingEditorsForResource(resource, editorId) {
|
|
418
|
-
const out = [];
|
|
419
|
-
const orderedGroups = distinct([
|
|
420
|
-
...this.editorGroupService.groups,
|
|
421
|
-
]);
|
|
422
|
-
for (const group of orderedGroups) {
|
|
423
|
-
for (const editor of group.editors) {
|
|
424
|
-
if (isEqual(editor.resource, resource) && editor.editorId === editorId) {
|
|
425
|
-
out.push({ editor, group });
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
return out;
|
|
430
|
-
}
|
|
431
|
-
async doHandleConflictingDefaults(resource, editorName, untypedInput, currentEditor, group) {
|
|
432
|
-
const editors = this.findMatchingEditors(resource);
|
|
433
|
-
const storedChoices = JSON.parse(this.storageService.get(EditorResolverService_1.conflictingDefaultsStorageID, 0 , '{}'));
|
|
434
|
-
const globForResource = `*${extname(resource)}`;
|
|
435
|
-
const writeCurrentEditorsToStorage = () => {
|
|
436
|
-
storedChoices[globForResource] = [];
|
|
437
|
-
editors.forEach(editor => storedChoices[globForResource].push(editor.editorInfo.id));
|
|
438
|
-
this.storageService.store(EditorResolverService_1.conflictingDefaultsStorageID, JSON.stringify(storedChoices), 0 , 1 );
|
|
439
|
-
};
|
|
440
|
-
if (storedChoices[globForResource] && storedChoices[globForResource].find(editorID => editorID === currentEditor.editorId)) {
|
|
441
|
-
return;
|
|
442
|
-
}
|
|
443
|
-
const handle = this.notificationService.prompt(Severity.Warning, ( localizeWithPath(
|
|
444
|
-
'vs/workbench/services/editor/browser/editorResolverService',
|
|
445
|
-
'editorResolver.conflictingDefaults',
|
|
446
|
-
'There are multiple default editors available for the resource.'
|
|
447
|
-
)), [{
|
|
448
|
-
label: ( localizeWithPath(
|
|
449
|
-
'vs/workbench/services/editor/browser/editorResolverService',
|
|
450
|
-
'editorResolver.configureDefault',
|
|
451
|
-
'Configure Default'
|
|
452
|
-
)),
|
|
453
|
-
run: async () => {
|
|
454
|
-
const picked = await this.doPickEditor(untypedInput, true);
|
|
455
|
-
if (!picked) {
|
|
456
|
-
return;
|
|
457
|
-
}
|
|
458
|
-
untypedInput.options = picked;
|
|
459
|
-
const replacementEditor = await this.resolveEditor(untypedInput, group);
|
|
460
|
-
if (replacementEditor === 1 || replacementEditor === 2 ) {
|
|
461
|
-
return;
|
|
462
|
-
}
|
|
463
|
-
group.replaceEditors([
|
|
464
|
-
{
|
|
465
|
-
editor: currentEditor,
|
|
466
|
-
replacement: replacementEditor.editor,
|
|
467
|
-
options: replacementEditor.options ?? picked,
|
|
468
|
-
}
|
|
469
|
-
]);
|
|
470
|
-
}
|
|
471
|
-
},
|
|
472
|
-
{
|
|
473
|
-
label: ( localizeWithPath(
|
|
474
|
-
'vs/workbench/services/editor/browser/editorResolverService',
|
|
475
|
-
'editorResolver.keepDefault',
|
|
476
|
-
'Keep {0}',
|
|
477
|
-
editorName
|
|
478
|
-
)),
|
|
479
|
-
run: writeCurrentEditorsToStorage
|
|
480
|
-
}
|
|
481
|
-
]);
|
|
482
|
-
const onCloseListener = handle.onDidClose(() => {
|
|
483
|
-
writeCurrentEditorsToStorage();
|
|
484
|
-
onCloseListener.dispose();
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
mapEditorsToQuickPickEntry(resource, showDefaultPicker) {
|
|
488
|
-
const currentEditor = firstOrDefault(this.editorGroupService.activeGroup.findEditors(resource));
|
|
489
|
-
let registeredEditors = resource.scheme === Schemas.untitled ? this._registeredEditors.filter(e => e.editorInfo.priority !== RegisteredEditorPriority.exclusive) : this.findMatchingEditors(resource);
|
|
490
|
-
registeredEditors = distinct(registeredEditors, c => c.editorInfo.id);
|
|
491
|
-
const defaultSetting = this.getAssociationsForResource(resource)[0]?.viewType;
|
|
492
|
-
registeredEditors = registeredEditors.sort((a, b) => {
|
|
493
|
-
if (a.editorInfo.id === DEFAULT_EDITOR_ASSOCIATION.id) {
|
|
494
|
-
return -1;
|
|
495
|
-
}
|
|
496
|
-
else if (b.editorInfo.id === DEFAULT_EDITOR_ASSOCIATION.id) {
|
|
497
|
-
return 1;
|
|
498
|
-
}
|
|
499
|
-
else {
|
|
500
|
-
return priorityToRank(b.editorInfo.priority) - priorityToRank(a.editorInfo.priority);
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
const quickPickEntries = [];
|
|
504
|
-
const currentlyActiveLabel = ( localizeWithPath(
|
|
505
|
-
'vs/workbench/services/editor/browser/editorResolverService',
|
|
506
|
-
'promptOpenWith.currentlyActive',
|
|
507
|
-
"Active"
|
|
508
|
-
));
|
|
509
|
-
const currentDefaultLabel = ( localizeWithPath(
|
|
510
|
-
'vs/workbench/services/editor/browser/editorResolverService',
|
|
511
|
-
'promptOpenWith.currentDefault',
|
|
512
|
-
"Default"
|
|
513
|
-
));
|
|
514
|
-
const currentDefaultAndActiveLabel = ( localizeWithPath(
|
|
515
|
-
'vs/workbench/services/editor/browser/editorResolverService',
|
|
516
|
-
'promptOpenWith.currentDefaultAndActive',
|
|
517
|
-
"Active and Default"
|
|
518
|
-
));
|
|
519
|
-
let defaultViewType = defaultSetting;
|
|
520
|
-
if (!defaultViewType && registeredEditors.length > 2 && registeredEditors[1]?.editorInfo.priority !== RegisteredEditorPriority.option) {
|
|
521
|
-
defaultViewType = registeredEditors[1]?.editorInfo.id;
|
|
522
|
-
}
|
|
523
|
-
if (!defaultViewType) {
|
|
524
|
-
defaultViewType = DEFAULT_EDITOR_ASSOCIATION.id;
|
|
525
|
-
}
|
|
526
|
-
registeredEditors.forEach(editor => {
|
|
527
|
-
const currentViewType = currentEditor?.editorId ?? DEFAULT_EDITOR_ASSOCIATION.id;
|
|
528
|
-
const isActive = currentEditor ? editor.editorInfo.id === currentViewType : false;
|
|
529
|
-
const isDefault = editor.editorInfo.id === defaultViewType;
|
|
530
|
-
const quickPickEntry = {
|
|
531
|
-
id: editor.editorInfo.id,
|
|
532
|
-
label: editor.editorInfo.label,
|
|
533
|
-
description: isActive && isDefault ? currentDefaultAndActiveLabel : isActive ? currentlyActiveLabel : isDefault ? currentDefaultLabel : undefined,
|
|
534
|
-
detail: editor.editorInfo.detail ?? editor.editorInfo.priority,
|
|
535
|
-
};
|
|
536
|
-
quickPickEntries.push(quickPickEntry);
|
|
537
|
-
});
|
|
538
|
-
if (!showDefaultPicker && extname(resource) !== '') {
|
|
539
|
-
const separator = { type: 'separator' };
|
|
540
|
-
quickPickEntries.push(separator);
|
|
541
|
-
const configureDefaultEntry = {
|
|
542
|
-
id: EditorResolverService_1.configureDefaultID,
|
|
543
|
-
label: ( localizeWithPath(
|
|
544
|
-
'vs/workbench/services/editor/browser/editorResolverService',
|
|
545
|
-
'promptOpenWith.configureDefault',
|
|
546
|
-
"Configure default editor for '{0}'...",
|
|
547
|
-
`*${extname(resource)}`
|
|
548
|
-
)),
|
|
549
|
-
};
|
|
550
|
-
quickPickEntries.push(configureDefaultEntry);
|
|
551
|
-
}
|
|
552
|
-
return quickPickEntries;
|
|
553
|
-
}
|
|
554
|
-
async doPickEditor(editor, showDefaultPicker) {
|
|
555
|
-
let resource = EditorResourceAccessor.getOriginalUri(editor, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
556
|
-
if (resource === undefined) {
|
|
557
|
-
resource = ( URI.from({ scheme: Schemas.untitled }));
|
|
558
|
-
}
|
|
559
|
-
const editorPicks = this.mapEditorsToQuickPickEntry(resource, showDefaultPicker);
|
|
560
|
-
const editorPicker = this.quickInputService.createQuickPick();
|
|
561
|
-
const placeHolderMessage = showDefaultPicker ?
|
|
562
|
-
( localizeWithPath(
|
|
563
|
-
'vs/workbench/services/editor/browser/editorResolverService',
|
|
564
|
-
'promptOpenWith.updateDefaultPlaceHolder',
|
|
565
|
-
"Select new default editor for '{0}'",
|
|
566
|
-
`*${extname(resource)}`
|
|
567
|
-
)) :
|
|
568
|
-
( localizeWithPath(
|
|
569
|
-
'vs/workbench/services/editor/browser/editorResolverService',
|
|
570
|
-
'promptOpenWith.placeHolder',
|
|
571
|
-
"Select editor for '{0}'",
|
|
572
|
-
basename(resource)
|
|
573
|
-
));
|
|
574
|
-
editorPicker.placeholder = placeHolderMessage;
|
|
575
|
-
editorPicker.canAcceptInBackground = true;
|
|
576
|
-
editorPicker.items = editorPicks;
|
|
577
|
-
const firstItem = editorPicker.items.find(item => item.type === 'item');
|
|
578
|
-
if (firstItem) {
|
|
579
|
-
editorPicker.selectedItems = [firstItem];
|
|
580
|
-
}
|
|
581
|
-
const picked = await ( new Promise(resolve => {
|
|
582
|
-
editorPicker.onDidAccept(e => {
|
|
583
|
-
let result = undefined;
|
|
584
|
-
if (editorPicker.selectedItems.length === 1) {
|
|
585
|
-
result = {
|
|
586
|
-
item: editorPicker.selectedItems[0],
|
|
587
|
-
keyMods: editorPicker.keyMods,
|
|
588
|
-
openInBackground: e.inBackground
|
|
589
|
-
};
|
|
590
|
-
}
|
|
591
|
-
if (resource && showDefaultPicker && result?.item.id) {
|
|
592
|
-
this.updateUserAssociations(`*${extname(resource)}`, result.item.id);
|
|
593
|
-
}
|
|
594
|
-
resolve(result);
|
|
595
|
-
});
|
|
596
|
-
editorPicker.onDidHide(() => resolve(undefined));
|
|
597
|
-
editorPicker.onDidTriggerItemButton(e => {
|
|
598
|
-
resolve({ item: e.item, openInBackground: false });
|
|
599
|
-
if (resource && e.item && e.item.id) {
|
|
600
|
-
this.updateUserAssociations(`*${extname(resource)}`, e.item.id);
|
|
601
|
-
}
|
|
602
|
-
});
|
|
603
|
-
editorPicker.show();
|
|
604
|
-
}));
|
|
605
|
-
editorPicker.dispose();
|
|
606
|
-
if (picked) {
|
|
607
|
-
if (picked.item.id === EditorResolverService_1.configureDefaultID) {
|
|
608
|
-
return this.doPickEditor(editor, true);
|
|
609
|
-
}
|
|
610
|
-
const targetOptions = {
|
|
611
|
-
...editor.options,
|
|
612
|
-
override: picked.item.id,
|
|
613
|
-
preserveFocus: picked.openInBackground || editor.options?.preserveFocus,
|
|
614
|
-
};
|
|
615
|
-
return targetOptions;
|
|
616
|
-
}
|
|
617
|
-
return undefined;
|
|
618
|
-
}
|
|
619
|
-
sendEditorResolutionTelemetry(chosenInput) {
|
|
620
|
-
if (chosenInput.editorId) {
|
|
621
|
-
this.telemetryService.publicLog2('override.viewType', { viewType: chosenInput.editorId });
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
cacheEditors() {
|
|
625
|
-
const cacheStorage = ( new Set());
|
|
626
|
-
for (const [globPattern, contribPoint] of this._flattenedEditors) {
|
|
627
|
-
const nonOptional = !!contribPoint.find(c => c.editorInfo.priority !== RegisteredEditorPriority.option && c.editorInfo.id !== DEFAULT_EDITOR_ASSOCIATION.id);
|
|
628
|
-
if (!nonOptional) {
|
|
629
|
-
continue;
|
|
630
|
-
}
|
|
631
|
-
if (isRelativePattern(globPattern)) {
|
|
632
|
-
cacheStorage.add(`${globPattern.pattern}`);
|
|
633
|
-
}
|
|
634
|
-
else {
|
|
635
|
-
cacheStorage.add(globPattern);
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
const userAssociations = this.getAllUserAssociations();
|
|
639
|
-
for (const association of userAssociations) {
|
|
640
|
-
if (association.filenamePattern) {
|
|
641
|
-
cacheStorage.add(association.filenamePattern);
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
this.storageService.store(EditorResolverService_1.cacheStorageID, JSON.stringify(Array.from(cacheStorage)), 0 , 1 );
|
|
645
|
-
}
|
|
646
|
-
resourceMatchesCache(resource) {
|
|
647
|
-
if (!this.cache) {
|
|
648
|
-
return false;
|
|
649
|
-
}
|
|
650
|
-
for (const cacheEntry of this.cache) {
|
|
651
|
-
if (globMatchesResource(cacheEntry, resource)) {
|
|
652
|
-
return true;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
return false;
|
|
656
|
-
}
|
|
657
|
-
};
|
|
658
|
-
EditorResolverService = EditorResolverService_1 = ( __decorate([
|
|
659
|
-
( __param(0, IEditorGroupsService)),
|
|
660
|
-
( __param(1, IInstantiationService)),
|
|
661
|
-
( __param(2, IConfigurationService)),
|
|
662
|
-
( __param(3, IQuickInputService)),
|
|
663
|
-
( __param(4, INotificationService)),
|
|
664
|
-
( __param(5, ITelemetryService)),
|
|
665
|
-
( __param(6, IStorageService)),
|
|
666
|
-
( __param(7, IExtensionService)),
|
|
667
|
-
( __param(8, ILogService))
|
|
668
|
-
], EditorResolverService));
|
|
669
|
-
|
|
670
|
-
export { EditorResolverService };
|