@codingame/monaco-vscode-scm-service-override 4.1.0 → 4.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/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
- package/external/tslib/tslib.es6.js +11 -0
- package/package.json +2 -2
- package/scm.js +4 -4
- package/vscode/src/vs/workbench/contrib/scm/browser/activity.js +308 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/media/scm.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/menus.js +280 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/scm.contribution.js +702 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoriesViewPane.js +174 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoryRenderer.js +136 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPane.js +3367 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPaneContainer.js +54 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewService.js +305 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/util.js +121 -0
- package/vscode/src/vs/workbench/contrib/scm/common/quickDiffService.js +76 -0
- package/vscode/src/vs/workbench/contrib/scm/common/scmService.js +312 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { equals } from 'vscode/vscode/vs/base/common/arrays';
|
|
3
|
+
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
4
|
+
import { DisposableStore, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
|
+
import './media/scm.css.js';
|
|
6
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
7
|
+
import { createAndFillInActionBarActions } from 'vscode/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
|
|
8
|
+
import { MenuRegistry, MenuId, IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
9
|
+
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
10
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
11
|
+
import { ServiceCollection } from 'vscode/vscode/vs/platform/instantiation/common/serviceCollection';
|
|
12
|
+
import { ISCMService } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm';
|
|
13
|
+
|
|
14
|
+
function actionEquals(a, b) {
|
|
15
|
+
return a.id === b.id;
|
|
16
|
+
}
|
|
17
|
+
const repositoryMenuDisposables = ( new DisposableStore());
|
|
18
|
+
MenuRegistry.onDidChangeMenu(e => {
|
|
19
|
+
if (( e.has(MenuId.SCMTitle))) {
|
|
20
|
+
repositoryMenuDisposables.clear();
|
|
21
|
+
for (const menuItem of MenuRegistry.getMenuItems(MenuId.SCMTitle)) {
|
|
22
|
+
repositoryMenuDisposables.add(MenuRegistry.appendMenuItem(MenuId.SCMSourceControlInline, menuItem));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
let SCMTitleMenu = class SCMTitleMenu {
|
|
27
|
+
get actions() { return this._actions; }
|
|
28
|
+
get secondaryActions() { return this._secondaryActions; }
|
|
29
|
+
constructor(menuService, contextKeyService) {
|
|
30
|
+
this._actions = [];
|
|
31
|
+
this._secondaryActions = [];
|
|
32
|
+
this._onDidChangeTitle = ( new Emitter());
|
|
33
|
+
this.onDidChangeTitle = this._onDidChangeTitle.event;
|
|
34
|
+
this.disposables = ( new DisposableStore());
|
|
35
|
+
this.menu = menuService.createMenu(MenuId.SCMTitle, contextKeyService);
|
|
36
|
+
this.disposables.add(this.menu);
|
|
37
|
+
this.menu.onDidChange(this.updateTitleActions, this, this.disposables);
|
|
38
|
+
this.updateTitleActions();
|
|
39
|
+
}
|
|
40
|
+
updateTitleActions() {
|
|
41
|
+
const primary = [];
|
|
42
|
+
const secondary = [];
|
|
43
|
+
createAndFillInActionBarActions(this.menu, { shouldForwardArgs: true }, { primary, secondary });
|
|
44
|
+
if (equals(primary, this._actions, actionEquals) && equals(secondary, this._secondaryActions, actionEquals)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this._actions = primary;
|
|
48
|
+
this._secondaryActions = secondary;
|
|
49
|
+
this._onDidChangeTitle.fire();
|
|
50
|
+
}
|
|
51
|
+
dispose() {
|
|
52
|
+
this.disposables.dispose();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
SCMTitleMenu = ( __decorate([
|
|
56
|
+
( __param(0, IMenuService)),
|
|
57
|
+
( __param(1, IContextKeyService))
|
|
58
|
+
], SCMTitleMenu));
|
|
59
|
+
class SCMMenusItem {
|
|
60
|
+
get resourceGroupMenu() {
|
|
61
|
+
if (!this._resourceGroupMenu) {
|
|
62
|
+
this._resourceGroupMenu = this.menuService.createMenu(MenuId.SCMResourceGroupContext, this.contextKeyService);
|
|
63
|
+
}
|
|
64
|
+
return this._resourceGroupMenu;
|
|
65
|
+
}
|
|
66
|
+
get resourceFolderMenu() {
|
|
67
|
+
if (!this._resourceFolderMenu) {
|
|
68
|
+
this._resourceFolderMenu = this.menuService.createMenu(MenuId.SCMResourceFolderContext, this.contextKeyService);
|
|
69
|
+
}
|
|
70
|
+
return this._resourceFolderMenu;
|
|
71
|
+
}
|
|
72
|
+
constructor(contextKeyService, menuService) {
|
|
73
|
+
this.contextKeyService = contextKeyService;
|
|
74
|
+
this.menuService = menuService;
|
|
75
|
+
}
|
|
76
|
+
getResourceMenu(resource) {
|
|
77
|
+
if (typeof resource.contextValue === 'undefined') {
|
|
78
|
+
if (!this.genericResourceMenu) {
|
|
79
|
+
this.genericResourceMenu = this.menuService.createMenu(MenuId.SCMResourceContext, this.contextKeyService);
|
|
80
|
+
}
|
|
81
|
+
return this.genericResourceMenu;
|
|
82
|
+
}
|
|
83
|
+
if (!this.contextualResourceMenus) {
|
|
84
|
+
this.contextualResourceMenus = ( new Map());
|
|
85
|
+
}
|
|
86
|
+
let item = this.contextualResourceMenus.get(resource.contextValue);
|
|
87
|
+
if (!item) {
|
|
88
|
+
const contextKeyService = this.contextKeyService.createOverlay([['scmResourceState', resource.contextValue]]);
|
|
89
|
+
const menu = this.menuService.createMenu(MenuId.SCMResourceContext, contextKeyService);
|
|
90
|
+
item = {
|
|
91
|
+
menu, dispose() {
|
|
92
|
+
menu.dispose();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
this.contextualResourceMenus.set(resource.contextValue, item);
|
|
96
|
+
}
|
|
97
|
+
return item.menu;
|
|
98
|
+
}
|
|
99
|
+
dispose() {
|
|
100
|
+
this._resourceGroupMenu?.dispose();
|
|
101
|
+
this._resourceFolderMenu?.dispose();
|
|
102
|
+
this.genericResourceMenu?.dispose();
|
|
103
|
+
if (this.contextualResourceMenus) {
|
|
104
|
+
dispose(( this.contextualResourceMenus.values()));
|
|
105
|
+
this.contextualResourceMenus.clear();
|
|
106
|
+
this.contextualResourceMenus = undefined;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
let SCMRepositoryMenus = class SCMRepositoryMenus {
|
|
111
|
+
get repositoryContextMenu() {
|
|
112
|
+
if (!this._repositoryContextMenu) {
|
|
113
|
+
this._repositoryContextMenu = this.menuService.createMenu(MenuId.SCMSourceControl, this.contextKeyService);
|
|
114
|
+
this.disposables.add(this._repositoryContextMenu);
|
|
115
|
+
}
|
|
116
|
+
return this._repositoryContextMenu;
|
|
117
|
+
}
|
|
118
|
+
get historyProviderMenu() {
|
|
119
|
+
if (this.provider.historyProvider && !this._historyProviderMenu) {
|
|
120
|
+
this._historyProviderMenu = ( new SCMHistoryProviderMenus(this.contextKeyService, this.menuService));
|
|
121
|
+
this.disposables.add(this._historyProviderMenu);
|
|
122
|
+
}
|
|
123
|
+
return this._historyProviderMenu;
|
|
124
|
+
}
|
|
125
|
+
constructor(provider, contextKeyService, instantiationService, menuService) {
|
|
126
|
+
this.provider = provider;
|
|
127
|
+
this.menuService = menuService;
|
|
128
|
+
this.resourceGroupMenusItems = ( new Map());
|
|
129
|
+
this.disposables = ( new DisposableStore());
|
|
130
|
+
this.contextKeyService = contextKeyService.createOverlay([
|
|
131
|
+
['scmProvider', provider.contextValue],
|
|
132
|
+
['scmProviderRootUri', provider.rootUri?.toString()],
|
|
133
|
+
['scmProviderHasRootUri', !!provider.rootUri],
|
|
134
|
+
]);
|
|
135
|
+
const serviceCollection = ( new ServiceCollection([IContextKeyService, this.contextKeyService]));
|
|
136
|
+
instantiationService = instantiationService.createChild(serviceCollection);
|
|
137
|
+
this.titleMenu = instantiationService.createInstance(SCMTitleMenu);
|
|
138
|
+
this.disposables.add(this.titleMenu);
|
|
139
|
+
this.repositoryMenu = menuService.createMenu(MenuId.SCMSourceControlInline, this.contextKeyService);
|
|
140
|
+
this.disposables.add(this.repositoryMenu);
|
|
141
|
+
provider.onDidChangeResourceGroups(this.onDidChangeResourceGroups, this, this.disposables);
|
|
142
|
+
this.onDidChangeResourceGroups();
|
|
143
|
+
}
|
|
144
|
+
getResourceGroupMenu(group) {
|
|
145
|
+
return this.getOrCreateResourceGroupMenusItem(group).resourceGroupMenu;
|
|
146
|
+
}
|
|
147
|
+
getResourceMenu(resource) {
|
|
148
|
+
return this.getOrCreateResourceGroupMenusItem(resource.resourceGroup).getResourceMenu(resource);
|
|
149
|
+
}
|
|
150
|
+
getResourceFolderMenu(group) {
|
|
151
|
+
return this.getOrCreateResourceGroupMenusItem(group).resourceFolderMenu;
|
|
152
|
+
}
|
|
153
|
+
getOrCreateResourceGroupMenusItem(group) {
|
|
154
|
+
let result = this.resourceGroupMenusItems.get(group);
|
|
155
|
+
if (!result) {
|
|
156
|
+
const contextKeyService = this.contextKeyService.createOverlay([
|
|
157
|
+
['scmResourceGroup', group.id],
|
|
158
|
+
['multiDiffEditorEnableViewChanges', group.multiDiffEditorEnableViewChanges],
|
|
159
|
+
]);
|
|
160
|
+
result = ( new SCMMenusItem(contextKeyService, this.menuService));
|
|
161
|
+
this.resourceGroupMenusItems.set(group, result);
|
|
162
|
+
}
|
|
163
|
+
return result;
|
|
164
|
+
}
|
|
165
|
+
onDidChangeResourceGroups() {
|
|
166
|
+
for (const resourceGroup of ( this.resourceGroupMenusItems.keys())) {
|
|
167
|
+
if (!this.provider.groups.includes(resourceGroup)) {
|
|
168
|
+
this.resourceGroupMenusItems.get(resourceGroup)?.dispose();
|
|
169
|
+
this.resourceGroupMenusItems.delete(resourceGroup);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
dispose() {
|
|
174
|
+
this.disposables.dispose();
|
|
175
|
+
this.resourceGroupMenusItems.forEach(item => item.dispose());
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
SCMRepositoryMenus = ( __decorate([
|
|
179
|
+
( __param(1, IContextKeyService)),
|
|
180
|
+
( __param(2, IInstantiationService)),
|
|
181
|
+
( __param(3, IMenuService))
|
|
182
|
+
], SCMRepositoryMenus));
|
|
183
|
+
let SCMHistoryProviderMenus = class SCMHistoryProviderMenus {
|
|
184
|
+
constructor(contextKeyService, menuService) {
|
|
185
|
+
this.contextKeyService = contextKeyService;
|
|
186
|
+
this.menuService = menuService;
|
|
187
|
+
this.historyItemMenus = ( new Map());
|
|
188
|
+
this.disposables = ( new DisposableStore());
|
|
189
|
+
}
|
|
190
|
+
getHistoryItemMenu(historyItem) {
|
|
191
|
+
return this.getOrCreateHistoryItemMenu(historyItem);
|
|
192
|
+
}
|
|
193
|
+
getHistoryItemGroupMenu(historyItemGroup) {
|
|
194
|
+
return historyItemGroup.direction === 'incoming' ?
|
|
195
|
+
this.menuService.createMenu(MenuId.SCMIncomingChanges, this.contextKeyService) :
|
|
196
|
+
this.getOutgoingHistoryItemGroupMenu(MenuId.SCMOutgoingChanges, historyItemGroup);
|
|
197
|
+
}
|
|
198
|
+
getHistoryItemGroupContextMenu(historyItemGroup) {
|
|
199
|
+
return historyItemGroup.direction === 'incoming' ?
|
|
200
|
+
this.menuService.createMenu(MenuId.SCMIncomingChangesContext, this.contextKeyService) :
|
|
201
|
+
this.getOutgoingHistoryItemGroupMenu(MenuId.SCMOutgoingChangesContext, historyItemGroup);
|
|
202
|
+
}
|
|
203
|
+
getOrCreateHistoryItemMenu(historyItem) {
|
|
204
|
+
let result = this.historyItemMenus.get(historyItem);
|
|
205
|
+
if (!result) {
|
|
206
|
+
let menuId;
|
|
207
|
+
if (historyItem.historyItemGroup.direction === 'incoming') {
|
|
208
|
+
menuId = historyItem.type === 'allChanges' ?
|
|
209
|
+
MenuId.SCMIncomingChangesAllChangesContext :
|
|
210
|
+
MenuId.SCMIncomingChangesHistoryItemContext;
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
menuId = historyItem.type === 'allChanges' ?
|
|
214
|
+
MenuId.SCMOutgoingChangesAllChangesContext :
|
|
215
|
+
MenuId.SCMOutgoingChangesHistoryItemContext;
|
|
216
|
+
}
|
|
217
|
+
const contextKeyService = this.contextKeyService.createOverlay([
|
|
218
|
+
['scmHistoryItemFileCount', historyItem.statistics?.files ?? 0],
|
|
219
|
+
]);
|
|
220
|
+
result = this.menuService.createMenu(menuId, contextKeyService);
|
|
221
|
+
this.historyItemMenus.set(historyItem, result);
|
|
222
|
+
}
|
|
223
|
+
return result;
|
|
224
|
+
}
|
|
225
|
+
getOutgoingHistoryItemGroupMenu(menuId, historyItemGroup) {
|
|
226
|
+
const contextKeyService = this.contextKeyService.createOverlay([
|
|
227
|
+
['scmHistoryItemGroupHasUpstream', !!historyItemGroup.repository.provider.historyProvider?.currentHistoryItemGroup?.base],
|
|
228
|
+
]);
|
|
229
|
+
return this.menuService.createMenu(menuId, contextKeyService);
|
|
230
|
+
}
|
|
231
|
+
dispose() {
|
|
232
|
+
this.disposables.dispose();
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
SCMHistoryProviderMenus = ( __decorate([
|
|
236
|
+
( __param(0, IContextKeyService)),
|
|
237
|
+
( __param(1, IMenuService))
|
|
238
|
+
], SCMHistoryProviderMenus));
|
|
239
|
+
let SCMMenus = class SCMMenus {
|
|
240
|
+
constructor(scmService, instantiationService) {
|
|
241
|
+
this.instantiationService = instantiationService;
|
|
242
|
+
this.disposables = ( new DisposableStore());
|
|
243
|
+
this.menus = ( new Map());
|
|
244
|
+
this.titleMenu = instantiationService.createInstance(SCMTitleMenu);
|
|
245
|
+
scmService.onDidRemoveRepository(this.onDidRemoveRepository, this, this.disposables);
|
|
246
|
+
}
|
|
247
|
+
onDidRemoveRepository(repository) {
|
|
248
|
+
const menus = this.menus.get(repository.provider);
|
|
249
|
+
menus?.dispose();
|
|
250
|
+
this.menus.delete(repository.provider);
|
|
251
|
+
}
|
|
252
|
+
getRepositoryMenus(provider) {
|
|
253
|
+
let result = this.menus.get(provider);
|
|
254
|
+
if (!result) {
|
|
255
|
+
const menus = this.instantiationService.createInstance(SCMRepositoryMenus, provider);
|
|
256
|
+
const dispose = () => {
|
|
257
|
+
menus.dispose();
|
|
258
|
+
this.menus.delete(provider);
|
|
259
|
+
};
|
|
260
|
+
result = { menus, dispose };
|
|
261
|
+
this.menus.set(provider, result);
|
|
262
|
+
}
|
|
263
|
+
return result.menus;
|
|
264
|
+
}
|
|
265
|
+
dispose() {
|
|
266
|
+
this.disposables.dispose();
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
SCMMenus = ( __decorate([
|
|
270
|
+
( __param(0, ISCMService)),
|
|
271
|
+
( __param(1, IInstantiationService))
|
|
272
|
+
], SCMMenus));
|
|
273
|
+
MenuRegistry.appendMenuItem(MenuId.SCMResourceContext, {
|
|
274
|
+
title: ( localizeWithPath('vs/workbench/contrib/scm/browser/menus', 'miShare', "Share")),
|
|
275
|
+
submenu: MenuId.SCMResourceContextShare,
|
|
276
|
+
group: '45_share',
|
|
277
|
+
order: 3,
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
export { SCMHistoryProviderMenus, SCMMenus, SCMRepositoryMenus, SCMTitleMenu };
|