@codingame/monaco-vscode-multi-diff-editor-service-override 25.1.2 → 26.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/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/actions.js +45 -35
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditor.contribution.js +16 -7
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditor.d.ts +0 -54
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditor.js +0 -200
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-multi-diff-editor-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "26.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - multi-diff-editor service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "
|
|
18
|
+
"@codingame/monaco-vscode-api": "26.0.0"
|
|
19
19
|
},
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"module": "index.js",
|
|
@@ -8,7 +8,7 @@ import { TextEditorSelectionRevealType } from '@codingame/monaco-vscode-api/vsco
|
|
|
8
8
|
import { KeybindingWeight } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
9
9
|
import { IListService } from '@codingame/monaco-vscode-api/vscode/vs/platform/list/browser/listService.service';
|
|
10
10
|
import { resolveCommandsContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/editor/editorCommandsContext';
|
|
11
|
-
import { MultiDiffEditor } from '
|
|
11
|
+
import { MultiDiffEditor } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditor';
|
|
12
12
|
import { MultiDiffEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput';
|
|
13
13
|
import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
14
14
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
@@ -17,16 +17,16 @@ import { ActiveEditorContext } from '@codingame/monaco-vscode-api/vscode/vs/work
|
|
|
17
17
|
class GoToFileAction extends Action2 {
|
|
18
18
|
constructor() {
|
|
19
19
|
super({
|
|
20
|
-
id:
|
|
21
|
-
title: ( localize2(
|
|
20
|
+
id: "multiDiffEditor.goToFile",
|
|
21
|
+
title: ( localize2(9527, "Open File")),
|
|
22
22
|
icon: Codicon.goToFile,
|
|
23
23
|
precondition: ( ActiveEditorContext.isEqualTo(MultiDiffEditor.ID)),
|
|
24
24
|
menu: {
|
|
25
25
|
when: ( ActiveEditorContext.isEqualTo(MultiDiffEditor.ID)),
|
|
26
26
|
id: MenuId.MultiDiffEditorFileToolbar,
|
|
27
27
|
order: 22,
|
|
28
|
-
group:
|
|
29
|
-
}
|
|
28
|
+
group: "navigation"
|
|
29
|
+
}
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
async run(accessor, ...args) {
|
|
@@ -51,30 +51,30 @@ class GoToFileAction extends Action2 {
|
|
|
51
51
|
resource: targetUri,
|
|
52
52
|
options: {
|
|
53
53
|
selection: selections?.[0],
|
|
54
|
-
selectionRevealType: TextEditorSelectionRevealType.CenterIfOutsideViewport
|
|
55
|
-
}
|
|
54
|
+
selectionRevealType: TextEditorSelectionRevealType.CenterIfOutsideViewport
|
|
55
|
+
}
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
class GoToNextChangeAction extends Action2 {
|
|
60
60
|
constructor() {
|
|
61
61
|
super({
|
|
62
|
-
id:
|
|
63
|
-
title: ( localize2(
|
|
62
|
+
id: "multiDiffEditor.goToNextChange",
|
|
63
|
+
title: ( localize2(9528, "Go to Next Change")),
|
|
64
64
|
icon: Codicon.arrowDown,
|
|
65
|
-
precondition: ( ContextKeyExpr.equals(
|
|
65
|
+
precondition: ( ContextKeyExpr.equals("activeEditor", MultiDiffEditor.ID)),
|
|
66
66
|
menu: ( [MenuId.EditorTitle, MenuId.CompactWindowEditorTitle].map(id => ({
|
|
67
67
|
id,
|
|
68
|
-
when: ( ContextKeyExpr.equals(
|
|
69
|
-
group:
|
|
68
|
+
when: ( ContextKeyExpr.equals("activeEditor", MultiDiffEditor.ID)),
|
|
69
|
+
group: "navigation",
|
|
70
70
|
order: 2
|
|
71
71
|
}))),
|
|
72
72
|
keybinding: {
|
|
73
73
|
primary: KeyMod.Alt | KeyCode.F5,
|
|
74
74
|
weight: KeybindingWeight.EditorContrib,
|
|
75
|
-
when: ( ContextKeyExpr.equals(
|
|
75
|
+
when: ( ContextKeyExpr.equals("activeEditor", MultiDiffEditor.ID))
|
|
76
76
|
},
|
|
77
|
-
f1: true
|
|
77
|
+
f1: true
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
async run(accessor) {
|
|
@@ -89,22 +89,22 @@ class GoToNextChangeAction extends Action2 {
|
|
|
89
89
|
class GoToPreviousChangeAction extends Action2 {
|
|
90
90
|
constructor() {
|
|
91
91
|
super({
|
|
92
|
-
id:
|
|
93
|
-
title: ( localize2(
|
|
92
|
+
id: "multiDiffEditor.goToPreviousChange",
|
|
93
|
+
title: ( localize2(9529, "Go to Previous Change")),
|
|
94
94
|
icon: Codicon.arrowUp,
|
|
95
|
-
precondition: ( ContextKeyExpr.equals(
|
|
95
|
+
precondition: ( ContextKeyExpr.equals("activeEditor", MultiDiffEditor.ID)),
|
|
96
96
|
menu: ( [MenuId.EditorTitle, MenuId.CompactWindowEditorTitle].map(id => ({
|
|
97
97
|
id,
|
|
98
|
-
when: ( ContextKeyExpr.equals(
|
|
99
|
-
group:
|
|
98
|
+
when: ( ContextKeyExpr.equals("activeEditor", MultiDiffEditor.ID)),
|
|
99
|
+
group: "navigation",
|
|
100
100
|
order: 1
|
|
101
101
|
}))),
|
|
102
102
|
keybinding: {
|
|
103
103
|
primary: KeyMod.Alt | KeyMod.Shift | KeyCode.F5,
|
|
104
104
|
weight: KeybindingWeight.EditorContrib,
|
|
105
|
-
when: ( ContextKeyExpr.equals(
|
|
105
|
+
when: ( ContextKeyExpr.equals("activeEditor", MultiDiffEditor.ID))
|
|
106
106
|
},
|
|
107
|
-
f1: true
|
|
107
|
+
f1: true
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
110
|
async run(accessor) {
|
|
@@ -119,21 +119,26 @@ class GoToPreviousChangeAction extends Action2 {
|
|
|
119
119
|
class CollapseAllAction extends Action2 {
|
|
120
120
|
constructor() {
|
|
121
121
|
super({
|
|
122
|
-
id:
|
|
123
|
-
title: ( localize2(
|
|
122
|
+
id: "multiDiffEditor.collapseAll",
|
|
123
|
+
title: ( localize2(9530, "Collapse All Diffs")),
|
|
124
124
|
icon: Codicon.collapseAll,
|
|
125
|
-
precondition: ( ContextKeyExpr.and(( ContextKeyExpr.equals(
|
|
125
|
+
precondition: ( ContextKeyExpr.and(( ContextKeyExpr.equals("activeEditor", MultiDiffEditor.ID)), ContextKeyExpr.not("multiDiffEditorAllCollapsed"))),
|
|
126
126
|
menu: ( [MenuId.EditorTitle, MenuId.CompactWindowEditorTitle].map(id => ({
|
|
127
127
|
id,
|
|
128
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals(
|
|
129
|
-
group:
|
|
128
|
+
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals("activeEditor", MultiDiffEditor.ID)), ContextKeyExpr.not("multiDiffEditorAllCollapsed"))),
|
|
129
|
+
group: "navigation",
|
|
130
130
|
order: 100
|
|
131
131
|
}))),
|
|
132
|
-
f1: true
|
|
132
|
+
f1: true
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
async run(accessor, ...args) {
|
|
136
|
-
const resolvedContext = resolveCommandsContext(
|
|
136
|
+
const resolvedContext = resolveCommandsContext(
|
|
137
|
+
args,
|
|
138
|
+
accessor.get(IEditorService),
|
|
139
|
+
accessor.get(IEditorGroupsService),
|
|
140
|
+
accessor.get(IListService)
|
|
141
|
+
);
|
|
137
142
|
const groupContext = resolvedContext.groupedEditors[0];
|
|
138
143
|
if (!groupContext) {
|
|
139
144
|
return;
|
|
@@ -148,21 +153,26 @@ class CollapseAllAction extends Action2 {
|
|
|
148
153
|
class ExpandAllAction extends Action2 {
|
|
149
154
|
constructor() {
|
|
150
155
|
super({
|
|
151
|
-
id:
|
|
152
|
-
title: ( localize2(
|
|
156
|
+
id: "multiDiffEditor.expandAll",
|
|
157
|
+
title: ( localize2(9531, "Expand All Diffs")),
|
|
153
158
|
icon: Codicon.expandAll,
|
|
154
|
-
precondition: ( ContextKeyExpr.and(( ContextKeyExpr.equals(
|
|
159
|
+
precondition: ( ContextKeyExpr.and(( ContextKeyExpr.equals("activeEditor", MultiDiffEditor.ID)), ( ContextKeyExpr.has("multiDiffEditorAllCollapsed")))),
|
|
155
160
|
menu: ( [MenuId.EditorTitle, MenuId.CompactWindowEditorTitle].map(id => ({
|
|
156
161
|
id,
|
|
157
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals(
|
|
158
|
-
group:
|
|
162
|
+
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals("activeEditor", MultiDiffEditor.ID)), ( ContextKeyExpr.has("multiDiffEditorAllCollapsed")))),
|
|
163
|
+
group: "navigation",
|
|
159
164
|
order: 100
|
|
160
165
|
}))),
|
|
161
|
-
f1: true
|
|
166
|
+
f1: true
|
|
162
167
|
});
|
|
163
168
|
}
|
|
164
169
|
async run(accessor, ...args) {
|
|
165
|
-
const resolvedContext = resolveCommandsContext(
|
|
170
|
+
const resolvedContext = resolveCommandsContext(
|
|
171
|
+
args,
|
|
172
|
+
accessor.get(IEditorService),
|
|
173
|
+
accessor.get(IEditorGroupsService),
|
|
174
|
+
accessor.get(IListService)
|
|
175
|
+
);
|
|
166
176
|
const groupContext = resolvedContext.groupedEditors[0];
|
|
167
177
|
if (!groupContext) {
|
|
168
178
|
return;
|
package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditor.contribution.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/regist
|
|
|
6
6
|
import { EditorPaneDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/editor';
|
|
7
7
|
import { registerWorkbenchContribution2, WorkbenchPhase } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions';
|
|
8
8
|
import { EditorExtensions } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
9
|
-
import { MultiDiffEditor } from '
|
|
9
|
+
import { MultiDiffEditor } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditor';
|
|
10
10
|
import { MultiDiffEditorResolverContribution, MultiDiffEditorInput, MultiDiffEditorSerializer } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput';
|
|
11
11
|
import { GoToFileAction, GoToNextChangeAction, GoToPreviousChangeAction, CollapseAllAction, ExpandAllAction } from './actions.js';
|
|
12
12
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
@@ -20,10 +20,19 @@ registerAction2(GoToNextChangeAction);
|
|
|
20
20
|
registerAction2(GoToPreviousChangeAction);
|
|
21
21
|
registerAction2(CollapseAllAction);
|
|
22
22
|
registerAction2(ExpandAllAction);
|
|
23
|
-
registerWorkbenchContribution2(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
registerWorkbenchContribution2(
|
|
24
|
+
MultiDiffEditorResolverContribution.ID,
|
|
25
|
+
MultiDiffEditorResolverContribution,
|
|
26
|
+
WorkbenchPhase.BlockStartup
|
|
27
|
+
);
|
|
28
|
+
( Registry.as(EditorExtensions.EditorPane)).registerEditorPane(
|
|
29
|
+
EditorPaneDescriptor.create(MultiDiffEditor, MultiDiffEditor.ID, ( localize(9533, "Multi Diff Editor"))),
|
|
30
|
+
[( new SyncDescriptor(MultiDiffEditorInput))]
|
|
31
|
+
);
|
|
32
|
+
( Registry.as(EditorExtensions.EditorFactory)).registerEditorSerializer(MultiDiffEditorInput.ID, MultiDiffEditorSerializer);
|
|
28
33
|
registerAction2(OpenScmGroupAction);
|
|
29
|
-
registerWorkbenchContribution2(
|
|
34
|
+
registerWorkbenchContribution2(
|
|
35
|
+
ScmMultiDiffSourceResolverContribution.ID,
|
|
36
|
+
ScmMultiDiffSourceResolverContribution,
|
|
37
|
+
WorkbenchPhase.BlockStartup
|
|
38
|
+
);
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import * as DOM from "@codingame/monaco-vscode-api/vscode/vs/base/browser/dom";
|
|
2
|
-
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
3
|
-
import { ITextResourceConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration.service";
|
|
4
|
-
import { IMenuService } from "@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions.service";
|
|
5
|
-
import { InstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiationService";
|
|
6
|
-
import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
|
|
7
|
-
import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
|
|
8
|
-
import { IThemeService } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service";
|
|
9
|
-
import { AbstractEditorWithViewState } from "@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/editor/editorWithViewState";
|
|
10
|
-
import { ICompositeControl } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/composite";
|
|
11
|
-
import { IEditorOpenContext } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor";
|
|
12
|
-
import { EditorInput } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/editorInput";
|
|
13
|
-
import { MultiDiffEditorInput } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput";
|
|
14
|
-
import { IEditorGroup } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService";
|
|
15
|
-
import { IEditorGroupsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service";
|
|
16
|
-
import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
|
|
17
|
-
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
18
|
-
import { MultiDiffEditorViewModel } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorViewModel";
|
|
19
|
-
import { IMultiDiffEditorOptions, IMultiDiffEditorViewState } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl";
|
|
20
|
-
import { ICodeEditor } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser";
|
|
21
|
-
import { IDiffEditor } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/editorCommon";
|
|
22
|
-
import { MultiDiffEditorItem } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/multiDiffEditor/browser/multiDiffSourceResolverService";
|
|
23
|
-
import { IEditorProgressService } from "@codingame/monaco-vscode-api/vscode/vs/platform/progress/common/progress.service";
|
|
24
|
-
export declare class MultiDiffEditor extends AbstractEditorWithViewState<IMultiDiffEditorViewState> {
|
|
25
|
-
private editorProgressService;
|
|
26
|
-
private readonly menuService;
|
|
27
|
-
static readonly ID = "multiDiffEditor";
|
|
28
|
-
private _multiDiffEditorWidget;
|
|
29
|
-
private _viewModel;
|
|
30
|
-
private _sessionResourceContextKey;
|
|
31
|
-
private _contentOverlay;
|
|
32
|
-
get viewModel(): MultiDiffEditorViewModel | undefined;
|
|
33
|
-
constructor(group: IEditorGroup, instantiationService: InstantiationService, telemetryService: ITelemetryService, themeService: IThemeService, storageService: IStorageService, editorService: IEditorService, editorGroupService: IEditorGroupsService, textResourceConfigurationService: ITextResourceConfigurationService, editorProgressService: IEditorProgressService, menuService: IMenuService);
|
|
34
|
-
protected createEditor(parent: HTMLElement): void;
|
|
35
|
-
setInput(input: MultiDiffEditorInput, options: IMultiDiffEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void>;
|
|
36
|
-
setOptions(options: IMultiDiffEditorOptions | undefined): void;
|
|
37
|
-
private _applyOptions;
|
|
38
|
-
clearInput(): Promise<void>;
|
|
39
|
-
layout(dimension: DOM.Dimension): void;
|
|
40
|
-
getControl(): ICompositeControl | undefined;
|
|
41
|
-
focus(): void;
|
|
42
|
-
hasFocus(): boolean;
|
|
43
|
-
protected computeEditorViewState(resource: URI): IMultiDiffEditorViewState | undefined;
|
|
44
|
-
protected tracksEditorViewState(input: EditorInput): boolean;
|
|
45
|
-
protected toEditorViewStateResource(input: EditorInput): URI | undefined;
|
|
46
|
-
tryGetCodeEditor(resource: URI): {
|
|
47
|
-
diffEditor: IDiffEditor;
|
|
48
|
-
editor: ICodeEditor;
|
|
49
|
-
} | undefined;
|
|
50
|
-
findDocumentDiffItem(resource: URI): MultiDiffEditorItem | undefined;
|
|
51
|
-
goToNextChange(): void;
|
|
52
|
-
goToPreviousChange(): void;
|
|
53
|
-
showWhile(promise: Promise<unknown>): Promise<void>;
|
|
54
|
-
}
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { h } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
4
|
-
import { Disposable, MutableDisposable, DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
|
-
import { MultiDiffEditorWidget } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidget';
|
|
6
|
-
import { ITextResourceConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration.service';
|
|
7
|
-
import { FloatingClickMenu } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/floatingMenu';
|
|
8
|
-
import { MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
9
|
-
import { IMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions.service';
|
|
10
|
-
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
11
|
-
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
|
12
|
-
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
13
|
-
import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
|
|
14
|
-
import { ResourceLabel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/labels';
|
|
15
|
-
import { AbstractEditorWithViewState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/editor/editorWithViewState';
|
|
16
|
-
import { MultiDiffEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput';
|
|
17
|
-
import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
18
|
-
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
19
|
-
import { Range } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range';
|
|
20
|
-
import { IEditorProgressService } from '@codingame/monaco-vscode-api/vscode/vs/platform/progress/common/progress.service';
|
|
21
|
-
import { ResourceContextKey } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contextkeys';
|
|
22
|
-
|
|
23
|
-
var MultiDiffEditor_1;
|
|
24
|
-
let MultiDiffEditor = class MultiDiffEditor extends AbstractEditorWithViewState {
|
|
25
|
-
static { MultiDiffEditor_1 = this; }
|
|
26
|
-
static { this.ID = 'multiDiffEditor'; }
|
|
27
|
-
get viewModel() {
|
|
28
|
-
return this._viewModel;
|
|
29
|
-
}
|
|
30
|
-
constructor(group, instantiationService, telemetryService, themeService, storageService, editorService, editorGroupService, textResourceConfigurationService, editorProgressService, menuService) {
|
|
31
|
-
super(MultiDiffEditor_1.ID, group, 'multiDiffEditor', telemetryService, instantiationService, storageService, textResourceConfigurationService, themeService, editorService, editorGroupService);
|
|
32
|
-
this.editorProgressService = editorProgressService;
|
|
33
|
-
this.menuService = menuService;
|
|
34
|
-
this._multiDiffEditorWidget = undefined;
|
|
35
|
-
}
|
|
36
|
-
createEditor(parent) {
|
|
37
|
-
this._multiDiffEditorWidget = this._register(this.instantiationService.createInstance(MultiDiffEditorWidget, parent, this.instantiationService.createInstance(WorkbenchUIElementFactory)));
|
|
38
|
-
this._register(this._multiDiffEditorWidget.onDidChangeActiveControl(() => {
|
|
39
|
-
this._onDidChangeControl.fire();
|
|
40
|
-
}));
|
|
41
|
-
const scopedContextKeyService = this._multiDiffEditorWidget.getContextKeyService();
|
|
42
|
-
const scopedInstantiationService = this._multiDiffEditorWidget.getScopedInstantiationService();
|
|
43
|
-
this._sessionResourceContextKey = this._register(scopedInstantiationService.createInstance(ResourceContextKey));
|
|
44
|
-
this._contentOverlay = this._register(( new MultiDiffEditorContentMenuOverlay(
|
|
45
|
-
this._multiDiffEditorWidget.getRootElement(),
|
|
46
|
-
this._sessionResourceContextKey,
|
|
47
|
-
scopedContextKeyService,
|
|
48
|
-
this.menuService,
|
|
49
|
-
scopedInstantiationService
|
|
50
|
-
)));
|
|
51
|
-
}
|
|
52
|
-
async setInput(input, options, context, token) {
|
|
53
|
-
await super.setInput(input, options, context, token);
|
|
54
|
-
this._viewModel = await input.getViewModel();
|
|
55
|
-
this._sessionResourceContextKey?.set(input.resource);
|
|
56
|
-
this._contentOverlay?.updateResource(input.resource);
|
|
57
|
-
this._multiDiffEditorWidget.setViewModel(this._viewModel);
|
|
58
|
-
const viewState = this.loadEditorViewState(input, context);
|
|
59
|
-
if (viewState) {
|
|
60
|
-
this._multiDiffEditorWidget.setViewState(viewState);
|
|
61
|
-
}
|
|
62
|
-
this._applyOptions(options);
|
|
63
|
-
}
|
|
64
|
-
setOptions(options) {
|
|
65
|
-
this._applyOptions(options);
|
|
66
|
-
}
|
|
67
|
-
_applyOptions(options) {
|
|
68
|
-
const viewState = options?.viewState;
|
|
69
|
-
if (!viewState || !viewState.revealData) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
this._multiDiffEditorWidget?.reveal(viewState.revealData.resource, {
|
|
73
|
-
range: viewState.revealData.range ? Range.lift(viewState.revealData.range) : undefined,
|
|
74
|
-
highlight: true
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
async clearInput() {
|
|
78
|
-
await super.clearInput();
|
|
79
|
-
this._sessionResourceContextKey?.set(null);
|
|
80
|
-
this._contentOverlay?.updateResource(undefined);
|
|
81
|
-
this._multiDiffEditorWidget.setViewModel(undefined);
|
|
82
|
-
}
|
|
83
|
-
layout(dimension) {
|
|
84
|
-
this._multiDiffEditorWidget.layout(dimension);
|
|
85
|
-
}
|
|
86
|
-
getControl() {
|
|
87
|
-
return this._multiDiffEditorWidget.getActiveControl();
|
|
88
|
-
}
|
|
89
|
-
focus() {
|
|
90
|
-
super.focus();
|
|
91
|
-
this._multiDiffEditorWidget?.getActiveControl()?.focus();
|
|
92
|
-
}
|
|
93
|
-
hasFocus() {
|
|
94
|
-
return this._multiDiffEditorWidget?.getActiveControl()?.hasTextFocus() || super.hasFocus();
|
|
95
|
-
}
|
|
96
|
-
computeEditorViewState(resource) {
|
|
97
|
-
return this._multiDiffEditorWidget.getViewState();
|
|
98
|
-
}
|
|
99
|
-
tracksEditorViewState(input) {
|
|
100
|
-
return input instanceof MultiDiffEditorInput;
|
|
101
|
-
}
|
|
102
|
-
toEditorViewStateResource(input) {
|
|
103
|
-
return input.resource;
|
|
104
|
-
}
|
|
105
|
-
tryGetCodeEditor(resource) {
|
|
106
|
-
return this._multiDiffEditorWidget.tryGetCodeEditor(resource);
|
|
107
|
-
}
|
|
108
|
-
findDocumentDiffItem(resource) {
|
|
109
|
-
const i = this._multiDiffEditorWidget.findDocumentDiffItem(resource);
|
|
110
|
-
if (!i) {
|
|
111
|
-
return undefined;
|
|
112
|
-
}
|
|
113
|
-
const i2 = i;
|
|
114
|
-
return i2.multiDiffEditorItem;
|
|
115
|
-
}
|
|
116
|
-
goToNextChange() {
|
|
117
|
-
this._multiDiffEditorWidget?.goToNextChange();
|
|
118
|
-
}
|
|
119
|
-
goToPreviousChange() {
|
|
120
|
-
this._multiDiffEditorWidget?.goToPreviousChange();
|
|
121
|
-
}
|
|
122
|
-
async showWhile(promise) {
|
|
123
|
-
return this.editorProgressService.showWhile(promise);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
MultiDiffEditor = MultiDiffEditor_1 = ( __decorate([
|
|
127
|
-
( __param(1, IInstantiationService)),
|
|
128
|
-
( __param(2, ITelemetryService)),
|
|
129
|
-
( __param(3, IThemeService)),
|
|
130
|
-
( __param(4, IStorageService)),
|
|
131
|
-
( __param(5, IEditorService)),
|
|
132
|
-
( __param(6, IEditorGroupsService)),
|
|
133
|
-
( __param(7, ITextResourceConfigurationService)),
|
|
134
|
-
( __param(8, IEditorProgressService)),
|
|
135
|
-
( __param(9, IMenuService))
|
|
136
|
-
], MultiDiffEditor));
|
|
137
|
-
class MultiDiffEditorContentMenuOverlay extends Disposable {
|
|
138
|
-
constructor(root, resourceContextKey, contextKeyService, menuService, instantiationService) {
|
|
139
|
-
super();
|
|
140
|
-
this.overlayStore = this._register(( new MutableDisposable()));
|
|
141
|
-
this.resourceContextKey = resourceContextKey;
|
|
142
|
-
const menu = this._register(menuService.createMenu(MenuId.MultiDiffEditorContent, contextKeyService));
|
|
143
|
-
this.rebuild = () => {
|
|
144
|
-
this.overlayStore.clear();
|
|
145
|
-
const hasActions = menu.getActions().length > 0;
|
|
146
|
-
if (!hasActions) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
const container = h('div.floating-menu-overlay-widget.multi-diff-root-floating-menu');
|
|
150
|
-
root.appendChild(container.root);
|
|
151
|
-
const floatingMenu = instantiationService.createInstance(FloatingClickMenu, {
|
|
152
|
-
container: container.root,
|
|
153
|
-
menuId: MenuId.MultiDiffEditorContent,
|
|
154
|
-
getActionArg: () => this.currentResource,
|
|
155
|
-
});
|
|
156
|
-
const store = ( new DisposableStore());
|
|
157
|
-
store.add(floatingMenu);
|
|
158
|
-
store.add(toDisposable(() => container.root.remove()));
|
|
159
|
-
this.overlayStore.value = store;
|
|
160
|
-
};
|
|
161
|
-
this.rebuild();
|
|
162
|
-
this._register(menu.onDidChange(() => {
|
|
163
|
-
this.overlayStore.clear();
|
|
164
|
-
this.rebuild();
|
|
165
|
-
}));
|
|
166
|
-
this._register(resourceContextKey);
|
|
167
|
-
}
|
|
168
|
-
updateResource(resource) {
|
|
169
|
-
this.currentResource = resource;
|
|
170
|
-
this.resourceContextKey.set(resource ?? null);
|
|
171
|
-
this.overlayStore.clear();
|
|
172
|
-
this.rebuild();
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
let WorkbenchUIElementFactory = class WorkbenchUIElementFactory {
|
|
176
|
-
constructor(_instantiationService) {
|
|
177
|
-
this._instantiationService = _instantiationService;
|
|
178
|
-
}
|
|
179
|
-
createResourceLabel(element) {
|
|
180
|
-
const label = this._instantiationService.createInstance(ResourceLabel, element, {});
|
|
181
|
-
return {
|
|
182
|
-
setUri(uri, options = {}) {
|
|
183
|
-
if (!uri) {
|
|
184
|
-
label.element.clear();
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
label.element.setFile(uri, { strikethrough: options.strikethrough });
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
dispose() {
|
|
191
|
-
label.dispose();
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
WorkbenchUIElementFactory = ( __decorate([
|
|
197
|
-
( __param(0, IInstantiationService))
|
|
198
|
-
], WorkbenchUIElementFactory));
|
|
199
|
-
|
|
200
|
-
export { MultiDiffEditor };
|