@codingame/monaco-vscode-view-common-service-override 31.0.0 → 32.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +3 -0
- package/package.json +3 -3
- package/service-override/vs/workbench/contrib/webview/browser/pre/service-worker.js +107 -88
- package/vscode/src/vs/sessions/common/theme.d.ts +21 -0
- package/vscode/src/vs/sessions/common/theme.js +126 -0
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +56 -56
- package/vscode/src/vs/workbench/browser/actions/helpActions.js +20 -20
- package/vscode/src/vs/workbench/browser/actions/listCommands.js +3 -3
- package/vscode/src/vs/workbench/browser/actions/navigationActions.js +6 -6
- package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +173 -168
- package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.d.ts +1 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +31 -10
- package/vscode/src/vs/workbench/browser/parts/titlebar/menubar.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/browser/parts/titlebar/menubar.contribution.js +78 -0
- package/vscode/src/vs/workbench/browser/workbench.zenMode.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/browser/workbench.zenMode.contribution.js +140 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +12 -12
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +3 -3
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +3 -3
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +8 -2
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +84 -1
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.d.ts +11 -1
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +184 -19
- package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +9 -5
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditor.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditor.js +9 -2
- package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.d.ts +27 -1
- package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +44 -12
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.js +7 -7
- package/vscode/src/vs/workbench/contrib/limitIndicator/browser/limitIndicator.contribution.js +8 -8
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +29 -29
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +14 -14
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorAccessibilityHelp.js +5 -5
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +13 -13
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +20 -20
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +1 -1
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +3 -3
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +10 -10
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +3 -3
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +1 -1
- package/vscode/src/vs/workbench/contrib/preferences/browser/keyboardLayoutPicker.js +12 -12
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.contribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/scrollLocking/browser/scrollLocking.js +7 -7
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +10 -10
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +3 -3
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +3 -3
- package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +16 -8
- package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.d.ts +9 -5
- package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +22 -5
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.d.ts +4 -7
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +133 -32
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +5 -5
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.d.ts +0 -5
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +5 -27
- package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.d.ts +15 -7
- package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +129 -55
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +9 -9
- package/vscode/src/vs/workbench/services/progress/browser/progressService.js +7 -7
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +1 -2
- package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.d.ts +3 -2
- package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +31 -33
- package/vscode/src/vs/workbench/services/views/browser/viewsService.js +9 -9
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
|
|
2
2
|
import { Disposable, IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
3
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
4
|
+
import { ITextResourceConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration.service";
|
|
4
5
|
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
5
6
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
6
7
|
import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
|
|
@@ -11,12 +12,15 @@ import { IEditorGroupsService } from "@codingame/monaco-vscode-api/vscode/vs/wor
|
|
|
11
12
|
import { IEditorType } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorResolverService";
|
|
12
13
|
import { IEditorResolverService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorResolverService.service";
|
|
13
14
|
import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
|
|
15
|
+
import { IExtensionService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service";
|
|
14
16
|
export declare class CustomEditorService extends Disposable implements ICustomEditorService {
|
|
15
17
|
private readonly editorService;
|
|
16
18
|
private readonly editorGroupService;
|
|
17
19
|
private readonly instantiationService;
|
|
18
20
|
private readonly uriIdentityService;
|
|
19
21
|
private readonly editorResolverService;
|
|
22
|
+
private readonly textResourceConfigurationService;
|
|
23
|
+
private readonly extensionService;
|
|
20
24
|
_serviceBrand: any;
|
|
21
25
|
private readonly _contributedEditors;
|
|
22
26
|
private _untitledCounter;
|
|
@@ -26,11 +30,15 @@ export declare class CustomEditorService extends Disposable implements ICustomEd
|
|
|
26
30
|
private readonly _onDidChangeEditorTypes;
|
|
27
31
|
readonly onDidChangeEditorTypes: Event<void>;
|
|
28
32
|
private readonly _fileEditorFactory;
|
|
29
|
-
constructor(fileService: IFileService, storageService: IStorageService, editorService: IEditorService, editorGroupService: IEditorGroupsService, instantiationService: IInstantiationService, uriIdentityService: IUriIdentityService, editorResolverService: IEditorResolverService);
|
|
33
|
+
constructor(fileService: IFileService, storageService: IStorageService, editorService: IEditorService, editorGroupService: IEditorGroupsService, instantiationService: IInstantiationService, uriIdentityService: IUriIdentityService, editorResolverService: IEditorResolverService, textResourceConfigurationService: ITextResourceConfigurationService, extensionService: IExtensionService);
|
|
30
34
|
getEditorTypes(): IEditorType[];
|
|
31
35
|
private withActiveCustomEditor;
|
|
36
|
+
private getActiveCustomEditorUndoRedoInput;
|
|
32
37
|
private registerContributionPoints;
|
|
33
38
|
private createDiffEditorInput;
|
|
39
|
+
private getDiffEditorLayout;
|
|
40
|
+
private updateCustomDiffEditorsForDiffConfigurationChange;
|
|
41
|
+
private getCustomEditorDiffInputInfo;
|
|
34
42
|
get models(): ICustomEditorModelManager;
|
|
35
43
|
getCustomEditor(viewType: string): CustomEditorInfo | undefined;
|
|
36
44
|
getContributedCustomEditors(resource: URI): CustomEditorInfoCollection;
|
|
@@ -39,6 +47,8 @@ export declare class CustomEditorService extends Disposable implements ICustomEd
|
|
|
39
47
|
registerCustomEditorCapabilities(viewType: string, options: CustomEditorCapabilities): IDisposable;
|
|
40
48
|
getCustomEditorCapabilities(viewType: string): CustomEditorCapabilities | undefined;
|
|
41
49
|
private getActiveCustomEditorId;
|
|
50
|
+
private getActiveCustomEditorDiffCanToggleLayout;
|
|
51
|
+
private getActiveCustomEditorTextDiff;
|
|
42
52
|
private getCustomEditorIsEditable;
|
|
43
53
|
private handleMovedFileInOpenedFileEditors;
|
|
44
54
|
}
|
|
@@ -9,7 +9,9 @@ import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/netw
|
|
|
9
9
|
import { extname, isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
10
10
|
import { assertReturnsDefined } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
11
11
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
12
|
+
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
12
13
|
import { UndoCommand, RedoCommand } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorExtensions';
|
|
14
|
+
import { ITextResourceConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration.service';
|
|
13
15
|
import { FileOperation } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
|
|
14
16
|
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
15
17
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
@@ -18,13 +20,16 @@ import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform
|
|
|
18
20
|
import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
19
21
|
import { EditorExtensions, DEFAULT_EDITOR_ASSOCIATION } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
20
22
|
import { DiffEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/diffEditorInput';
|
|
21
|
-
import {
|
|
23
|
+
import { ActiveCustomEditorDiffCanToggleLayoutContext, ActiveCustomEditorTextDiffContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contextkeys';
|
|
24
|
+
import { CONTEXT_ACTIVE_CUSTOM_EDITOR_ID, CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE, CustomEditorDiffEditorLayout, CustomEditorInfoCollection } from '../common/customEditor.js';
|
|
22
25
|
import { CustomEditorModelManager } from '../common/customEditorModelManager.js';
|
|
23
26
|
import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
24
27
|
import { RegisteredEditorPriority } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorResolverService';
|
|
25
28
|
import { IEditorResolverService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorResolverService.service';
|
|
26
29
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
30
|
+
import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
27
31
|
import { ContributedCustomEditors } from '../common/contributedCustomEditors.js';
|
|
32
|
+
import { CustomEditorDiffInput, CustomEditorSideBySideDiffInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/customEditor/browser/customEditorDiffInput';
|
|
28
33
|
import { CustomEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/customEditor/browser/customEditorInput';
|
|
29
34
|
|
|
30
35
|
registerCss(customEditor);
|
|
@@ -36,7 +41,9 @@ let CustomEditorService = class CustomEditorService extends Disposable {
|
|
|
36
41
|
editorGroupService,
|
|
37
42
|
instantiationService,
|
|
38
43
|
uriIdentityService,
|
|
39
|
-
editorResolverService
|
|
44
|
+
editorResolverService,
|
|
45
|
+
textResourceConfigurationService,
|
|
46
|
+
extensionService
|
|
40
47
|
) {
|
|
41
48
|
super();
|
|
42
49
|
this.editorService = editorService;
|
|
@@ -44,6 +51,8 @@ let CustomEditorService = class CustomEditorService extends Disposable {
|
|
|
44
51
|
this.instantiationService = instantiationService;
|
|
45
52
|
this.uriIdentityService = uriIdentityService;
|
|
46
53
|
this.editorResolverService = editorResolverService;
|
|
54
|
+
this.textResourceConfigurationService = textResourceConfigurationService;
|
|
55
|
+
this.extensionService = extensionService;
|
|
47
56
|
this._untitledCounter = 0;
|
|
48
57
|
this._editorResolverDisposables = this._register(( new DisposableStore()));
|
|
49
58
|
this._editorCapabilities = ( new Map());
|
|
@@ -67,12 +76,31 @@ let CustomEditorService = class CustomEditorService extends Disposable {
|
|
|
67
76
|
getGroupContextKeyValue: group => this.getCustomEditorIsEditable(group),
|
|
68
77
|
onDidChange: this.onDidChangeEditorTypes
|
|
69
78
|
};
|
|
79
|
+
const customEditorDiffCanToggleLayoutContextKeyProvider = {
|
|
80
|
+
contextKey: ActiveCustomEditorDiffCanToggleLayoutContext,
|
|
81
|
+
getGroupContextKeyValue: group => this.getActiveCustomEditorDiffCanToggleLayout(group),
|
|
82
|
+
onDidChange: this.onDidChangeEditorTypes
|
|
83
|
+
};
|
|
84
|
+
const customEditorTextDiffContextKeyProvider = {
|
|
85
|
+
contextKey: ActiveCustomEditorTextDiffContext,
|
|
86
|
+
getGroupContextKeyValue: group => this.getActiveCustomEditorTextDiff(group),
|
|
87
|
+
onDidChange: this.onDidChangeEditorTypes
|
|
88
|
+
};
|
|
70
89
|
this._register(
|
|
71
90
|
this.editorGroupService.registerContextKeyProvider(activeCustomEditorContextKeyProvider)
|
|
72
91
|
);
|
|
73
92
|
this._register(
|
|
74
93
|
this.editorGroupService.registerContextKeyProvider(customEditorIsEditableContextKeyProvider)
|
|
75
94
|
);
|
|
95
|
+
this._register(
|
|
96
|
+
this.editorGroupService.registerContextKeyProvider(customEditorDiffCanToggleLayoutContextKeyProvider)
|
|
97
|
+
);
|
|
98
|
+
this._register(
|
|
99
|
+
this.editorGroupService.registerContextKeyProvider(customEditorTextDiffContextKeyProvider)
|
|
100
|
+
);
|
|
101
|
+
this._register(this.textResourceConfigurationService.onDidChangeConfiguration(e => {
|
|
102
|
+
void this.updateCustomDiffEditorsForDiffConfigurationChange(e);
|
|
103
|
+
}));
|
|
76
104
|
this._register(fileService.onDidRunOperation(e => {
|
|
77
105
|
if (e.isOperation(FileOperation.MOVE)) {
|
|
78
106
|
this.handleMovedFileInOpenedFileEditors(e.resource, this.uriIdentityService.asCanonicalUri(e.target.resource));
|
|
@@ -90,9 +118,9 @@ let CustomEditorService = class CustomEditorService extends Disposable {
|
|
|
90
118
|
return [...this._contributedEditors];
|
|
91
119
|
}
|
|
92
120
|
withActiveCustomEditor(f) {
|
|
93
|
-
const
|
|
94
|
-
if (
|
|
95
|
-
const result = f(
|
|
121
|
+
const editor = this.getActiveCustomEditorUndoRedoInput();
|
|
122
|
+
if (editor) {
|
|
123
|
+
const result = f(editor);
|
|
96
124
|
if (result) {
|
|
97
125
|
return result;
|
|
98
126
|
}
|
|
@@ -100,6 +128,16 @@ let CustomEditorService = class CustomEditorService extends Disposable {
|
|
|
100
128
|
}
|
|
101
129
|
return false;
|
|
102
130
|
}
|
|
131
|
+
getActiveCustomEditorUndoRedoInput() {
|
|
132
|
+
const activeEditor = this.editorService.activeEditor;
|
|
133
|
+
if (activeEditor instanceof CustomEditorInput || activeEditor instanceof CustomEditorDiffInput || activeEditor instanceof CustomEditorSideBySideDiffInput) {
|
|
134
|
+
return activeEditor;
|
|
135
|
+
}
|
|
136
|
+
if (activeEditor instanceof DiffEditorInput && activeEditor.modified instanceof CustomEditorSideBySideDiffInput) {
|
|
137
|
+
return activeEditor.modified;
|
|
138
|
+
}
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
103
141
|
registerContributionPoints() {
|
|
104
142
|
this._editorResolverDisposables.clear();
|
|
105
143
|
for (const contributedEditor of this._contributedEditors) {
|
|
@@ -111,13 +149,16 @@ let CustomEditorService = class CustomEditorService extends Disposable {
|
|
|
111
149
|
id: contributedEditor.id,
|
|
112
150
|
label: contributedEditor.displayName,
|
|
113
151
|
detail: contributedEditor.providerDisplayName,
|
|
114
|
-
priority: contributedEditor.priority
|
|
152
|
+
priority: contributedEditor.priority,
|
|
153
|
+
diffEditorPriority: contributedEditor.diffEditorPriority,
|
|
154
|
+
mergeEditorPriority: contributedEditor.mergeEditorPriority
|
|
115
155
|
}, {
|
|
116
156
|
singlePerResource: () => !(this.getCustomEditorCapabilities(contributedEditor.id)?.supportsMultipleEditorsPerDocument ?? false)
|
|
117
157
|
}, {
|
|
118
158
|
createEditorInput: (
|
|
119
159
|
{
|
|
120
|
-
resource
|
|
160
|
+
resource,
|
|
161
|
+
label
|
|
121
162
|
},
|
|
122
163
|
group
|
|
123
164
|
) => {
|
|
@@ -126,6 +167,7 @@ let CustomEditorService = class CustomEditorService extends Disposable {
|
|
|
126
167
|
resource,
|
|
127
168
|
viewType: contributedEditor.id,
|
|
128
169
|
webviewTitle: undefined,
|
|
170
|
+
preferredName: label,
|
|
129
171
|
iconPath: undefined
|
|
130
172
|
}, group.id)
|
|
131
173
|
};
|
|
@@ -144,32 +186,80 @@ let CustomEditorService = class CustomEditorService extends Disposable {
|
|
|
144
186
|
})),
|
|
145
187
|
viewType: contributedEditor.id,
|
|
146
188
|
webviewTitle: undefined,
|
|
189
|
+
preferredName: undefined,
|
|
147
190
|
iconPath: undefined
|
|
148
191
|
}, group.id)
|
|
149
192
|
};
|
|
150
193
|
},
|
|
151
|
-
createDiffEditorInput: (diffEditorInput, group) => {
|
|
194
|
+
createDiffEditorInput: async (diffEditorInput, group) => {
|
|
195
|
+
await this.extensionService.activateByEvent(`onCustomEditor:${contributedEditor.id}`);
|
|
152
196
|
return {
|
|
153
|
-
editor: this.createDiffEditorInput(diffEditorInput, contributedEditor
|
|
197
|
+
editor: this.createDiffEditorInput(diffEditorInput, contributedEditor, group)
|
|
154
198
|
};
|
|
155
199
|
}
|
|
156
200
|
}));
|
|
157
201
|
}
|
|
158
202
|
}
|
|
159
203
|
}
|
|
160
|
-
createDiffEditorInput(editor,
|
|
204
|
+
createDiffEditorInput(editor, contributedEditor, group) {
|
|
205
|
+
const originalResource = assertReturnsDefined(editor.original.resource);
|
|
206
|
+
const modifiedResource = assertReturnsDefined(editor.modified.resource);
|
|
207
|
+
const diffEditorLayout = this.getDiffEditorLayout(contributedEditor, modifiedResource);
|
|
208
|
+
if (diffEditorLayout === CustomEditorDiffEditorLayout.Inline) {
|
|
209
|
+
return CustomEditorDiffInput.create(this.instantiationService, {
|
|
210
|
+
originalResource,
|
|
211
|
+
modifiedResource,
|
|
212
|
+
viewType: contributedEditor.id,
|
|
213
|
+
label: editor.label,
|
|
214
|
+
description: editor.description,
|
|
215
|
+
iconPath: undefined
|
|
216
|
+
}, group);
|
|
217
|
+
}
|
|
218
|
+
if (diffEditorLayout === CustomEditorDiffEditorLayout.SideBySide) {
|
|
219
|
+
const diffId = generateUuid();
|
|
220
|
+
const originalOverride = CustomEditorSideBySideDiffInput.create(this.instantiationService, {
|
|
221
|
+
originalResource,
|
|
222
|
+
modifiedResource,
|
|
223
|
+
viewType: contributedEditor.id,
|
|
224
|
+
diffId,
|
|
225
|
+
side: "original",
|
|
226
|
+
label: editor.label,
|
|
227
|
+
description: editor.description,
|
|
228
|
+
iconPath: undefined
|
|
229
|
+
}, group);
|
|
230
|
+
const modifiedOverride = CustomEditorSideBySideDiffInput.create(this.instantiationService, {
|
|
231
|
+
originalResource,
|
|
232
|
+
modifiedResource,
|
|
233
|
+
viewType: contributedEditor.id,
|
|
234
|
+
diffId,
|
|
235
|
+
side: "modified",
|
|
236
|
+
label: editor.label,
|
|
237
|
+
description: editor.description,
|
|
238
|
+
iconPath: undefined
|
|
239
|
+
}, group);
|
|
240
|
+
return this.instantiationService.createInstance(
|
|
241
|
+
DiffEditorInput,
|
|
242
|
+
editor.label,
|
|
243
|
+
editor.description,
|
|
244
|
+
originalOverride,
|
|
245
|
+
modifiedOverride,
|
|
246
|
+
true
|
|
247
|
+
);
|
|
248
|
+
}
|
|
161
249
|
const modifiedOverride = CustomEditorInput.create(this.instantiationService, {
|
|
162
|
-
resource:
|
|
163
|
-
viewType:
|
|
250
|
+
resource: modifiedResource,
|
|
251
|
+
viewType: contributedEditor.id,
|
|
164
252
|
webviewTitle: undefined,
|
|
253
|
+
preferredName: undefined,
|
|
165
254
|
iconPath: undefined
|
|
166
255
|
}, group.id, {
|
|
167
256
|
customClasses: "modified"
|
|
168
257
|
});
|
|
169
258
|
const originalOverride = CustomEditorInput.create(this.instantiationService, {
|
|
170
|
-
resource:
|
|
171
|
-
viewType:
|
|
259
|
+
resource: originalResource,
|
|
260
|
+
viewType: contributedEditor.id,
|
|
172
261
|
webviewTitle: undefined,
|
|
262
|
+
preferredName: undefined,
|
|
173
263
|
iconPath: undefined
|
|
174
264
|
}, group.id, {
|
|
175
265
|
customClasses: "original"
|
|
@@ -183,6 +273,68 @@ let CustomEditorService = class CustomEditorService extends Disposable {
|
|
|
183
273
|
true
|
|
184
274
|
);
|
|
185
275
|
}
|
|
276
|
+
getDiffEditorLayout(contributedEditor, modifiedResource) {
|
|
277
|
+
const capabilities = this.getCustomEditorCapabilities(contributedEditor.id);
|
|
278
|
+
const supportsInlineDiff = capabilities?.supportsInlineDiff === true;
|
|
279
|
+
const supportsSideBySideDiff = capabilities?.supportsSideBySideDiff === true;
|
|
280
|
+
if (supportsInlineDiff && supportsSideBySideDiff) {
|
|
281
|
+
return this.textResourceConfigurationService.getValue(modifiedResource, "diffEditor.renderSideBySide") ? CustomEditorDiffEditorLayout.SideBySide : CustomEditorDiffEditorLayout.Inline;
|
|
282
|
+
}
|
|
283
|
+
return supportsInlineDiff ? CustomEditorDiffEditorLayout.Inline : supportsSideBySideDiff ? CustomEditorDiffEditorLayout.SideBySide : undefined;
|
|
284
|
+
}
|
|
285
|
+
async updateCustomDiffEditorsForDiffConfigurationChange(e) {
|
|
286
|
+
for (const group of this.editorGroupService.groups) {
|
|
287
|
+
const replacements = [];
|
|
288
|
+
for (const editor of group.editors) {
|
|
289
|
+
const diffInfo = this.getCustomEditorDiffInputInfo(editor);
|
|
290
|
+
const contributedEditor = diffInfo ? this._contributedEditors.get(diffInfo.viewType) : undefined;
|
|
291
|
+
if (!diffInfo || !contributedEditor || !e.affectsConfiguration(diffInfo.modifiedResource, "diffEditor.renderSideBySide") || !this.getCustomEditorCapabilities(contributedEditor.id)?.supportsInlineDiff || !this.getCustomEditorCapabilities(contributedEditor.id)?.supportsSideBySideDiff || this.getDiffEditorLayout(contributedEditor, diffInfo.modifiedResource) === diffInfo.layout) {
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
replacements.push({
|
|
295
|
+
editor,
|
|
296
|
+
replacement: {
|
|
297
|
+
original: {
|
|
298
|
+
resource: diffInfo.originalResource
|
|
299
|
+
},
|
|
300
|
+
modified: {
|
|
301
|
+
resource: diffInfo.modifiedResource
|
|
302
|
+
},
|
|
303
|
+
label: editor.getName(),
|
|
304
|
+
description: editor.getDescription(),
|
|
305
|
+
options: {
|
|
306
|
+
override: diffInfo.viewType,
|
|
307
|
+
pinned: group.isPinned(editor),
|
|
308
|
+
sticky: group.isSticky(editor),
|
|
309
|
+
preserveFocus: group.activeEditor !== editor
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
if (replacements.length) {
|
|
315
|
+
await this.editorService.replaceEditors(replacements, group);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
getCustomEditorDiffInputInfo(input) {
|
|
320
|
+
if (input instanceof CustomEditorDiffInput) {
|
|
321
|
+
return {
|
|
322
|
+
viewType: input.viewType,
|
|
323
|
+
originalResource: input.originalResource,
|
|
324
|
+
modifiedResource: input.modifiedResource,
|
|
325
|
+
layout: CustomEditorDiffEditorLayout.Inline
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
if (input instanceof DiffEditorInput && input.original instanceof CustomEditorSideBySideDiffInput && input.modified instanceof CustomEditorSideBySideDiffInput && input.original.side === "original" && input.modified.side === "modified" && input.original.viewType === input.modified.viewType && input.original.diffId === input.modified.diffId) {
|
|
329
|
+
return {
|
|
330
|
+
viewType: input.original.viewType,
|
|
331
|
+
originalResource: input.original.originalResource,
|
|
332
|
+
modifiedResource: input.original.modifiedResource,
|
|
333
|
+
layout: CustomEditorDiffEditorLayout.SideBySide
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
return undefined;
|
|
337
|
+
}
|
|
186
338
|
get models() {
|
|
187
339
|
return this._models;
|
|
188
340
|
}
|
|
@@ -207,8 +359,10 @@ let CustomEditorService = class CustomEditorService extends Disposable {
|
|
|
207
359
|
throw ( new Error(`Capabilities for ${viewType} already set`));
|
|
208
360
|
}
|
|
209
361
|
this._editorCapabilities.set(viewType, options);
|
|
362
|
+
this._onDidChangeEditorTypes.fire();
|
|
210
363
|
return toDisposable(() => {
|
|
211
364
|
this._editorCapabilities.delete(viewType);
|
|
365
|
+
this._onDidChangeEditorTypes.fire();
|
|
212
366
|
});
|
|
213
367
|
}
|
|
214
368
|
getCustomEditorCapabilities(viewType) {
|
|
@@ -216,11 +370,21 @@ let CustomEditorService = class CustomEditorService extends Disposable {
|
|
|
216
370
|
}
|
|
217
371
|
getActiveCustomEditorId(group) {
|
|
218
372
|
const activeEditorPane = group.activeEditorPane;
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
373
|
+
const input = activeEditorPane?.input;
|
|
374
|
+
const diffInfo = this.getCustomEditorDiffInputInfo(input);
|
|
375
|
+
if (diffInfo) {
|
|
376
|
+
return diffInfo.viewType;
|
|
222
377
|
}
|
|
223
|
-
return
|
|
378
|
+
return input instanceof CustomEditorInput && input.resource ? input.viewType : "";
|
|
379
|
+
}
|
|
380
|
+
getActiveCustomEditorDiffCanToggleLayout(group) {
|
|
381
|
+
const diffInfo = this.getCustomEditorDiffInputInfo(group.activeEditorPane?.input);
|
|
382
|
+
const capabilities = diffInfo ? this.getCustomEditorCapabilities(diffInfo.viewType) : undefined;
|
|
383
|
+
return capabilities?.supportsInlineDiff === true && capabilities.supportsSideBySideDiff === true;
|
|
384
|
+
}
|
|
385
|
+
getActiveCustomEditorTextDiff(group) {
|
|
386
|
+
const diffInfo = this.getCustomEditorDiffInputInfo(group.activeEditorPane?.input);
|
|
387
|
+
return !!diffInfo && this.getCustomEditorCapabilities(diffInfo.viewType)?.isTextEditor === true;
|
|
224
388
|
}
|
|
225
389
|
getCustomEditorIsEditable(group) {
|
|
226
390
|
const activeEditorPane = group.activeEditorPane;
|
|
@@ -263,6 +427,7 @@ let CustomEditorService = class CustomEditorService extends Disposable {
|
|
|
263
427
|
resource: newResource,
|
|
264
428
|
viewType,
|
|
265
429
|
webviewTitle: undefined,
|
|
430
|
+
preferredName: undefined,
|
|
266
431
|
iconPath: undefined
|
|
267
432
|
}, group);
|
|
268
433
|
} else {
|
|
@@ -284,6 +449,6 @@ let CustomEditorService = class CustomEditorService extends Disposable {
|
|
|
284
449
|
}
|
|
285
450
|
}
|
|
286
451
|
};
|
|
287
|
-
CustomEditorService = ( __decorate([( __param(0, IFileService)), ( __param(1, IStorageService)), ( __param(2, IEditorService)), ( __param(3, IEditorGroupsService)), ( __param(4, IInstantiationService)), ( __param(5, IUriIdentityService)), ( __param(6, IEditorResolverService))], CustomEditorService));
|
|
452
|
+
CustomEditorService = ( __decorate([( __param(0, IFileService)), ( __param(1, IStorageService)), ( __param(2, IEditorService)), ( __param(3, IEditorGroupsService)), ( __param(4, IInstantiationService)), ( __param(5, IUriIdentityService)), ( __param(6, IEditorResolverService)), ( __param(7, ITextResourceConfigurationService)), ( __param(8, IExtensionService))], CustomEditorService));
|
|
288
453
|
|
|
289
454
|
export { CustomEditorService };
|
|
@@ -32,13 +32,16 @@ class ContributedCustomEditors extends Disposable {
|
|
|
32
32
|
update(extensions) {
|
|
33
33
|
this._editors.clear();
|
|
34
34
|
for (const extension of extensions) {
|
|
35
|
+
const hasCustomEditorPriorityProposal = extension.description.enabledApiProposals?.includes("customEditorPriority") ?? false;
|
|
35
36
|
for (const webviewEditorContribution of extension.value) {
|
|
36
37
|
this.add(( new CustomEditorInfo({
|
|
37
38
|
id: webviewEditorContribution.viewType,
|
|
38
39
|
displayName: webviewEditorContribution.displayName,
|
|
39
|
-
providerDisplayName: extension.description.isBuiltin ? ( localize(
|
|
40
|
+
providerDisplayName: extension.description.isBuiltin ? ( localize(8474, "Built-in")) : extension.description.displayName || extension.description.identifier.value,
|
|
40
41
|
selector: webviewEditorContribution.selector || [],
|
|
41
|
-
priority: getPriorityFromContribution(webviewEditorContribution, extension.description)
|
|
42
|
+
priority: getPriorityFromContribution(webviewEditorContribution, extension.description, "priority") ?? RegisteredEditorPriority.default,
|
|
43
|
+
diffEditorPriority: hasCustomEditorPriorityProposal ? getPriorityFromContribution(webviewEditorContribution, extension.description, "diffEditorPriority") : undefined,
|
|
44
|
+
mergeEditorPriority: hasCustomEditorPriorityProposal ? getPriorityFromContribution(webviewEditorContribution, extension.description, "mergeEditorPriority") : undefined
|
|
42
45
|
})));
|
|
43
46
|
}
|
|
44
47
|
}
|
|
@@ -64,8 +67,9 @@ class ContributedCustomEditors extends Disposable {
|
|
|
64
67
|
this._editors.set(info.id, info);
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
|
-
function getPriorityFromContribution(contribution, extension) {
|
|
68
|
-
|
|
70
|
+
function getPriorityFromContribution(contribution, extension, field) {
|
|
71
|
+
const value = contribution[field];
|
|
72
|
+
switch (value) {
|
|
69
73
|
case CustomEditorPriority.default:
|
|
70
74
|
return RegisteredEditorPriority.default;
|
|
71
75
|
case CustomEditorPriority.option:
|
|
@@ -73,7 +77,7 @@ function getPriorityFromContribution(contribution, extension) {
|
|
|
73
77
|
case CustomEditorPriority.builtin:
|
|
74
78
|
return extension.isBuiltin ? RegisteredEditorPriority.builtin : RegisteredEditorPriority.default;
|
|
75
79
|
default:
|
|
76
|
-
return
|
|
80
|
+
return undefined;
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
83
|
|
|
@@ -9,6 +9,9 @@ export declare const CONTEXT_ACTIVE_CUSTOM_EDITOR_ID: RawContextKey<string>;
|
|
|
9
9
|
export declare const CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE: RawContextKey<boolean>;
|
|
10
10
|
export interface CustomEditorCapabilities {
|
|
11
11
|
readonly supportsMultipleEditorsPerDocument?: boolean;
|
|
12
|
+
readonly isTextEditor?: boolean;
|
|
13
|
+
readonly supportsInlineDiff?: boolean;
|
|
14
|
+
readonly supportsSideBySideDiff?: boolean;
|
|
12
15
|
}
|
|
13
16
|
export interface ICustomEditorModelManager {
|
|
14
17
|
getAllModels(resource: URI): Promise<ICustomEditorModel[]>;
|
|
@@ -37,6 +40,10 @@ export declare enum CustomEditorPriority {
|
|
|
37
40
|
builtin = "builtin",
|
|
38
41
|
option = "option"
|
|
39
42
|
}
|
|
43
|
+
export declare enum CustomEditorDiffEditorLayout {
|
|
44
|
+
Inline = "inline",
|
|
45
|
+
SideBySide = "sideBySide"
|
|
46
|
+
}
|
|
40
47
|
export interface CustomEditorSelector {
|
|
41
48
|
readonly filenamePattern?: string;
|
|
42
49
|
}
|
|
@@ -45,6 +52,8 @@ export interface CustomEditorDescriptor {
|
|
|
45
52
|
readonly displayName: string;
|
|
46
53
|
readonly providerDisplayName: string;
|
|
47
54
|
readonly priority: RegisteredEditorPriority;
|
|
55
|
+
readonly diffEditorPriority?: RegisteredEditorPriority;
|
|
56
|
+
readonly mergeEditorPriority?: RegisteredEditorPriority;
|
|
48
57
|
readonly selector: readonly CustomEditorSelector[];
|
|
49
58
|
}
|
|
50
59
|
export declare class CustomEditorInfo implements CustomEditorDescriptor {
|
|
@@ -52,6 +61,8 @@ export declare class CustomEditorInfo implements CustomEditorDescriptor {
|
|
|
52
61
|
readonly displayName: string;
|
|
53
62
|
readonly providerDisplayName: string;
|
|
54
63
|
readonly priority: RegisteredEditorPriority;
|
|
64
|
+
readonly diffEditorPriority?: RegisteredEditorPriority;
|
|
65
|
+
readonly mergeEditorPriority?: RegisteredEditorPriority;
|
|
55
66
|
readonly selector: readonly CustomEditorSelector[];
|
|
56
67
|
constructor(descriptor: CustomEditorDescriptor);
|
|
57
68
|
matches(resource: URI): boolean;
|
|
@@ -6,7 +6,7 @@ import { globMatchesResource, RegisteredEditorPriority, priorityToRank } from '@
|
|
|
6
6
|
|
|
7
7
|
const CONTEXT_ACTIVE_CUSTOM_EDITOR_ID = ( new RawContextKey("activeCustomEditorId", "", {
|
|
8
8
|
type: "string",
|
|
9
|
-
description: ( localize(
|
|
9
|
+
description: ( localize(8475, "The viewType of the currently active custom editor."))
|
|
10
10
|
}));
|
|
11
11
|
const CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE = ( new RawContextKey("focusedCustomEditorIsEditable", false));
|
|
12
12
|
var CustomEditorPriority;
|
|
@@ -15,12 +15,19 @@ var CustomEditorPriority;
|
|
|
15
15
|
CustomEditorPriority["builtin"] = "builtin";
|
|
16
16
|
CustomEditorPriority["option"] = "option";
|
|
17
17
|
})(CustomEditorPriority || (CustomEditorPriority = {}));
|
|
18
|
+
var CustomEditorDiffEditorLayout;
|
|
19
|
+
(function(CustomEditorDiffEditorLayout) {
|
|
20
|
+
CustomEditorDiffEditorLayout["Inline"] = "inline";
|
|
21
|
+
CustomEditorDiffEditorLayout["SideBySide"] = "sideBySide";
|
|
22
|
+
})(CustomEditorDiffEditorLayout || (CustomEditorDiffEditorLayout = {}));
|
|
18
23
|
class CustomEditorInfo {
|
|
19
24
|
constructor(descriptor) {
|
|
20
25
|
this.id = descriptor.id;
|
|
21
26
|
this.displayName = descriptor.displayName;
|
|
22
27
|
this.providerDisplayName = descriptor.providerDisplayName;
|
|
23
28
|
this.priority = descriptor.priority;
|
|
29
|
+
this.diffEditorPriority = descriptor.diffEditorPriority;
|
|
30
|
+
this.mergeEditorPriority = descriptor.mergeEditorPriority;
|
|
24
31
|
this.selector = descriptor.selector;
|
|
25
32
|
}
|
|
26
33
|
matches(resource) {
|
|
@@ -60,4 +67,4 @@ function isLowerPriority(otherEditor, editor) {
|
|
|
60
67
|
return priorityToRank(otherEditor.priority) < priorityToRank(editor.priority);
|
|
61
68
|
}
|
|
62
69
|
|
|
63
|
-
export { CONTEXT_ACTIVE_CUSTOM_EDITOR_ID, CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE, CustomEditorInfo, CustomEditorInfoCollection, CustomEditorPriority };
|
|
70
|
+
export { CONTEXT_ACTIVE_CUSTOM_EDITOR_ID, CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE, CustomEditorDiffEditorLayout, CustomEditorInfo, CustomEditorInfoCollection, CustomEditorPriority };
|
|
@@ -40,7 +40,7 @@ declare const customEditorsContributionSchema: {
|
|
|
40
40
|
};
|
|
41
41
|
readonly priority: {
|
|
42
42
|
readonly type: "string";
|
|
43
|
-
readonly
|
|
43
|
+
readonly markdownDescription: string;
|
|
44
44
|
readonly enum: [
|
|
45
45
|
CustomEditorPriority.default,
|
|
46
46
|
CustomEditorPriority.option
|
|
@@ -51,6 +51,30 @@ declare const customEditorsContributionSchema: {
|
|
|
51
51
|
];
|
|
52
52
|
readonly default: CustomEditorPriority.default;
|
|
53
53
|
};
|
|
54
|
+
readonly diffEditorPriority: {
|
|
55
|
+
readonly type: "string";
|
|
56
|
+
readonly markdownDescription: string;
|
|
57
|
+
readonly enum: [
|
|
58
|
+
CustomEditorPriority.default,
|
|
59
|
+
CustomEditorPriority.option
|
|
60
|
+
];
|
|
61
|
+
readonly markdownEnumDescriptions: [
|
|
62
|
+
string,
|
|
63
|
+
string
|
|
64
|
+
];
|
|
65
|
+
};
|
|
66
|
+
readonly mergeEditorPriority: {
|
|
67
|
+
readonly type: "string";
|
|
68
|
+
readonly markdownDescription: string;
|
|
69
|
+
readonly enum: [
|
|
70
|
+
CustomEditorPriority.default,
|
|
71
|
+
CustomEditorPriority.option
|
|
72
|
+
];
|
|
73
|
+
readonly markdownEnumDescriptions: [
|
|
74
|
+
string,
|
|
75
|
+
string
|
|
76
|
+
];
|
|
77
|
+
};
|
|
54
78
|
};
|
|
55
79
|
};
|
|
56
80
|
export type ICustomEditorsExtensionPoint = TypeFromJsonSchema<typeof customEditorsContributionSchema>;
|
|
@@ -61,5 +85,7 @@ export declare const customEditorsExtensionPoint: import("@codingame/monaco-vsco
|
|
|
61
85
|
readonly filenamePattern: string | undefined;
|
|
62
86
|
}[];
|
|
63
87
|
readonly priority: CustomEditorPriority.default | CustomEditorPriority.option | undefined;
|
|
88
|
+
readonly diffEditorPriority: CustomEditorPriority.default | CustomEditorPriority.option | undefined;
|
|
89
|
+
readonly mergeEditorPriority: CustomEditorPriority.default | CustomEditorPriority.option | undefined;
|
|
64
90
|
}[]>;
|
|
65
91
|
export {};
|