@codingame/monaco-vscode-multi-diff-editor-service-override 4.5.1 → 5.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 +20 -19
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditor.contribution.js +6 -10
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/scmMultiDiffSourceResolver.js +0 -148
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": "5.0.0",
|
|
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@
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@5.0.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -8,15 +8,12 @@ import { MultiDiffEditor } from './multiDiffEditor.js';
|
|
|
8
8
|
import { MultiDiffEditorInput } from 'vscode/vscode/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput';
|
|
9
9
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
10
10
|
|
|
11
|
+
const _moduleId = "vs/workbench/contrib/multiDiffEditor/browser/actions";
|
|
11
12
|
class GoToFileAction extends Action2 {
|
|
12
13
|
constructor() {
|
|
13
14
|
super({
|
|
14
15
|
id: 'multiDiffEditor.goToFile',
|
|
15
|
-
title: ( localize2WithPath(
|
|
16
|
-
'vs/workbench/contrib/multiDiffEditor/browser/actions',
|
|
17
|
-
'goToFile',
|
|
18
|
-
'Open File'
|
|
19
|
-
)),
|
|
16
|
+
title: ( localize2WithPath(_moduleId, 0, 'Open File')),
|
|
20
17
|
icon: Codicon.goToFile,
|
|
21
18
|
precondition: EditorContextKeys.inMultiDiffEditor,
|
|
22
19
|
menu: {
|
|
@@ -52,15 +49,17 @@ class CollapseAllAction extends Action2 {
|
|
|
52
49
|
constructor() {
|
|
53
50
|
super({
|
|
54
51
|
id: 'multiDiffEditor.collapseAll',
|
|
55
|
-
title: ( localize2WithPath(
|
|
56
|
-
'vs/workbench/contrib/multiDiffEditor/browser/actions',
|
|
57
|
-
'collapseAllDiffs',
|
|
58
|
-
'Collapse All Diffs'
|
|
59
|
-
)),
|
|
52
|
+
title: ( localize2WithPath(_moduleId, 1, 'Collapse All Diffs')),
|
|
60
53
|
icon: Codicon.collapseAll,
|
|
61
|
-
precondition: ( ContextKeyExpr.and(
|
|
54
|
+
precondition: ( (ContextKeyExpr.and(
|
|
55
|
+
(ContextKeyExpr.equals('activeEditor', MultiDiffEditor.ID)),
|
|
56
|
+
ContextKeyExpr.not('multiDiffEditorAllCollapsed')
|
|
57
|
+
))),
|
|
62
58
|
menu: {
|
|
63
|
-
when: ( ContextKeyExpr.and(
|
|
59
|
+
when: ( (ContextKeyExpr.and(
|
|
60
|
+
(ContextKeyExpr.equals('activeEditor', MultiDiffEditor.ID)),
|
|
61
|
+
ContextKeyExpr.not('multiDiffEditorAllCollapsed')
|
|
62
|
+
))),
|
|
64
63
|
id: MenuId.EditorTitle,
|
|
65
64
|
group: 'navigation',
|
|
66
65
|
order: 100
|
|
@@ -81,15 +80,17 @@ class ExpandAllAction extends Action2 {
|
|
|
81
80
|
constructor() {
|
|
82
81
|
super({
|
|
83
82
|
id: 'multiDiffEditor.expandAll',
|
|
84
|
-
title: ( localize2WithPath(
|
|
85
|
-
'vs/workbench/contrib/multiDiffEditor/browser/actions',
|
|
86
|
-
'ExpandAllDiffs',
|
|
87
|
-
'Expand All Diffs'
|
|
88
|
-
)),
|
|
83
|
+
title: ( localize2WithPath(_moduleId, 2, 'Expand All Diffs')),
|
|
89
84
|
icon: Codicon.expandAll,
|
|
90
|
-
precondition: ( ContextKeyExpr.and(
|
|
85
|
+
precondition: ( (ContextKeyExpr.and(
|
|
86
|
+
(ContextKeyExpr.equals('activeEditor', MultiDiffEditor.ID)),
|
|
87
|
+
(ContextKeyExpr.has('multiDiffEditorAllCollapsed'))
|
|
88
|
+
))),
|
|
91
89
|
menu: {
|
|
92
|
-
when: ( ContextKeyExpr.and(
|
|
90
|
+
when: ( (ContextKeyExpr.and(
|
|
91
|
+
(ContextKeyExpr.equals('activeEditor', MultiDiffEditor.ID)),
|
|
92
|
+
(ContextKeyExpr.has('multiDiffEditorAllCollapsed'))
|
|
93
|
+
))),
|
|
93
94
|
id: MenuId.EditorTitle,
|
|
94
95
|
group: 'navigation',
|
|
95
96
|
order: 100
|
package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditor.contribution.js
CHANGED
|
@@ -9,15 +9,15 @@ import { EditorExtensions } from 'vscode/vscode/vs/workbench/common/editor';
|
|
|
9
9
|
import { MultiDiffEditor } from './multiDiffEditor.js';
|
|
10
10
|
import { MultiDiffEditorResolverContribution, MultiDiffEditorInput, MultiDiffEditorSerializer } from 'vscode/vscode/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput';
|
|
11
11
|
import { GoToFileAction, CollapseAllAction, ExpandAllAction } from './actions.js';
|
|
12
|
-
import 'vscode/vscode/vs/base/common/event';
|
|
13
12
|
import 'vscode/vscode/vs/base/common/lifecycle';
|
|
14
13
|
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
15
|
-
import { OpenScmGroupAction, ScmMultiDiffSourceResolverContribution } from '
|
|
14
|
+
import { OpenScmGroupAction, ScmMultiDiffSourceResolverContribution } from 'vscode/vscode/vs/workbench/contrib/multiDiffEditor/browser/scmMultiDiffSourceResolver';
|
|
16
15
|
|
|
16
|
+
const _moduleId = "vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditor.contribution";
|
|
17
17
|
registerAction2(GoToFileAction);
|
|
18
18
|
registerAction2(CollapseAllAction);
|
|
19
19
|
registerAction2(ExpandAllAction);
|
|
20
|
-
( Registry.as(Extensions.Configuration))
|
|
20
|
+
( (Registry.as(Extensions.Configuration)))
|
|
21
21
|
.registerConfiguration({
|
|
22
22
|
properties: {
|
|
23
23
|
'multiDiffEditor.experimental.enabled': {
|
|
@@ -28,13 +28,9 @@ registerAction2(ExpandAllAction);
|
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
registerWorkbenchContribution2(MultiDiffEditorResolverContribution.ID, MultiDiffEditorResolverContribution, 1 );
|
|
31
|
-
( Registry.as(EditorExtensions.EditorPane))
|
|
32
|
-
.registerEditorPane(EditorPaneDescriptor.create(MultiDiffEditor, MultiDiffEditor.ID, ( localizeWithPath(
|
|
33
|
-
|
|
34
|
-
'name',
|
|
35
|
-
"Multi Diff Editor"
|
|
36
|
-
))), [( new SyncDescriptor(MultiDiffEditorInput))]);
|
|
37
|
-
( Registry.as(EditorExtensions.EditorFactory))
|
|
31
|
+
( (Registry.as(EditorExtensions.EditorPane)))
|
|
32
|
+
.registerEditorPane(EditorPaneDescriptor.create(MultiDiffEditor, MultiDiffEditor.ID, ( localizeWithPath(_moduleId, 0, "Multi Diff Editor"))), [( (new SyncDescriptor(MultiDiffEditorInput)))]);
|
|
33
|
+
( (Registry.as(EditorExtensions.EditorFactory)))
|
|
38
34
|
.registerEditorSerializer(MultiDiffEditorInput.ID, MultiDiffEditorSerializer);
|
|
39
35
|
registerAction2(OpenScmGroupAction);
|
|
40
36
|
registerWorkbenchContribution2(ScmMultiDiffSourceResolverContribution.ID, ScmMultiDiffSourceResolverContribution, 1 );
|
package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/scmMultiDiffSourceResolver.js
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
3
|
-
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
4
|
-
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
|
-
import 'vscode/vscode/vs/base/common/observableInternal/derived';
|
|
6
|
-
import 'vscode/vscode/vs/base/common/observableInternal/autorun';
|
|
7
|
-
import { observableFromEvent } from 'vscode/vscode/vs/base/common/observableInternal/utils';
|
|
8
|
-
import 'vscode/vscode/vs/base/common/cancellation';
|
|
9
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
10
|
-
import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
11
|
-
import { Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
12
|
-
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
13
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
14
|
-
import { IMultiDiffSourceResolverService } from 'vscode/vscode/vs/workbench/contrib/multiDiffEditor/browser/multiDiffSourceResolverService.service';
|
|
15
|
-
import { ISCMService } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm.service';
|
|
16
|
-
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
17
|
-
|
|
18
|
-
var ScmMultiDiffSourceResolver_1;
|
|
19
|
-
let ScmMultiDiffSourceResolver = class ScmMultiDiffSourceResolver {
|
|
20
|
-
static { ScmMultiDiffSourceResolver_1 = this; }
|
|
21
|
-
static { this._scheme = 'scm-multi-diff-source'; }
|
|
22
|
-
static getMultiDiffSourceUri(repositoryUri, groupId) {
|
|
23
|
-
return ( URI.from({
|
|
24
|
-
scheme: ScmMultiDiffSourceResolver_1._scheme,
|
|
25
|
-
query: JSON.stringify({ repositoryUri, groupId }),
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
static parseUri(uri) {
|
|
29
|
-
if (uri.scheme !== ScmMultiDiffSourceResolver_1._scheme) {
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
let query;
|
|
33
|
-
try {
|
|
34
|
-
query = JSON.parse(uri.query);
|
|
35
|
-
}
|
|
36
|
-
catch (e) {
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
if (typeof query !== 'object' || query === null) {
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
const { repositoryUri, groupId } = query;
|
|
43
|
-
if (typeof repositoryUri !== 'string' || typeof groupId !== 'string') {
|
|
44
|
-
return undefined;
|
|
45
|
-
}
|
|
46
|
-
return { repositoryUri: ( URI.parse(repositoryUri)), groupId };
|
|
47
|
-
}
|
|
48
|
-
constructor(_scmService) {
|
|
49
|
-
this._scmService = _scmService;
|
|
50
|
-
}
|
|
51
|
-
canHandleUri(uri) {
|
|
52
|
-
return ScmMultiDiffSourceResolver_1.parseUri(uri) !== undefined;
|
|
53
|
-
}
|
|
54
|
-
async resolveDiffSource(uri) {
|
|
55
|
-
const { repositoryUri, groupId } = ScmMultiDiffSourceResolver_1.parseUri(uri);
|
|
56
|
-
const repository = await promiseFromEventState(this._scmService.onDidAddRepository, () => {
|
|
57
|
-
const repository = [...this._scmService.repositories].find(r => r.provider.rootUri?.toString() === ( repositoryUri.toString()));
|
|
58
|
-
return repository ?? false;
|
|
59
|
-
});
|
|
60
|
-
const group = await promiseFromEventState(repository.provider.onDidChangeResourceGroups, () => {
|
|
61
|
-
const group = repository.provider.groups.find(g => g.id === groupId);
|
|
62
|
-
return group ?? false;
|
|
63
|
-
});
|
|
64
|
-
const resources = observableFromEvent(group.onDidChangeResources, () => ( group.resources.map(e => {
|
|
65
|
-
return {
|
|
66
|
-
original: e.multiDiffEditorOriginalUri,
|
|
67
|
-
modified: e.multiDiffEditorModifiedUri
|
|
68
|
-
};
|
|
69
|
-
})));
|
|
70
|
-
return ( new ScmResolvedMultiDiffSource(resources, {
|
|
71
|
-
scmResourceGroup: groupId,
|
|
72
|
-
scmProvider: repository.provider.contextValue,
|
|
73
|
-
}));
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
ScmMultiDiffSourceResolver = ScmMultiDiffSourceResolver_1 = ( __decorate([
|
|
77
|
-
( __param(0, ISCMService))
|
|
78
|
-
], ScmMultiDiffSourceResolver));
|
|
79
|
-
class ScmResolvedMultiDiffSource {
|
|
80
|
-
get resources() { return this._resources.get(); }
|
|
81
|
-
constructor(_resources, contextKeys) {
|
|
82
|
-
this._resources = _resources;
|
|
83
|
-
this.contextKeys = contextKeys;
|
|
84
|
-
this.onDidChange = Event.fromObservableLight(this._resources);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
function promiseFromEventState(event, checkState) {
|
|
88
|
-
const state = checkState();
|
|
89
|
-
if (state) {
|
|
90
|
-
return Promise.resolve(state);
|
|
91
|
-
}
|
|
92
|
-
return ( new Promise(resolve => {
|
|
93
|
-
const listener = event(() => {
|
|
94
|
-
const state = checkState();
|
|
95
|
-
if (state) {
|
|
96
|
-
listener.dispose();
|
|
97
|
-
resolve(state);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}));
|
|
101
|
-
}
|
|
102
|
-
let ScmMultiDiffSourceResolverContribution = class ScmMultiDiffSourceResolverContribution extends Disposable {
|
|
103
|
-
static { this.ID = 'workbench.contrib.scmMultiDiffSourceResolver'; }
|
|
104
|
-
constructor(instantiationService, multiDiffSourceResolverService) {
|
|
105
|
-
super();
|
|
106
|
-
this._register(multiDiffSourceResolverService.registerResolver(instantiationService.createInstance(ScmMultiDiffSourceResolver)));
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
ScmMultiDiffSourceResolverContribution = ( __decorate([
|
|
110
|
-
( __param(0, IInstantiationService)),
|
|
111
|
-
( __param(1, IMultiDiffSourceResolverService))
|
|
112
|
-
], ScmMultiDiffSourceResolverContribution));
|
|
113
|
-
class OpenScmGroupAction extends Action2 {
|
|
114
|
-
constructor() {
|
|
115
|
-
super({
|
|
116
|
-
id: 'multiDiffEditor.openScmDiff',
|
|
117
|
-
title: ( localize2WithPath(
|
|
118
|
-
'vs/workbench/contrib/multiDiffEditor/browser/scmMultiDiffSourceResolver',
|
|
119
|
-
'viewChanges',
|
|
120
|
-
'View Changes'
|
|
121
|
-
)),
|
|
122
|
-
icon: Codicon.diffMultiple,
|
|
123
|
-
menu: {
|
|
124
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.has('config.multiDiffEditor.experimental.enabled')), ( ContextKeyExpr.has('multiDiffEditorEnableViewChanges')))),
|
|
125
|
-
id: MenuId.SCMResourceGroupContext,
|
|
126
|
-
group: 'inline',
|
|
127
|
-
},
|
|
128
|
-
f1: false,
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
async run(accessor, group) {
|
|
132
|
-
const editorService = accessor.get(IEditorService);
|
|
133
|
-
if (!group.provider.rootUri) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
const multiDiffSource = ScmMultiDiffSourceResolver.getMultiDiffSourceUri(( group.provider.rootUri.toString()), group.id);
|
|
137
|
-
const label = ( localizeWithPath(
|
|
138
|
-
'vs/workbench/contrib/multiDiffEditor/browser/scmMultiDiffSourceResolver',
|
|
139
|
-
'scmDiffLabel',
|
|
140
|
-
'{0}: {1}',
|
|
141
|
-
group.provider.label,
|
|
142
|
-
group.label
|
|
143
|
-
));
|
|
144
|
-
await editorService.openEditor({ label, multiDiffSource });
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export { OpenScmGroupAction, ScmMultiDiffSourceResolver, ScmMultiDiffSourceResolverContribution };
|