@codingame/monaco-vscode-multi-diff-editor-service-override 7.1.0 → 7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/actions.js +38 -23
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditor.contribution.js +2 -3
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditor.js +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-multi-diff-editor-service-override",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@7.1.
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@7.1.1"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
2
2
|
import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
|
|
3
|
-
import {
|
|
3
|
+
import { localize2 } from 'vscode/vscode/vs/nls';
|
|
4
4
|
import { Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
5
5
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { TextEditorSelectionRevealType } from 'vscode/vscode/vs/platform/editor/common/editor';
|
|
7
|
+
import { IListService } from 'vscode/vscode/vs/platform/list/browser/listService.service';
|
|
8
|
+
import { resolveCommandsContext } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorCommandsContext';
|
|
8
9
|
import { MultiDiffEditor } from './multiDiffEditor.js';
|
|
9
10
|
import { MultiDiffEditorInput } from 'vscode/vscode/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput';
|
|
10
11
|
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
11
12
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
12
13
|
|
|
13
|
-
const _moduleId = "vs/workbench/contrib/multiDiffEditor/browser/actions";
|
|
14
14
|
class GoToFileAction extends Action2 {
|
|
15
15
|
constructor() {
|
|
16
16
|
super({
|
|
17
17
|
id: 'multiDiffEditor.goToFile',
|
|
18
|
-
title: (
|
|
18
|
+
title: ( localize2(5740, 'Open File')),
|
|
19
19
|
icon: Codicon.goToFile,
|
|
20
20
|
precondition: EditorContextKeys.inMultiDiffEditor,
|
|
21
21
|
menu: {
|
|
@@ -31,27 +31,32 @@ class GoToFileAction extends Action2 {
|
|
|
31
31
|
const editorService = accessor.get(IEditorService);
|
|
32
32
|
const activeEditorPane = editorService.activeEditorPane;
|
|
33
33
|
let selections = undefined;
|
|
34
|
-
if (activeEditorPane instanceof MultiDiffEditor) {
|
|
35
|
-
|
|
36
|
-
if (editor) {
|
|
37
|
-
selections = editor.editor.getSelections() ?? undefined;
|
|
38
|
-
}
|
|
34
|
+
if (!(activeEditorPane instanceof MultiDiffEditor)) {
|
|
35
|
+
return;
|
|
39
36
|
}
|
|
40
|
-
const editor =
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
if (c) {
|
|
44
|
-
c.setSelections(selections);
|
|
45
|
-
c.revealLineInCenter(selections[0].selectionStartLineNumber);
|
|
46
|
-
}
|
|
37
|
+
const editor = activeEditorPane.tryGetCodeEditor(uri);
|
|
38
|
+
if (editor) {
|
|
39
|
+
selections = editor.editor.getSelections() ?? undefined;
|
|
47
40
|
}
|
|
41
|
+
let targetUri = uri;
|
|
42
|
+
const item = activeEditorPane.findDocumentDiffItem(uri);
|
|
43
|
+
if (item && item.goToFileUri) {
|
|
44
|
+
targetUri = item.goToFileUri;
|
|
45
|
+
}
|
|
46
|
+
await editorService.openEditor({
|
|
47
|
+
resource: targetUri,
|
|
48
|
+
options: {
|
|
49
|
+
selection: selections?.[0],
|
|
50
|
+
selectionRevealType: TextEditorSelectionRevealType.CenterIfOutsideViewport,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
55
|
class CollapseAllAction extends Action2 {
|
|
51
56
|
constructor() {
|
|
52
57
|
super({
|
|
53
58
|
id: 'multiDiffEditor.collapseAll',
|
|
54
|
-
title: (
|
|
59
|
+
title: ( localize2(5741, 'Collapse All Diffs')),
|
|
55
60
|
icon: Codicon.collapseAll,
|
|
56
61
|
precondition: ( (ContextKeyExpr.and(
|
|
57
62
|
(ContextKeyExpr.equals('activeEditor', MultiDiffEditor.ID)),
|
|
@@ -69,8 +74,13 @@ class CollapseAllAction extends Action2 {
|
|
|
69
74
|
f1: true,
|
|
70
75
|
});
|
|
71
76
|
}
|
|
72
|
-
async run(accessor,
|
|
73
|
-
const
|
|
77
|
+
async run(accessor, ...args) {
|
|
78
|
+
const resolvedContext = resolveCommandsContext(args, accessor.get(IEditorService), accessor.get(IEditorGroupsService), accessor.get(IListService));
|
|
79
|
+
const groupContext = resolvedContext.groupedEditors[0];
|
|
80
|
+
if (!groupContext) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const editor = groupContext.editors[0];
|
|
74
84
|
if (editor instanceof MultiDiffEditorInput) {
|
|
75
85
|
const viewModel = await editor.getViewModel();
|
|
76
86
|
viewModel.collapseAll();
|
|
@@ -81,7 +91,7 @@ class ExpandAllAction extends Action2 {
|
|
|
81
91
|
constructor() {
|
|
82
92
|
super({
|
|
83
93
|
id: 'multiDiffEditor.expandAll',
|
|
84
|
-
title: (
|
|
94
|
+
title: ( localize2(5742, 'Expand All Diffs')),
|
|
85
95
|
icon: Codicon.expandAll,
|
|
86
96
|
precondition: ( (ContextKeyExpr.and(
|
|
87
97
|
(ContextKeyExpr.equals('activeEditor', MultiDiffEditor.ID)),
|
|
@@ -99,8 +109,13 @@ class ExpandAllAction extends Action2 {
|
|
|
99
109
|
f1: true,
|
|
100
110
|
});
|
|
101
111
|
}
|
|
102
|
-
async run(accessor,
|
|
103
|
-
const
|
|
112
|
+
async run(accessor, ...args) {
|
|
113
|
+
const resolvedContext = resolveCommandsContext(args, accessor.get(IEditorService), accessor.get(IEditorGroupsService), accessor.get(IListService));
|
|
114
|
+
const groupContext = resolvedContext.groupedEditors[0];
|
|
115
|
+
if (!groupContext) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const editor = groupContext.editors[0];
|
|
104
119
|
if (editor instanceof MultiDiffEditorInput) {
|
|
105
120
|
const viewModel = await editor.getViewModel();
|
|
106
121
|
viewModel.expandAll();
|
package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditor.contribution.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { localize } from 'vscode/vscode/vs/nls';
|
|
2
2
|
import { registerAction2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
3
3
|
import { Extensions } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
4
4
|
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
@@ -14,7 +14,6 @@ import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
|
14
14
|
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
15
15
|
import { OpenScmGroupAction, ScmMultiDiffSourceResolverContribution } from 'vscode/vscode/vs/workbench/contrib/multiDiffEditor/browser/scmMultiDiffSourceResolver';
|
|
16
16
|
|
|
17
|
-
const _moduleId = "vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditor.contribution";
|
|
18
17
|
registerAction2(GoToFileAction);
|
|
19
18
|
registerAction2(CollapseAllAction);
|
|
20
19
|
registerAction2(ExpandAllAction);
|
|
@@ -30,7 +29,7 @@ registerAction2(ExpandAllAction);
|
|
|
30
29
|
});
|
|
31
30
|
registerWorkbenchContribution2(MultiDiffEditorResolverContribution.ID, MultiDiffEditorResolverContribution, WorkbenchPhase.BlockStartup );
|
|
32
31
|
( (Registry.as(EditorExtensions.EditorPane)))
|
|
33
|
-
.registerEditorPane(EditorPaneDescriptor.create(MultiDiffEditor, MultiDiffEditor.ID, (
|
|
32
|
+
.registerEditorPane(EditorPaneDescriptor.create(MultiDiffEditor, MultiDiffEditor.ID, ( localize(2554, "Multi Diff Editor"))), [( (new SyncDescriptor(MultiDiffEditorInput)))]);
|
|
34
33
|
( (Registry.as(EditorExtensions.EditorFactory)))
|
|
35
34
|
.registerEditorSerializer(MultiDiffEditorInput.ID, MultiDiffEditorSerializer);
|
|
36
35
|
registerAction2(OpenScmGroupAction);
|
|
@@ -81,6 +81,14 @@ let MultiDiffEditor = class MultiDiffEditor extends AbstractEditorWithViewState
|
|
|
81
81
|
tryGetCodeEditor(resource) {
|
|
82
82
|
return this._multiDiffEditorWidget.tryGetCodeEditor(resource);
|
|
83
83
|
}
|
|
84
|
+
findDocumentDiffItem(resource) {
|
|
85
|
+
const i = this._multiDiffEditorWidget.findDocumentDiffItem(resource);
|
|
86
|
+
if (!i) {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
const i2 = i;
|
|
90
|
+
return i2.multiDiffEditorItem;
|
|
91
|
+
}
|
|
84
92
|
};
|
|
85
93
|
MultiDiffEditor = MultiDiffEditor_1 = ( __decorate([
|
|
86
94
|
( __param(1, IInstantiationService)),
|