@codingame/monaco-vscode-scm-service-override 8.0.4 → 9.0.2
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/scm/browser/activity.js +4 -4
- package/vscode/src/vs/workbench/contrib/scm/browser/media/scm.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/scm/browser/menus.js +1 -1
- package/vscode/src/vs/workbench/contrib/scm/browser/scm.contribution.js +109 -117
- package/vscode/src/vs/workbench/contrib/scm/browser/scmHistory.js +40 -28
- package/vscode/src/vs/workbench/contrib/scm/browser/scmHistoryViewPane.js +879 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoriesViewPane.js +1 -1
- package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoryRenderer.js +9 -9
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPane.js +72 -562
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPaneContainer.js +12 -18
- package/vscode/src/vs/workbench/contrib/scm/browser/util.js +4 -1
|
@@ -0,0 +1,879 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import './media/scm.css.js';
|
|
3
|
+
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
4
|
+
import { language } from 'vscode/vscode/vs/base/common/platform';
|
|
5
|
+
import { append, $ } from 'vscode/vscode/vs/base/browser/dom';
|
|
6
|
+
import { getDefaultHoverDelegate } from 'vscode/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
|
|
7
|
+
import { IconLabel } from 'vscode/vscode/vs/base/browser/ui/iconLabel/iconLabel';
|
|
8
|
+
import { fromNow } from 'vscode/vscode/vs/base/common/date';
|
|
9
|
+
import { createMatches } from 'vscode/vscode/vs/base/common/filters';
|
|
10
|
+
import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
|
|
11
|
+
import { DisposableStore, combinedDisposable, Disposable, DisposableMap } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
12
|
+
import { observableValue } from 'vscode/vscode/vs/base/common/observableInternal/base';
|
|
13
|
+
import 'vscode/vscode/vs/base/common/observableInternal/derived';
|
|
14
|
+
import { autorun, autorunWithStore } from 'vscode/vscode/vs/base/common/observableInternal/autorun';
|
|
15
|
+
import 'vscode/vscode/vs/base/common/observableInternal/utils';
|
|
16
|
+
import 'vscode/vscode/vs/base/common/cancellation';
|
|
17
|
+
import { tail } from 'vscode/vscode/vs/base/common/arrays';
|
|
18
|
+
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
19
|
+
import { localize } from 'vscode/vscode/vs/nls';
|
|
20
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
21
|
+
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
22
|
+
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
23
|
+
import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView.service';
|
|
24
|
+
import { WorkbenchHoverDelegate } from 'vscode/vscode/vs/platform/hover/browser/hover';
|
|
25
|
+
import { IHoverService } from 'vscode/vscode/vs/platform/hover/browser/hover.service';
|
|
26
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
27
|
+
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
28
|
+
import { WorkbenchAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
29
|
+
import { observableConfigValue } from 'vscode/vscode/vs/platform/observable/common/platformObservableUtils';
|
|
30
|
+
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener.service';
|
|
31
|
+
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
32
|
+
import { registerColor } from 'vscode/vscode/vs/platform/theme/common/colorUtils';
|
|
33
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
|
|
34
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
|
|
35
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
|
|
36
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
|
|
37
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
|
|
38
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
|
|
39
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
|
|
40
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
|
|
41
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
42
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
43
|
+
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService.service';
|
|
44
|
+
import { ViewAction, ViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
|
|
45
|
+
import { ViewContainerLocation } from 'vscode/vscode/vs/workbench/common/views';
|
|
46
|
+
import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views.service';
|
|
47
|
+
import { renderSCMHistoryItemGraph, historyItemGroupLocal, historyItemGroupRemote, historyItemGroupBase, historyItemGroupHoverLabelForeground, SWIMLANE_WIDTH, renderSCMHistoryGraphPlaceholder, toISCMHistoryItemViewModelArray } from './scmHistory.js';
|
|
48
|
+
import { RepositoryActionRunner } from './scmRepositoryRenderer.js';
|
|
49
|
+
import { isSCMRepository, isSCMHistoryItemViewModelTreeElement, isSCMHistoryItemLoadMoreTreeElement, connectPrimaryMenu, isSCMViewService, getActionViewItemProvider, collectContextMenuActions } from './util.js';
|
|
50
|
+
import { HISTORY_VIEW_PANE_ID } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm';
|
|
51
|
+
import { ISCMService, ISCMViewService } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm.service';
|
|
52
|
+
import { stripIcons } from 'vscode/vscode/vs/base/common/iconLabels';
|
|
53
|
+
import { Position } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
|
|
54
|
+
import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService.service';
|
|
55
|
+
import { HoverPosition } from 'vscode/vscode/vs/base/browser/ui/hover/hoverWidget';
|
|
56
|
+
import { registerAction2, MenuId, MenuItemAction } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
57
|
+
import { IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions.service';
|
|
58
|
+
import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
|
|
59
|
+
import { Sequencer, Throttler } from 'vscode/vscode/vs/base/common/async';
|
|
60
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
61
|
+
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands.service';
|
|
62
|
+
import { ActionRunner } from 'vscode/vscode/vs/base/common/actions';
|
|
63
|
+
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
64
|
+
import { ContextKeys } from './scmViewPane.js';
|
|
65
|
+
import { WorkbenchToolBar } from 'vscode/vscode/vs/platform/actions/browser/toolbar';
|
|
66
|
+
import { IProgressService } from 'vscode/vscode/vs/platform/progress/common/progress.service';
|
|
67
|
+
|
|
68
|
+
var RepositoryRenderer_1, HistoryItemRenderer_1, HistoryItemLoadMoreRenderer_1;
|
|
69
|
+
const historyItemAdditionsForeground = registerColor('scmGraph.historyItemHoverAdditionsForeground', 'gitDecoration.addedResourceForeground', ( localize(6467, "History item hover additions foreground color.")));
|
|
70
|
+
const historyItemDeletionsForeground = registerColor('scmGraph.historyItemHoverDeletionsForeground', 'gitDecoration.deletedResourceForeground', ( localize(6468, "History item hover deletions foreground color.")));
|
|
71
|
+
registerAction2(class extends ViewAction {
|
|
72
|
+
constructor() {
|
|
73
|
+
super({
|
|
74
|
+
id: 'workbench.scm.action.refreshGraph',
|
|
75
|
+
title: ( localize(6469, "Refresh")),
|
|
76
|
+
viewId: HISTORY_VIEW_PANE_ID,
|
|
77
|
+
f1: false,
|
|
78
|
+
icon: Codicon.refresh,
|
|
79
|
+
menu: {
|
|
80
|
+
id: MenuId.SCMHistoryTitle,
|
|
81
|
+
when: ( (ContextKeyExpr.or(
|
|
82
|
+
(ContextKeyExpr.has('scmRepository')),
|
|
83
|
+
(ContextKeyExpr.and(
|
|
84
|
+
(ContextKeys.RepositoryVisibilityCount.isEqualTo(1)),
|
|
85
|
+
(ContextKeyExpr.equals('config.scm.alwaysShowRepositories', false))
|
|
86
|
+
))
|
|
87
|
+
))),
|
|
88
|
+
group: 'navigation',
|
|
89
|
+
order: 1000
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
async runInView(accessor, view, provider) {
|
|
94
|
+
const scmService = accessor.get(ISCMService);
|
|
95
|
+
const repository = provider ? scmService.getRepository(provider.id) : undefined;
|
|
96
|
+
view.refresh(repository);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
class ListDelegate {
|
|
100
|
+
getHeight() {
|
|
101
|
+
return 22;
|
|
102
|
+
}
|
|
103
|
+
getTemplateId(element) {
|
|
104
|
+
if (isSCMRepository(element)) {
|
|
105
|
+
return RepositoryRenderer.TEMPLATE_ID;
|
|
106
|
+
}
|
|
107
|
+
else if (isSCMHistoryItemViewModelTreeElement(element)) {
|
|
108
|
+
return HistoryItemRenderer.TEMPLATE_ID;
|
|
109
|
+
}
|
|
110
|
+
else if (isSCMHistoryItemLoadMoreTreeElement(element)) {
|
|
111
|
+
return HistoryItemLoadMoreRenderer.TEMPLATE_ID;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
throw ( (new Error('Unknown element')));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
let RepositoryRenderer = class RepositoryRenderer {
|
|
119
|
+
static { RepositoryRenderer_1 = this; }
|
|
120
|
+
static { this.TEMPLATE_ID = 'repository'; }
|
|
121
|
+
get templateId() { return RepositoryRenderer_1.TEMPLATE_ID; }
|
|
122
|
+
constructor(description, actionRunner, actionViewItemProvider, commandService, contextKeyService, contextMenuService, hoverService, keybindingService, menuService, telemetryService) {
|
|
123
|
+
this.description = description;
|
|
124
|
+
this.actionRunner = actionRunner;
|
|
125
|
+
this.actionViewItemProvider = actionViewItemProvider;
|
|
126
|
+
this.commandService = commandService;
|
|
127
|
+
this.contextKeyService = contextKeyService;
|
|
128
|
+
this.contextMenuService = contextMenuService;
|
|
129
|
+
this.hoverService = hoverService;
|
|
130
|
+
this.keybindingService = keybindingService;
|
|
131
|
+
this.menuService = menuService;
|
|
132
|
+
this.telemetryService = telemetryService;
|
|
133
|
+
}
|
|
134
|
+
renderTemplate(container) {
|
|
135
|
+
if (container.classList.contains('monaco-tl-contents')) {
|
|
136
|
+
container.parentElement.parentElement.querySelector('.monaco-tl-twistie').classList.add('force-twistie');
|
|
137
|
+
}
|
|
138
|
+
const element = append(container, $('.scm-provider'));
|
|
139
|
+
const label = ( (new IconLabel(element)));
|
|
140
|
+
const labelCustomHover = this.hoverService.setupManagedHover(getDefaultHoverDelegate('mouse'), label.element, '', {});
|
|
141
|
+
const stateLabel = append(element, $('div.state-label.monaco-count-badge.long'));
|
|
142
|
+
const toolBar = ( (new WorkbenchToolBar(
|
|
143
|
+
append(element, $('.actions')),
|
|
144
|
+
{ actionRunner: this.actionRunner, actionViewItemProvider: this.actionViewItemProvider, resetMenu: MenuId.SCMHistoryTitle },
|
|
145
|
+
this.menuService,
|
|
146
|
+
this.contextKeyService,
|
|
147
|
+
this.contextMenuService,
|
|
148
|
+
this.keybindingService,
|
|
149
|
+
this.commandService,
|
|
150
|
+
this.telemetryService
|
|
151
|
+
)));
|
|
152
|
+
return { label, labelCustomHover, stateLabel, toolBar, elementDisposables: ( (new DisposableStore())), templateDisposable: combinedDisposable(labelCustomHover, toolBar) };
|
|
153
|
+
}
|
|
154
|
+
renderElement(arg, index, templateData, height) {
|
|
155
|
+
const repository = isSCMRepository(arg) ? arg : arg.element;
|
|
156
|
+
templateData.elementDisposables.add(autorun(reader => {
|
|
157
|
+
const description = this.description(repository).read(reader);
|
|
158
|
+
templateData.stateLabel.style.display = description !== '' ? '' : 'none';
|
|
159
|
+
templateData.stateLabel.textContent = description;
|
|
160
|
+
}));
|
|
161
|
+
templateData.label.setLabel(repository.provider.name);
|
|
162
|
+
templateData.labelCustomHover.update(repository.provider.rootUri ? `${repository.provider.label}: ${repository.provider.rootUri.fsPath}` : repository.provider.label);
|
|
163
|
+
templateData.elementDisposables.add(autorunWithStore((reader, store) => {
|
|
164
|
+
const currentHistoryItemGroup = repository.provider.historyProvider.read(reader)?.currentHistoryItemGroup.read(reader);
|
|
165
|
+
if (!currentHistoryItemGroup) {
|
|
166
|
+
templateData.toolBar.setActions([], []);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const contextKeyService = this.contextKeyService.createOverlay([
|
|
170
|
+
['scmRepository', repository.id],
|
|
171
|
+
['scmProvider', repository.provider.contextValue],
|
|
172
|
+
['scmHistoryItemGroupHasRemote', !!currentHistoryItemGroup.remote],
|
|
173
|
+
]);
|
|
174
|
+
const menu = this.menuService.createMenu(MenuId.SCMHistoryTitle, contextKeyService);
|
|
175
|
+
store.add(connectPrimaryMenu(menu, (primary, secondary) => {
|
|
176
|
+
templateData.toolBar.setActions(primary, secondary);
|
|
177
|
+
}));
|
|
178
|
+
}));
|
|
179
|
+
templateData.toolBar.context = repository.provider;
|
|
180
|
+
}
|
|
181
|
+
disposeElement(group, index, template) {
|
|
182
|
+
template.elementDisposables.clear();
|
|
183
|
+
}
|
|
184
|
+
disposeTemplate(templateData) {
|
|
185
|
+
templateData.elementDisposables.dispose();
|
|
186
|
+
templateData.templateDisposable.dispose();
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
RepositoryRenderer = RepositoryRenderer_1 = ( (__decorate([
|
|
190
|
+
( (__param(3, ICommandService))),
|
|
191
|
+
( (__param(4, IContextKeyService))),
|
|
192
|
+
( (__param(5, IContextMenuService))),
|
|
193
|
+
( (__param(6, IHoverService))),
|
|
194
|
+
( (__param(7, IKeybindingService))),
|
|
195
|
+
( (__param(8, IMenuService))),
|
|
196
|
+
( (__param(9, ITelemetryService)))
|
|
197
|
+
], RepositoryRenderer)));
|
|
198
|
+
let HistoryItemRenderer = class HistoryItemRenderer {
|
|
199
|
+
static { HistoryItemRenderer_1 = this; }
|
|
200
|
+
static { this.TEMPLATE_ID = 'history-item'; }
|
|
201
|
+
get templateId() { return HistoryItemRenderer_1.TEMPLATE_ID; }
|
|
202
|
+
constructor(hoverDelegate, hoverService, themeService) {
|
|
203
|
+
this.hoverDelegate = hoverDelegate;
|
|
204
|
+
this.hoverService = hoverService;
|
|
205
|
+
this.themeService = themeService;
|
|
206
|
+
}
|
|
207
|
+
renderTemplate(container) {
|
|
208
|
+
container.parentElement.parentElement.querySelector('.monaco-tl-twistie').classList.add('force-no-twistie');
|
|
209
|
+
const element = append(container, $('.history-item'));
|
|
210
|
+
const graphContainer = append(element, $('.graph-container'));
|
|
211
|
+
const iconLabel = ( (new IconLabel(
|
|
212
|
+
element,
|
|
213
|
+
{ supportIcons: true, supportHighlights: true, supportDescriptionHighlights: true }
|
|
214
|
+
)));
|
|
215
|
+
const labelContainer = append(element, $('.label-container'));
|
|
216
|
+
element.appendChild(labelContainer);
|
|
217
|
+
return { element, graphContainer, label: iconLabel, labelContainer, elementDisposables: ( (new DisposableStore())), disposables: ( (new DisposableStore())) };
|
|
218
|
+
}
|
|
219
|
+
renderElement(node, index, templateData, height) {
|
|
220
|
+
const historyItemViewModel = node.element.historyItemViewModel;
|
|
221
|
+
const historyItem = historyItemViewModel.historyItem;
|
|
222
|
+
const historyItemHover = this.hoverService.setupManagedHover(this.hoverDelegate, templateData.element, this.getTooltip(node.element));
|
|
223
|
+
templateData.elementDisposables.add(historyItemHover);
|
|
224
|
+
templateData.graphContainer.textContent = '';
|
|
225
|
+
templateData.graphContainer.appendChild(renderSCMHistoryItemGraph(historyItemViewModel));
|
|
226
|
+
const [matches, descriptionMatches] = this.processMatches(historyItemViewModel, node.filterData);
|
|
227
|
+
templateData.label.setLabel(historyItem.message, historyItem.author, { matches, descriptionMatches });
|
|
228
|
+
templateData.labelContainer.textContent = '';
|
|
229
|
+
if (historyItem.labels) {
|
|
230
|
+
const labels = this.getLabels(node.element.repository);
|
|
231
|
+
for (const label of historyItem.labels) {
|
|
232
|
+
if (label.icon && ThemeIcon.isThemeIcon(label.icon) && labels.includes(label.title)) {
|
|
233
|
+
const icon = append(templateData.labelContainer, $('div.label'));
|
|
234
|
+
icon.classList.add(...ThemeIcon.asClassNameArray(label.icon));
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
getLabels(repository) {
|
|
240
|
+
const currentHistoryItemGroup = repository.provider.historyProvider.get()?.currentHistoryItemGroup.get();
|
|
241
|
+
if (!currentHistoryItemGroup) {
|
|
242
|
+
return [];
|
|
243
|
+
}
|
|
244
|
+
return [
|
|
245
|
+
currentHistoryItemGroup.name,
|
|
246
|
+
currentHistoryItemGroup.remote?.name,
|
|
247
|
+
currentHistoryItemGroup.base?.name
|
|
248
|
+
]
|
|
249
|
+
.filter(l => l !== undefined);
|
|
250
|
+
}
|
|
251
|
+
getTooltip(element) {
|
|
252
|
+
const colorTheme = this.themeService.getColorTheme();
|
|
253
|
+
const historyItem = element.historyItemViewModel.historyItem;
|
|
254
|
+
const currentHistoryItemGroup = element.repository.provider.historyProvider.get()?.currentHistoryItemGroup?.get();
|
|
255
|
+
const markdown = ( (new MarkdownString('', { isTrusted: true, supportThemeIcons: true })));
|
|
256
|
+
if (historyItem.author) {
|
|
257
|
+
markdown.appendMarkdown(`$(account) **${historyItem.author}**`);
|
|
258
|
+
if (historyItem.timestamp) {
|
|
259
|
+
const dateFormatter = new Intl.DateTimeFormat(language, { year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric' });
|
|
260
|
+
markdown.appendMarkdown(`, $(history) ${fromNow(historyItem.timestamp, true, true)} (${dateFormatter.format(historyItem.timestamp)})`);
|
|
261
|
+
}
|
|
262
|
+
markdown.appendMarkdown('\n\n');
|
|
263
|
+
}
|
|
264
|
+
markdown.appendMarkdown(`${historyItem.message}\n\n`);
|
|
265
|
+
if (historyItem.statistics) {
|
|
266
|
+
markdown.appendMarkdown(`---\n\n`);
|
|
267
|
+
markdown.appendMarkdown(`<span>${historyItem.statistics.files === 1 ?
|
|
268
|
+
( localize(6470, "{0} file changed", historyItem.statistics.files)) :
|
|
269
|
+
( localize(6471, "{0} files changed", historyItem.statistics.files))}</span>`);
|
|
270
|
+
if (historyItem.statistics.insertions) {
|
|
271
|
+
const historyItemAdditionsForegroundColor = colorTheme.getColor(historyItemAdditionsForeground);
|
|
272
|
+
markdown.appendMarkdown(`, <span style="color:${historyItemAdditionsForegroundColor};">${historyItem.statistics.insertions === 1 ?
|
|
273
|
+
( localize(6472, "{0} insertion{1}", historyItem.statistics.insertions, '(+)')) :
|
|
274
|
+
( localize(6473, "{0} insertions{1}", historyItem.statistics.insertions, '(+)'))}</span>`);
|
|
275
|
+
}
|
|
276
|
+
if (historyItem.statistics.deletions) {
|
|
277
|
+
const historyItemDeletionsForegroundColor = colorTheme.getColor(historyItemDeletionsForeground);
|
|
278
|
+
markdown.appendMarkdown(`, <span style="color:${historyItemDeletionsForegroundColor};">${historyItem.statistics.deletions === 1 ?
|
|
279
|
+
( localize(6474, "{0} deletion{1}", historyItem.statistics.deletions, '(-)')) :
|
|
280
|
+
( localize(6475, "{0} deletions{1}", historyItem.statistics.deletions, '(-)'))}</span>`);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
const labels = this.getLabels(element.repository);
|
|
284
|
+
const historyItemLabels = (historyItem.labels ?? [])
|
|
285
|
+
.filter(l => labels.includes(l.title));
|
|
286
|
+
if (historyItemLabels.length > 0) {
|
|
287
|
+
const historyItemGroupLocalColor = colorTheme.getColor(historyItemGroupLocal);
|
|
288
|
+
const historyItemGroupRemoteColor = colorTheme.getColor(historyItemGroupRemote);
|
|
289
|
+
const historyItemGroupBaseColor = colorTheme.getColor(historyItemGroupBase);
|
|
290
|
+
const historyItemGroupHoverLabelForegroundColor = colorTheme.getColor(historyItemGroupHoverLabelForeground);
|
|
291
|
+
markdown.appendMarkdown(`\n\n---\n\n`);
|
|
292
|
+
markdown.appendMarkdown(( (historyItemLabels.map(label => {
|
|
293
|
+
const historyItemGroupHoverLabelBackgroundColor = label.title === currentHistoryItemGroup?.name ? historyItemGroupLocalColor :
|
|
294
|
+
label.title === currentHistoryItemGroup?.remote?.name ? historyItemGroupRemoteColor :
|
|
295
|
+
label.title === currentHistoryItemGroup?.base?.name ? historyItemGroupBaseColor :
|
|
296
|
+
undefined;
|
|
297
|
+
const historyItemGroupHoverLabelIconId = ThemeIcon.isThemeIcon(label.icon) ? label.icon.id : '';
|
|
298
|
+
return `<span style="color:${historyItemGroupHoverLabelForegroundColor};background-color:${historyItemGroupHoverLabelBackgroundColor};border-radius:2px;"> $(${historyItemGroupHoverLabelIconId}) ${label.title} </span>`;
|
|
299
|
+
}))).join(' '));
|
|
300
|
+
}
|
|
301
|
+
return { markdown, markdownNotSupportedFallback: historyItem.message };
|
|
302
|
+
}
|
|
303
|
+
processMatches(historyItemViewModel, filterData) {
|
|
304
|
+
if (!filterData) {
|
|
305
|
+
return [undefined, undefined];
|
|
306
|
+
}
|
|
307
|
+
return [
|
|
308
|
+
historyItemViewModel.historyItem.message === filterData.label ? createMatches(filterData.score) : undefined,
|
|
309
|
+
historyItemViewModel.historyItem.author === filterData.label ? createMatches(filterData.score) : undefined
|
|
310
|
+
];
|
|
311
|
+
}
|
|
312
|
+
disposeElement(element, index, templateData, height) {
|
|
313
|
+
templateData.elementDisposables.clear();
|
|
314
|
+
}
|
|
315
|
+
disposeTemplate(templateData) {
|
|
316
|
+
templateData.disposables.dispose();
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
HistoryItemRenderer = HistoryItemRenderer_1 = ( (__decorate([
|
|
320
|
+
( (__param(1, IHoverService))),
|
|
321
|
+
( (__param(2, IThemeService)))
|
|
322
|
+
], HistoryItemRenderer)));
|
|
323
|
+
let HistoryItemLoadMoreRenderer = class HistoryItemLoadMoreRenderer {
|
|
324
|
+
static { HistoryItemLoadMoreRenderer_1 = this; }
|
|
325
|
+
static { this.TEMPLATE_ID = 'historyItemLoadMore'; }
|
|
326
|
+
get templateId() { return HistoryItemLoadMoreRenderer_1.TEMPLATE_ID; }
|
|
327
|
+
constructor(_loadingMore, _loadMoreCallback, _configurationService, _scmViewService) {
|
|
328
|
+
this._loadingMore = _loadingMore;
|
|
329
|
+
this._loadMoreCallback = _loadMoreCallback;
|
|
330
|
+
this._configurationService = _configurationService;
|
|
331
|
+
this._scmViewService = _scmViewService;
|
|
332
|
+
}
|
|
333
|
+
renderTemplate(container) {
|
|
334
|
+
container.parentElement.parentElement.querySelector('.monaco-tl-twistie').classList.add('force-no-twistie');
|
|
335
|
+
const element = append(container, $('.history-item-load-more'));
|
|
336
|
+
const graphPlaceholder = append(element, $('.graph-placeholder'));
|
|
337
|
+
const historyItemPlaceholderContainer = append(element, $('.history-item-placeholder'));
|
|
338
|
+
const historyItemPlaceholderLabel = ( (new IconLabel(historyItemPlaceholderContainer, { supportIcons: true })));
|
|
339
|
+
return { element, graphPlaceholder, historyItemPlaceholderContainer, historyItemPlaceholderLabel, elementDisposables: ( (new DisposableStore())), disposables: ( (new DisposableStore())) };
|
|
340
|
+
}
|
|
341
|
+
renderElement(element, index, templateData, height) {
|
|
342
|
+
const repositoryCount = this._scmViewService.visibleRepositories.length;
|
|
343
|
+
const alwaysShowRepositories = this._configurationService.getValue('scm.alwaysShowRepositories') === true;
|
|
344
|
+
templateData.graphPlaceholder.textContent = '';
|
|
345
|
+
templateData.graphPlaceholder.style.width = `${SWIMLANE_WIDTH * (element.element.graphColumns.length + 1)}px`;
|
|
346
|
+
templateData.graphPlaceholder.appendChild(renderSCMHistoryGraphPlaceholder(element.element.graphColumns));
|
|
347
|
+
templateData.historyItemPlaceholderContainer.classList.toggle('shimmer', repositoryCount === 1 && !alwaysShowRepositories);
|
|
348
|
+
if (repositoryCount > 1 || alwaysShowRepositories) {
|
|
349
|
+
templateData.elementDisposables.add(autorun(reader => {
|
|
350
|
+
const loadingMore = this._loadingMore(element.element.repository).read(reader);
|
|
351
|
+
const icon = `$(${loadingMore ? 'loading~spin' : 'fold-down'})`;
|
|
352
|
+
templateData.historyItemPlaceholderLabel.setLabel(( localize(6476, "{0} Load More...", icon)));
|
|
353
|
+
}));
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
templateData.historyItemPlaceholderLabel.setLabel('');
|
|
357
|
+
this._loadMoreCallback(element.element.repository);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
disposeTemplate(templateData) {
|
|
361
|
+
templateData.disposables.dispose();
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
HistoryItemLoadMoreRenderer = HistoryItemLoadMoreRenderer_1 = ( (__decorate([
|
|
365
|
+
( (__param(2, IConfigurationService))),
|
|
366
|
+
( (__param(3, ISCMViewService)))
|
|
367
|
+
], HistoryItemLoadMoreRenderer)));
|
|
368
|
+
class HistoryItemActionRunner extends ActionRunner {
|
|
369
|
+
constructor(getSelectedHistoryItems) {
|
|
370
|
+
super();
|
|
371
|
+
this.getSelectedHistoryItems = getSelectedHistoryItems;
|
|
372
|
+
}
|
|
373
|
+
async runAction(action, context) {
|
|
374
|
+
if (!(action instanceof MenuItemAction)) {
|
|
375
|
+
return super.runAction(action, context);
|
|
376
|
+
}
|
|
377
|
+
const args = [];
|
|
378
|
+
args.push(context.repository.provider);
|
|
379
|
+
const selection = this.getSelectedHistoryItems();
|
|
380
|
+
const contextIsSelected = ( (selection.some(s => s === context)));
|
|
381
|
+
if (contextIsSelected && selection.length > 1) {
|
|
382
|
+
args.push(...( (selection.map(h => ({
|
|
383
|
+
id: h.historyItemViewModel.historyItem.id,
|
|
384
|
+
parentIds: h.historyItemViewModel.historyItem.parentIds,
|
|
385
|
+
message: h.historyItemViewModel.historyItem.message,
|
|
386
|
+
author: h.historyItemViewModel.historyItem.author,
|
|
387
|
+
icon: h.historyItemViewModel.historyItem.icon,
|
|
388
|
+
timestamp: h.historyItemViewModel.historyItem.timestamp,
|
|
389
|
+
statistics: h.historyItemViewModel.historyItem.statistics,
|
|
390
|
+
})))));
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
args.push({
|
|
394
|
+
id: context.historyItemViewModel.historyItem.id,
|
|
395
|
+
parentIds: context.historyItemViewModel.historyItem.parentIds,
|
|
396
|
+
message: context.historyItemViewModel.historyItem.message,
|
|
397
|
+
author: context.historyItemViewModel.historyItem.author,
|
|
398
|
+
icon: context.historyItemViewModel.historyItem.icon,
|
|
399
|
+
timestamp: context.historyItemViewModel.historyItem.timestamp,
|
|
400
|
+
statistics: context.historyItemViewModel.historyItem.statistics,
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
await action.run(...args);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
let HistoryItemHoverDelegate = class HistoryItemHoverDelegate extends WorkbenchHoverDelegate {
|
|
407
|
+
constructor(_viewContainerLocation, layoutService, configurationService, hoverService) {
|
|
408
|
+
super('element', true, () => this.getHoverOptions(), configurationService, hoverService);
|
|
409
|
+
this._viewContainerLocation = _viewContainerLocation;
|
|
410
|
+
this.layoutService = layoutService;
|
|
411
|
+
}
|
|
412
|
+
getHoverOptions() {
|
|
413
|
+
const sideBarPosition = this.layoutService.getSideBarPosition();
|
|
414
|
+
let hoverPosition;
|
|
415
|
+
if (this._viewContainerLocation === ViewContainerLocation.Sidebar) {
|
|
416
|
+
hoverPosition = sideBarPosition === Position.LEFT ? HoverPosition.RIGHT : HoverPosition.LEFT;
|
|
417
|
+
}
|
|
418
|
+
else if (this._viewContainerLocation === ViewContainerLocation.AuxiliaryBar) {
|
|
419
|
+
hoverPosition = sideBarPosition === Position.LEFT ? HoverPosition.LEFT : HoverPosition.RIGHT;
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
hoverPosition = HoverPosition.RIGHT;
|
|
423
|
+
}
|
|
424
|
+
return { additionalClasses: ['history-item-hover'], position: { hoverPosition, forcePosition: true } };
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
HistoryItemHoverDelegate = ( (__decorate([
|
|
428
|
+
( (__param(1, IWorkbenchLayoutService))),
|
|
429
|
+
( (__param(2, IConfigurationService))),
|
|
430
|
+
( (__param(3, IHoverService)))
|
|
431
|
+
], HistoryItemHoverDelegate)));
|
|
432
|
+
let SCMHistoryViewPaneActionRunner = class SCMHistoryViewPaneActionRunner extends ActionRunner {
|
|
433
|
+
constructor(_progressService) {
|
|
434
|
+
super();
|
|
435
|
+
this._progressService = _progressService;
|
|
436
|
+
}
|
|
437
|
+
runAction(action, context) {
|
|
438
|
+
return this._progressService.withProgress({ location: HISTORY_VIEW_PANE_ID }, async () => await super.runAction(action, context));
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
SCMHistoryViewPaneActionRunner = ( (__decorate([
|
|
442
|
+
( (__param(0, IProgressService)))
|
|
443
|
+
], SCMHistoryViewPaneActionRunner)));
|
|
444
|
+
class SCMHistoryTreeAccessibilityProvider {
|
|
445
|
+
getWidgetAriaLabel() {
|
|
446
|
+
return ( localize(6477, "Source Control History"));
|
|
447
|
+
}
|
|
448
|
+
getAriaLabel(element) {
|
|
449
|
+
if (isSCMRepository(element)) {
|
|
450
|
+
return `${element.provider.name} ${element.provider.label}`;
|
|
451
|
+
}
|
|
452
|
+
else if (isSCMHistoryItemViewModelTreeElement(element)) {
|
|
453
|
+
const historyItem = element.historyItemViewModel.historyItem;
|
|
454
|
+
return `${stripIcons(historyItem.message).trim()}${historyItem.author ? `, ${historyItem.author}` : ''}`;
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
return '';
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
class SCMHistoryTreeIdentityProvider {
|
|
462
|
+
getId(element) {
|
|
463
|
+
if (isSCMRepository(element)) {
|
|
464
|
+
const provider = element.provider;
|
|
465
|
+
return `repo:${provider.id}`;
|
|
466
|
+
}
|
|
467
|
+
else if (isSCMHistoryItemViewModelTreeElement(element)) {
|
|
468
|
+
const provider = element.repository.provider;
|
|
469
|
+
const historyItem = element.historyItemViewModel.historyItem;
|
|
470
|
+
return `historyItem:${provider.id}/${historyItem.id}/${historyItem.parentIds.join(',')}`;
|
|
471
|
+
}
|
|
472
|
+
else if (isSCMHistoryItemLoadMoreTreeElement(element)) {
|
|
473
|
+
const provider = element.repository.provider;
|
|
474
|
+
return `historyItemLoadMore:${provider.id}}`;
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
throw ( (new Error('Invalid tree element')));
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
class SCMHistoryTreeKeyboardNavigationLabelProvider {
|
|
482
|
+
getKeyboardNavigationLabel(element) {
|
|
483
|
+
if (isSCMRepository(element)) {
|
|
484
|
+
return undefined;
|
|
485
|
+
}
|
|
486
|
+
else if (isSCMHistoryItemViewModelTreeElement(element)) {
|
|
487
|
+
return [element.historyItemViewModel.historyItem.message, element.historyItemViewModel.historyItem.author];
|
|
488
|
+
}
|
|
489
|
+
else if (isSCMHistoryItemLoadMoreTreeElement(element)) {
|
|
490
|
+
return '';
|
|
491
|
+
}
|
|
492
|
+
else {
|
|
493
|
+
throw ( (new Error('Invalid tree element')));
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
let SCMHistoryTreeDataSource = class SCMHistoryTreeDataSource extends Disposable {
|
|
498
|
+
constructor(_configurationService, _scmViewService) {
|
|
499
|
+
super();
|
|
500
|
+
this._configurationService = _configurationService;
|
|
501
|
+
this._scmViewService = _scmViewService;
|
|
502
|
+
this._state = ( (new Map()));
|
|
503
|
+
}
|
|
504
|
+
async getChildren(inputOrElement) {
|
|
505
|
+
const repositoryCount = this._scmViewService.visibleRepositories.length;
|
|
506
|
+
const alwaysShowRepositories = this._configurationService.getValue('scm.alwaysShowRepositories') === true;
|
|
507
|
+
if (isSCMViewService(inputOrElement) && (repositoryCount > 1 || alwaysShowRepositories)) {
|
|
508
|
+
return this._scmViewService.visibleRepositories;
|
|
509
|
+
}
|
|
510
|
+
else if ((isSCMViewService(inputOrElement) && repositoryCount === 1 && !alwaysShowRepositories) || isSCMRepository(inputOrElement)) {
|
|
511
|
+
const children = [];
|
|
512
|
+
inputOrElement = isSCMRepository(inputOrElement) ? inputOrElement : this._scmViewService.visibleRepositories[0];
|
|
513
|
+
const historyItems = await this._getHistoryItems(inputOrElement);
|
|
514
|
+
children.push(...historyItems);
|
|
515
|
+
const lastHistoryItem = tail(historyItems);
|
|
516
|
+
if (lastHistoryItem && lastHistoryItem.historyItemViewModel.outputSwimlanes.length > 0) {
|
|
517
|
+
children.push({
|
|
518
|
+
repository: inputOrElement,
|
|
519
|
+
graphColumns: lastHistoryItem.historyItemViewModel.outputSwimlanes,
|
|
520
|
+
type: 'historyItemLoadMore'
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
return children;
|
|
524
|
+
}
|
|
525
|
+
return [];
|
|
526
|
+
}
|
|
527
|
+
hasChildren(inputOrElement) {
|
|
528
|
+
if (isSCMViewService(inputOrElement)) {
|
|
529
|
+
return this._scmViewService.visibleRepositories.length !== 0;
|
|
530
|
+
}
|
|
531
|
+
else if (isSCMRepository(inputOrElement)) {
|
|
532
|
+
return true;
|
|
533
|
+
}
|
|
534
|
+
else if (isSCMHistoryItemViewModelTreeElement(inputOrElement)) {
|
|
535
|
+
return false;
|
|
536
|
+
}
|
|
537
|
+
else if (isSCMHistoryItemLoadMoreTreeElement(inputOrElement)) {
|
|
538
|
+
return false;
|
|
539
|
+
}
|
|
540
|
+
else {
|
|
541
|
+
throw ( (new Error('hasChildren not implemented.')));
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
clearState(repository) {
|
|
545
|
+
if (!repository) {
|
|
546
|
+
this._state.clear();
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
this._state.delete(repository);
|
|
550
|
+
}
|
|
551
|
+
loadMore(repository) {
|
|
552
|
+
const state = this._state.get(repository);
|
|
553
|
+
if (!state) {
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
this._state.set(repository, { ...state, loadMore: true });
|
|
557
|
+
}
|
|
558
|
+
async _getHistoryItems(element) {
|
|
559
|
+
let state = this._state.get(element);
|
|
560
|
+
const historyProvider = element.provider.historyProvider.get();
|
|
561
|
+
const currentHistoryItemGroup = state?.currentHistoryItemGroup ?? historyProvider?.currentHistoryItemGroup.get();
|
|
562
|
+
if (!historyProvider || !currentHistoryItemGroup) {
|
|
563
|
+
return [];
|
|
564
|
+
}
|
|
565
|
+
if (!state || state.loadMore) {
|
|
566
|
+
const historyItemGroupIds = [
|
|
567
|
+
currentHistoryItemGroup.revision ?? currentHistoryItemGroup.id,
|
|
568
|
+
...(currentHistoryItemGroup.remote ? [currentHistoryItemGroup.remote.revision ?? currentHistoryItemGroup.remote.id] : []),
|
|
569
|
+
...(currentHistoryItemGroup.base ? [currentHistoryItemGroup.base.revision ?? currentHistoryItemGroup.base.id] : []),
|
|
570
|
+
];
|
|
571
|
+
const existingHistoryItems = state?.items ?? [];
|
|
572
|
+
const historyItems = (await historyProvider.provideHistoryItems2({
|
|
573
|
+
historyItemGroupIds, limit: 50, skip: existingHistoryItems.length
|
|
574
|
+
})) ?? [];
|
|
575
|
+
state = {
|
|
576
|
+
currentHistoryItemGroup,
|
|
577
|
+
items: [...existingHistoryItems, ...historyItems],
|
|
578
|
+
loadMore: false
|
|
579
|
+
};
|
|
580
|
+
this._state.set(element, state);
|
|
581
|
+
}
|
|
582
|
+
const colorMap = ( (new Map([
|
|
583
|
+
[currentHistoryItemGroup.name, historyItemGroupLocal]
|
|
584
|
+
])));
|
|
585
|
+
if (currentHistoryItemGroup.remote) {
|
|
586
|
+
colorMap.set(currentHistoryItemGroup.remote.name, historyItemGroupRemote);
|
|
587
|
+
}
|
|
588
|
+
if (currentHistoryItemGroup.base) {
|
|
589
|
+
colorMap.set(currentHistoryItemGroup.base.name, historyItemGroupBase);
|
|
590
|
+
}
|
|
591
|
+
return (
|
|
592
|
+
(toISCMHistoryItemViewModelArray(state.items, colorMap)
|
|
593
|
+
.map(historyItemViewModel => ({
|
|
594
|
+
repository: element,
|
|
595
|
+
historyItemViewModel,
|
|
596
|
+
type: 'historyItem2'
|
|
597
|
+
})))
|
|
598
|
+
);
|
|
599
|
+
}
|
|
600
|
+
dispose() {
|
|
601
|
+
this._state.clear();
|
|
602
|
+
super.dispose();
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
SCMHistoryTreeDataSource = ( (__decorate([
|
|
606
|
+
( (__param(0, IConfigurationService))),
|
|
607
|
+
( (__param(1, ISCMViewService)))
|
|
608
|
+
], SCMHistoryTreeDataSource)));
|
|
609
|
+
let SCMHistoryViewPane = class SCMHistoryViewPane extends ViewPane {
|
|
610
|
+
constructor(options, _commandService, _scmViewService, _progressService, configurationService, contextMenuService, keybindingService, instantiationService, viewDescriptorService, contextKeyService, openerService, themeService, telemetryService, hoverService) {
|
|
611
|
+
super({ ...options, titleMenuId: MenuId.SCMHistoryTitle }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService, hoverService);
|
|
612
|
+
this._commandService = _commandService;
|
|
613
|
+
this._scmViewService = _scmViewService;
|
|
614
|
+
this._progressService = _progressService;
|
|
615
|
+
this._repositoryDescription = ( (new Map()));
|
|
616
|
+
this._repositoryLoadMore = ( (new Map()));
|
|
617
|
+
this._repositories = ( (new DisposableMap()));
|
|
618
|
+
this._visibilityDisposables = ( (new DisposableStore()));
|
|
619
|
+
this._treeOperationSequencer = ( (new Sequencer()));
|
|
620
|
+
this._updateChildrenThrottler = ( (new Throttler()));
|
|
621
|
+
this._providerCountBadgeConfig = observableConfigValue('scm.providerCountBadge', 'hidden', this.configurationService);
|
|
622
|
+
this._scmHistoryItemGroupHasRemoteContextKey = this.scopedContextKeyService.createKey('scmHistoryItemGroupHasRemote', undefined);
|
|
623
|
+
this._actionRunner = this.instantiationService.createInstance(SCMHistoryViewPaneActionRunner);
|
|
624
|
+
this._register(this._actionRunner);
|
|
625
|
+
this._register(this._updateChildrenThrottler);
|
|
626
|
+
}
|
|
627
|
+
layoutBody(height, width) {
|
|
628
|
+
super.layoutBody(height, width);
|
|
629
|
+
this._tree.layout(height, width);
|
|
630
|
+
}
|
|
631
|
+
renderBody(container) {
|
|
632
|
+
super.renderBody(container);
|
|
633
|
+
this._treeContainer = append(container, $('.scm-view.scm-history-view'));
|
|
634
|
+
this._treeContainer.classList.add('file-icon-themable-tree');
|
|
635
|
+
this._register(autorun(reader => {
|
|
636
|
+
const providerCountBadgeConfig = this._providerCountBadgeConfig.read(reader);
|
|
637
|
+
this._treeContainer.classList.toggle('hide-provider-counts', providerCountBadgeConfig === 'hidden');
|
|
638
|
+
this._treeContainer.classList.toggle('auto-provider-counts', providerCountBadgeConfig === 'auto');
|
|
639
|
+
}));
|
|
640
|
+
this._createTree(this._treeContainer);
|
|
641
|
+
this.onDidChangeBodyVisibility(visible => {
|
|
642
|
+
if (visible) {
|
|
643
|
+
this._treeOperationSequencer.queue(async () => {
|
|
644
|
+
await this._tree.setInput(this._scmViewService);
|
|
645
|
+
Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.alwaysShowRepositories'), this._visibilityDisposables)(() => {
|
|
646
|
+
this.updateActions();
|
|
647
|
+
this.refresh();
|
|
648
|
+
}, this, this._visibilityDisposables);
|
|
649
|
+
this._scmViewService.onDidChangeVisibleRepositories(this._onDidChangeVisibleRepositories, this, this._visibilityDisposables);
|
|
650
|
+
this._onDidChangeVisibleRepositories({ added: this._scmViewService.visibleRepositories, removed: Iterable.empty() });
|
|
651
|
+
this._tree.scrollTop = 0;
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
else {
|
|
655
|
+
this._treeDataSource.clearState();
|
|
656
|
+
this._visibilityDisposables.clear();
|
|
657
|
+
this._repositories.clearAndDisposeAll();
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
getActionRunner() {
|
|
662
|
+
return this._actionRunner;
|
|
663
|
+
}
|
|
664
|
+
async refresh(repository) {
|
|
665
|
+
this._treeDataSource.clearState(repository);
|
|
666
|
+
await this._updateChildren(repository);
|
|
667
|
+
this._setRepositoryDescription(repository, '');
|
|
668
|
+
this._tree.scrollTop = 0;
|
|
669
|
+
}
|
|
670
|
+
_createTree(container) {
|
|
671
|
+
this._treeIdentityProvider = ( (new SCMHistoryTreeIdentityProvider()));
|
|
672
|
+
const historyItemHoverDelegate = this.instantiationService.createInstance(HistoryItemHoverDelegate, this.viewDescriptorService.getViewLocationById(this.id));
|
|
673
|
+
this._register(historyItemHoverDelegate);
|
|
674
|
+
this._treeDataSource = this.instantiationService.createInstance(SCMHistoryTreeDataSource);
|
|
675
|
+
this._register(this._treeDataSource);
|
|
676
|
+
this._tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'SCM History Tree', container, ( (new ListDelegate())), [
|
|
677
|
+
this.instantiationService.createInstance(RepositoryRenderer, repository => this._getRepositoryDescription(repository), this._actionRunner, getActionViewItemProvider(this.instantiationService)),
|
|
678
|
+
this.instantiationService.createInstance(HistoryItemRenderer, historyItemHoverDelegate),
|
|
679
|
+
this.instantiationService.createInstance(HistoryItemLoadMoreRenderer, repository => this._getLoadMore(repository), repository => this._loadMoreCallback(repository)),
|
|
680
|
+
], this._treeDataSource, {
|
|
681
|
+
accessibilityProvider: ( (new SCMHistoryTreeAccessibilityProvider())),
|
|
682
|
+
identityProvider: this._treeIdentityProvider,
|
|
683
|
+
collapseByDefault: (e) => !isSCMRepository(e),
|
|
684
|
+
keyboardNavigationLabelProvider: ( (new SCMHistoryTreeKeyboardNavigationLabelProvider())),
|
|
685
|
+
horizontalScrolling: false,
|
|
686
|
+
multipleSelectionSupport: false,
|
|
687
|
+
});
|
|
688
|
+
this._register(this._tree);
|
|
689
|
+
this._tree.onDidOpen(this._onDidOpen, this, this._store);
|
|
690
|
+
this._tree.onContextMenu(this._onContextMenu, this, this._store);
|
|
691
|
+
}
|
|
692
|
+
async _onDidOpen(e) {
|
|
693
|
+
if (!e.element) {
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
696
|
+
else if (isSCMRepository(e.element)) {
|
|
697
|
+
this._scmViewService.focus(e.element);
|
|
698
|
+
}
|
|
699
|
+
else if (isSCMHistoryItemViewModelTreeElement(e.element)) {
|
|
700
|
+
const historyItem = e.element.historyItemViewModel.historyItem;
|
|
701
|
+
const historyItemParentId = historyItem.parentIds.length > 0 ? historyItem.parentIds[0] : undefined;
|
|
702
|
+
const historyProvider = e.element.repository.provider.historyProvider.get();
|
|
703
|
+
const historyItemChanges = await historyProvider?.provideHistoryItemChanges(historyItem.id, historyItemParentId);
|
|
704
|
+
if (historyItemChanges) {
|
|
705
|
+
const title = `${historyItem.id.substring(0, 8)} - ${historyItem.message}`;
|
|
706
|
+
const rootUri = e.element.repository.provider.rootUri;
|
|
707
|
+
const path = rootUri ? rootUri.path : e.element.repository.provider.label;
|
|
708
|
+
const multiDiffSourceUri = ( (URI.from(
|
|
709
|
+
{ scheme: 'scm-history-item', path: `${path}/${historyItemParentId}..${historyItem.id}` },
|
|
710
|
+
true
|
|
711
|
+
)));
|
|
712
|
+
await this._commandService.executeCommand('_workbench.openMultiDiffEditor', { title, multiDiffSourceUri, resources: historyItemChanges });
|
|
713
|
+
}
|
|
714
|
+
this._scmViewService.focus(e.element.repository);
|
|
715
|
+
}
|
|
716
|
+
else if (isSCMHistoryItemLoadMoreTreeElement(e.element)) {
|
|
717
|
+
const repositoryCount = this._scmViewService.visibleRepositories.length;
|
|
718
|
+
const alwaysShowRepositories = this.configurationService.getValue('scm.alwaysShowRepositories') === true;
|
|
719
|
+
if (repositoryCount > 1 || alwaysShowRepositories) {
|
|
720
|
+
this._loadMoreCallback(e.element.repository);
|
|
721
|
+
this._tree.setSelection([]);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
_onContextMenu(e) {
|
|
726
|
+
const element = e.element;
|
|
727
|
+
if (!element) {
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
let actions = [];
|
|
731
|
+
let context = element;
|
|
732
|
+
let actionRunner = ( (new HistoryItemActionRunner(() => this._getSelectedHistoryItems())));
|
|
733
|
+
if (isSCMRepository(element)) {
|
|
734
|
+
const menus = this._scmViewService.menus.getRepositoryMenus(element.provider);
|
|
735
|
+
const menu = menus.repositoryContextMenu;
|
|
736
|
+
actions = collectContextMenuActions(menu);
|
|
737
|
+
actionRunner = ( (new RepositoryActionRunner(() => this._getSelectedRepositories())));
|
|
738
|
+
context = element.provider;
|
|
739
|
+
}
|
|
740
|
+
else if (isSCMHistoryItemViewModelTreeElement(element)) {
|
|
741
|
+
const menus = this._scmViewService.menus.getRepositoryMenus(element.repository.provider);
|
|
742
|
+
const menu = menus.historyProviderMenu?.getHistoryItemMenu2(element);
|
|
743
|
+
actions = menu ? collectContextMenuActions(menu) : [];
|
|
744
|
+
}
|
|
745
|
+
actionRunner.onWillRun(() => this._tree.domFocus());
|
|
746
|
+
this.contextMenuService.showContextMenu({
|
|
747
|
+
getAnchor: () => e.anchor,
|
|
748
|
+
getActions: () => actions,
|
|
749
|
+
getActionsContext: () => context,
|
|
750
|
+
actionRunner
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
_onDidChangeVisibleRepositories({ added, removed }) {
|
|
754
|
+
for (const repository of added) {
|
|
755
|
+
const repositoryDisposables = ( (new DisposableStore()));
|
|
756
|
+
repositoryDisposables.add(autorun(reader => {
|
|
757
|
+
const historyProvider = repository.provider.historyProvider.read(reader);
|
|
758
|
+
const currentHistoryItemGroupId = historyProvider?.currentHistoryItemGroupId.read(reader);
|
|
759
|
+
const currentHistoryItemGroupRevision = historyProvider?.currentHistoryItemGroupRevision.read(reader);
|
|
760
|
+
const currentHistoryItemGroupRemoteId = historyProvider?.currentHistoryItemGroupRemoteId.read(reader);
|
|
761
|
+
if (this._scmViewService.visibleRepositories.length === 1) {
|
|
762
|
+
this._scmHistoryItemGroupHasRemoteContextKey.set(!!currentHistoryItemGroupRemoteId);
|
|
763
|
+
}
|
|
764
|
+
else {
|
|
765
|
+
this._scmHistoryItemGroupHasRemoteContextKey.reset();
|
|
766
|
+
}
|
|
767
|
+
if (!currentHistoryItemGroupId && !currentHistoryItemGroupRevision && !currentHistoryItemGroupRemoteId) {
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
this.refresh(repository);
|
|
771
|
+
}));
|
|
772
|
+
repositoryDisposables.add(autorun(reader => {
|
|
773
|
+
const historyProvider = repository.provider.historyProvider.read(reader);
|
|
774
|
+
const currentHistoryItemGroupRemoteRevision = historyProvider?.currentHistoryItemGroupRemoteRevision.read(reader);
|
|
775
|
+
if (!currentHistoryItemGroupRemoteRevision) {
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
if (this._tree.scrollTop === 0) {
|
|
779
|
+
this.refresh(repository);
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
const description = ( localize(6478, "OUTDATED"));
|
|
783
|
+
this._setRepositoryDescription(this._isRepositoryNodeVisible() ? repository : undefined, description);
|
|
784
|
+
}));
|
|
785
|
+
this._repositories.set(repository, repositoryDisposables);
|
|
786
|
+
}
|
|
787
|
+
for (const repository of removed) {
|
|
788
|
+
this._treeDataSource.clearState(repository);
|
|
789
|
+
this._repositoryDescription.delete(repository);
|
|
790
|
+
this._repositoryLoadMore.delete(repository);
|
|
791
|
+
this._repositories.deleteAndDispose(repository);
|
|
792
|
+
}
|
|
793
|
+
this._updateChildren();
|
|
794
|
+
}
|
|
795
|
+
_getSelectedRepositories() {
|
|
796
|
+
const focusedRepositories = this._tree.getFocus().filter(r => !!r && isSCMRepository(r));
|
|
797
|
+
const selectedRepositories = this._tree.getSelection().filter(r => !!r && isSCMRepository(r));
|
|
798
|
+
return Array.from(( (new Set([...focusedRepositories, ...selectedRepositories]))));
|
|
799
|
+
}
|
|
800
|
+
_getSelectedHistoryItems() {
|
|
801
|
+
return this._tree.getSelection()
|
|
802
|
+
.filter(r => !!r && isSCMHistoryItemViewModelTreeElement(r));
|
|
803
|
+
}
|
|
804
|
+
_getLoadMore(repository) {
|
|
805
|
+
let loadMore = this._repositoryLoadMore.get(repository);
|
|
806
|
+
if (!loadMore) {
|
|
807
|
+
loadMore = observableValue(this, false);
|
|
808
|
+
this._repositoryLoadMore.set(repository, loadMore);
|
|
809
|
+
}
|
|
810
|
+
return loadMore;
|
|
811
|
+
}
|
|
812
|
+
async _loadMoreCallback(repository) {
|
|
813
|
+
const loadMore = this._getLoadMore(repository);
|
|
814
|
+
if (loadMore.get()) {
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
loadMore.set(true, undefined);
|
|
818
|
+
this._treeDataSource.loadMore(repository);
|
|
819
|
+
await this._updateChildren(repository);
|
|
820
|
+
loadMore.set(false, undefined);
|
|
821
|
+
}
|
|
822
|
+
_getRepositoryDescription(repository) {
|
|
823
|
+
let description = this._repositoryDescription.get(repository);
|
|
824
|
+
if (!description) {
|
|
825
|
+
description = observableValue(this, '');
|
|
826
|
+
this._repositoryDescription.set(repository, description);
|
|
827
|
+
}
|
|
828
|
+
return description;
|
|
829
|
+
}
|
|
830
|
+
_setRepositoryDescription(repository, description) {
|
|
831
|
+
if (!repository) {
|
|
832
|
+
this.updateTitleDescription(description);
|
|
833
|
+
}
|
|
834
|
+
else {
|
|
835
|
+
this._getRepositoryDescription(repository).set(description, undefined);
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
_isRepositoryNodeVisible() {
|
|
839
|
+
const repositoryCount = this._scmViewService.visibleRepositories.length;
|
|
840
|
+
const alwaysShowRepositories = this.configurationService.getValue('scm.alwaysShowRepositories') === true;
|
|
841
|
+
return alwaysShowRepositories || repositoryCount > 1;
|
|
842
|
+
}
|
|
843
|
+
_updateChildren(element) {
|
|
844
|
+
return this._updateChildrenThrottler.queue(() => this._treeOperationSequencer.queue(async () => {
|
|
845
|
+
await this._progressService.withProgress({ location: this.id }, async () => {
|
|
846
|
+
if (element && this._tree.hasNode(element)) {
|
|
847
|
+
await this._tree.updateChildren(element, undefined, undefined, {
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
else {
|
|
851
|
+
await this._tree.updateChildren(undefined, undefined, undefined, {
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
});
|
|
855
|
+
}));
|
|
856
|
+
}
|
|
857
|
+
dispose() {
|
|
858
|
+
this._visibilityDisposables.dispose();
|
|
859
|
+
this._repositories.dispose();
|
|
860
|
+
super.dispose();
|
|
861
|
+
}
|
|
862
|
+
};
|
|
863
|
+
SCMHistoryViewPane = ( (__decorate([
|
|
864
|
+
( (__param(1, ICommandService))),
|
|
865
|
+
( (__param(2, ISCMViewService))),
|
|
866
|
+
( (__param(3, IProgressService))),
|
|
867
|
+
( (__param(4, IConfigurationService))),
|
|
868
|
+
( (__param(5, IContextMenuService))),
|
|
869
|
+
( (__param(6, IKeybindingService))),
|
|
870
|
+
( (__param(7, IInstantiationService))),
|
|
871
|
+
( (__param(8, IViewDescriptorService))),
|
|
872
|
+
( (__param(9, IContextKeyService))),
|
|
873
|
+
( (__param(10, IOpenerService))),
|
|
874
|
+
( (__param(11, IThemeService))),
|
|
875
|
+
( (__param(12, ITelemetryService))),
|
|
876
|
+
( (__param(13, IHoverService)))
|
|
877
|
+
], SCMHistoryViewPane)));
|
|
878
|
+
|
|
879
|
+
export { SCMHistoryViewPane };
|