@codingame/monaco-vscode-scm-service-override 4.0.0 → 4.1.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/scm.js +4 -4
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/external/tslib/tslib.es6.js +0 -11
- package/vscode/src/vs/workbench/contrib/scm/browser/activity.js +0 -308
- package/vscode/src/vs/workbench/contrib/scm/browser/media/scm.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/scm/browser/menus.js +0 -280
- package/vscode/src/vs/workbench/contrib/scm/browser/scm.contribution.js +0 -702
- package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoriesViewPane.js +0 -174
- package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoryRenderer.js +0 -136
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPane.js +0 -3367
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPaneContainer.js +0 -54
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewService.js +0 -305
- package/vscode/src/vs/workbench/contrib/scm/browser/util.js +0 -121
- package/vscode/src/vs/workbench/contrib/scm/common/quickDiffService.js +0 -76
- package/vscode/src/vs/workbench/contrib/scm/common/scmService.js +0 -312
|
@@ -1,3367 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import './media/scm.css.js';
|
|
3
|
-
import { Event, Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
4
|
-
import { basename, dirname } from 'vscode/vscode/vs/base/common/resources';
|
|
5
|
-
import { Disposable, DisposableStore, toDisposable, combinedDisposable, MutableDisposable, DisposableMap, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
6
|
-
import { ViewAction, ViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
|
|
7
|
-
import { append, $, prepend, Dimension, trackFocus, clearNode, asCSSUrl } from 'vscode/vscode/vs/base/browser/dom';
|
|
8
|
-
import { VIEW_PANE_ID, SCMInputChangeReason, ISCMViewService, ISCMService } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm';
|
|
9
|
-
import { ResourceLabels } from 'vscode/vscode/vs/workbench/browser/labels';
|
|
10
|
-
import { CountBadge } from 'vscode/vscode/vs/base/browser/ui/countBadge/countBadge';
|
|
11
|
-
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
12
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
13
|
-
import { IContextMenuService, IContextViewService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
|
|
14
|
-
import { RawContextKey, ContextKeyExpr, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
15
|
-
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
16
|
-
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
17
|
-
import { MenuId, MenuRegistry, registerAction2, Action2, MenuItemAction, IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
18
|
-
import { Action, Separator, ActionRunner } from 'vscode/vscode/vs/base/common/actions';
|
|
19
|
-
import { ActionBar } from 'vscode/vscode/vs/base/browser/ui/actionbar/actionbar';
|
|
20
|
-
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
21
|
-
import { connectPrimaryMenuToInlineActionBar, connectPrimaryMenu, getActionViewItemProvider, isSCMRepository, isSCMResourceGroup, isSCMResourceNode, isSCMHistoryItemChangeNode, isSCMInput, isSCMActionButton, isSCMResource, isSCMHistoryItemGroupTreeElement, isSCMHistoryItemTreeElement, isSCMHistoryItemChangeTreeElement, toDiffEditorArguments, collectContextMenuActions, isSCMViewService, isSCMViewSeparator } from './util.js';
|
|
22
|
-
import { WorkbenchCompressibleAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
23
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
24
|
-
import { disposableTimeout, ThrottledDelayer, Sequencer, Throttler } from 'vscode/vscode/vs/base/common/async';
|
|
25
|
-
import { ResourceTree } from 'vscode/vscode/vs/base/common/resourceTree';
|
|
26
|
-
import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
|
|
27
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
28
|
-
import { FileKind } from 'vscode/vscode/vs/platform/files/common/files';
|
|
29
|
-
import { comparePaths, compareFileNames } from 'vscode/vscode/vs/base/common/comparers';
|
|
30
|
-
import { createMatches } from 'vscode/vscode/vs/base/common/filters';
|
|
31
|
-
import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views';
|
|
32
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
33
|
-
import { flatten } from 'vscode/vscode/vs/base/common/arrays';
|
|
34
|
-
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
35
|
-
import { EditorResourceAccessor, SideBySideEditor } from 'vscode/vscode/vs/workbench/common/editor';
|
|
36
|
-
import { PANEL_BACKGROUND, SIDE_BAR_BACKGROUND } from 'vscode/vscode/vs/workbench/common/theme';
|
|
37
|
-
import { CodeEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/codeEditor/codeEditorWidget';
|
|
38
|
-
import { getSimpleEditorOptions } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions';
|
|
39
|
-
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
40
|
-
import { EditorExtensionsRegistry } from 'vscode/vscode/vs/editor/browser/editorExtensions';
|
|
41
|
-
import { MenuPreventer } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/menuPreventer';
|
|
42
|
-
import { SelectionClipboardContributionID } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/selectionClipboard';
|
|
43
|
-
import { EditorDictation } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/dictation/editorDictation';
|
|
44
|
-
import { ContextMenuController } from 'vscode/vscode/vs/editor/contrib/contextmenu/browser/contextmenu';
|
|
45
|
-
import { isMacintosh } from 'vscode/vscode/vs/base/common/platform';
|
|
46
|
-
import { format, compare } from 'vscode/vscode/vs/base/common/strings';
|
|
47
|
-
import { SuggestController } from 'vscode/vscode/vs/editor/contrib/suggest/browser/suggestController';
|
|
48
|
-
import { SnippetController2 } from 'vscode/vscode/vs/editor/contrib/snippet/browser/snippetController2';
|
|
49
|
-
import { ServiceCollection } from 'vscode/vscode/vs/platform/instantiation/common/serviceCollection';
|
|
50
|
-
import { HoverController } from 'vscode/vscode/vs/editor/contrib/hover/browser/hover';
|
|
51
|
-
import { ColorDetector } from 'vscode/vscode/vs/editor/contrib/colorPicker/browser/colorDetector';
|
|
52
|
-
import { LinkDetector } from 'vscode/vscode/vs/editor/contrib/links/browser/links';
|
|
53
|
-
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
|
|
54
|
-
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
55
|
-
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
56
|
-
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
|
|
57
|
-
import { DEFAULT_FONT_FAMILY } from 'vscode/vscode/vs/base/browser/fonts';
|
|
58
|
-
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
59
|
-
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
60
|
-
import { RepositoryRenderer, RepositoryActionRunner } from './scmRepositoryRenderer.js';
|
|
61
|
-
import { ColorScheme } from 'vscode/vscode/vs/platform/theme/common/theme';
|
|
62
|
-
import { API_OPEN_EDITOR_COMMAND_ID, API_OPEN_DIFF_EDITOR_COMMAND_ID } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorCommands';
|
|
63
|
-
import { createActionViewItem, createAndFillInContextMenuActions, createAndFillInActionBarActions } from 'vscode/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
|
|
64
|
-
import { MarkdownRenderer, openLinkFromMarkdown } from 'vscode/vscode/vs/editor/browser/widget/markdownRenderer/browser/markdownRenderer';
|
|
65
|
-
import { ButtonWithDropdown, Button } from 'vscode/vscode/vs/base/browser/ui/button/button';
|
|
66
|
-
import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
|
|
67
|
-
import { RepositoryContextKeys } from './scmViewService.js';
|
|
68
|
-
import { DragAndDropController } from 'vscode/vscode/vs/editor/contrib/dnd/browser/dnd';
|
|
69
|
-
import { DropIntoEditorController } from 'vscode/vscode/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController';
|
|
70
|
-
import { MessageController } from 'vscode/vscode/vs/editor/contrib/message/browser/messageController';
|
|
71
|
-
import { defaultCountBadgeStyles, defaultButtonStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
|
|
72
|
-
import { InlineCompletionsController } from 'vscode/vscode/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsController';
|
|
73
|
-
import { CodeActionController } from 'vscode/vscode/vs/editor/contrib/codeAction/browser/codeActionController';
|
|
74
|
-
import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
75
|
-
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
76
|
-
import { fillEditorsDragData } from 'vscode/vscode/vs/workbench/browser/dnd';
|
|
77
|
-
import { CodeDataTransfers } from 'vscode/vscode/vs/platform/dnd/browser/dnd';
|
|
78
|
-
import { FormatOnType } from 'vscode/vscode/vs/editor/contrib/format/browser/formatActions';
|
|
79
|
-
import { EditorOptions } from 'vscode/vscode/vs/editor/common/config/editorOptions';
|
|
80
|
-
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
|
|
81
|
-
import { EditOperation } from 'vscode/vscode/vs/editor/common/core/editOperation';
|
|
82
|
-
import { stripIcons } from 'vscode/vscode/vs/base/common/iconLabels';
|
|
83
|
-
import { IconLabel } from 'vscode/vscode/vs/base/browser/ui/iconLabel/iconLabel';
|
|
84
|
-
import { registerColor, transparent } from 'vscode/vscode/vs/platform/theme/common/colorUtils';
|
|
85
|
-
import { foreground } from 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
|
|
86
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
|
|
87
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
|
|
88
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
|
|
89
|
-
import { listActiveSelectionForeground } from 'vscode/vscode/vs/platform/theme/common/colors/listColors';
|
|
90
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
|
|
91
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
|
|
92
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
|
|
93
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
94
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
95
|
-
import { WorkbenchToolBar, MenuWorkbenchToolBar } from 'vscode/vscode/vs/platform/actions/browser/toolbar';
|
|
96
|
-
import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
|
|
97
|
-
import { DropdownWithPrimaryActionViewItem } from 'vscode/vscode/vs/platform/actions/browser/dropdownWithPrimaryActionViewItem';
|
|
98
|
-
import { clamp } from 'vscode/vscode/vs/base/common/numbers';
|
|
99
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
100
|
-
|
|
101
|
-
var ActionButtonRenderer_1, InputRenderer_1, ResourceGroupRenderer_1, ResourceRenderer_1, HistoryItemGroupRenderer_1, HistoryItemRenderer_1, HistoryItemChangeRenderer_1, SeparatorRenderer_1, SCMInputWidget_1;
|
|
102
|
-
registerColor('scm.historyItemAdditionsForeground', {
|
|
103
|
-
dark: 'gitDecoration.addedResourceForeground',
|
|
104
|
-
light: 'gitDecoration.addedResourceForeground',
|
|
105
|
-
hcDark: 'gitDecoration.addedResourceForeground',
|
|
106
|
-
hcLight: 'gitDecoration.addedResourceForeground'
|
|
107
|
-
}, ( localizeWithPath(
|
|
108
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
109
|
-
'scm.historyItemAdditionsForeground',
|
|
110
|
-
"History item additions foreground color."
|
|
111
|
-
)));
|
|
112
|
-
registerColor('scm.historyItemDeletionsForeground', {
|
|
113
|
-
dark: 'gitDecoration.deletedResourceForeground',
|
|
114
|
-
light: 'gitDecoration.deletedResourceForeground',
|
|
115
|
-
hcDark: 'gitDecoration.deletedResourceForeground',
|
|
116
|
-
hcLight: 'gitDecoration.deletedResourceForeground'
|
|
117
|
-
}, ( localizeWithPath(
|
|
118
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
119
|
-
'scm.historyItemDeletionsForeground',
|
|
120
|
-
"History item deletions foreground color."
|
|
121
|
-
)));
|
|
122
|
-
registerColor('scm.historyItemStatisticsBorder', {
|
|
123
|
-
dark: ( transparent(foreground, 0.2)),
|
|
124
|
-
light: ( transparent(foreground, 0.2)),
|
|
125
|
-
hcDark: ( transparent(foreground, 0.2)),
|
|
126
|
-
hcLight: ( transparent(foreground, 0.2))
|
|
127
|
-
}, ( localizeWithPath(
|
|
128
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
129
|
-
'scm.historyItemStatisticsBorder',
|
|
130
|
-
"History item statistics border color."
|
|
131
|
-
)));
|
|
132
|
-
registerColor('scm.historyItemSelectedStatisticsBorder', {
|
|
133
|
-
dark: ( transparent(listActiveSelectionForeground, 0.2)),
|
|
134
|
-
light: ( transparent(listActiveSelectionForeground, 0.2)),
|
|
135
|
-
hcDark: ( transparent(listActiveSelectionForeground, 0.2)),
|
|
136
|
-
hcLight: ( transparent(listActiveSelectionForeground, 0.2))
|
|
137
|
-
}, ( localizeWithPath(
|
|
138
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
139
|
-
'scm.historyItemSelectedStatisticsBorder',
|
|
140
|
-
"History item selected statistics border color."
|
|
141
|
-
)));
|
|
142
|
-
let ActionButtonRenderer = class ActionButtonRenderer {
|
|
143
|
-
static { ActionButtonRenderer_1 = this; }
|
|
144
|
-
static { this.DEFAULT_HEIGHT = 30; }
|
|
145
|
-
static { this.TEMPLATE_ID = 'actionButton'; }
|
|
146
|
-
get templateId() { return ActionButtonRenderer_1.TEMPLATE_ID; }
|
|
147
|
-
constructor(commandService, contextMenuService, notificationService) {
|
|
148
|
-
this.commandService = commandService;
|
|
149
|
-
this.contextMenuService = contextMenuService;
|
|
150
|
-
this.notificationService = notificationService;
|
|
151
|
-
this.actionButtons = ( new Map());
|
|
152
|
-
}
|
|
153
|
-
renderTemplate(container) {
|
|
154
|
-
container.parentElement.parentElement.querySelector('.monaco-tl-twistie').classList.add('force-no-twistie');
|
|
155
|
-
container.parentElement.parentElement.classList.add('cursor-default', 'force-no-hover');
|
|
156
|
-
const buttonContainer = append(container, $('.button-container'));
|
|
157
|
-
const actionButton = ( new SCMActionButton(
|
|
158
|
-
buttonContainer,
|
|
159
|
-
this.contextMenuService,
|
|
160
|
-
this.commandService,
|
|
161
|
-
this.notificationService
|
|
162
|
-
));
|
|
163
|
-
return { actionButton, disposable: Disposable.None, templateDisposable: actionButton };
|
|
164
|
-
}
|
|
165
|
-
renderElement(node, index, templateData, height) {
|
|
166
|
-
templateData.disposable.dispose();
|
|
167
|
-
const disposables = ( new DisposableStore());
|
|
168
|
-
const actionButton = node.element;
|
|
169
|
-
templateData.actionButton.setButton(node.element.button);
|
|
170
|
-
const renderedActionButtons = this.actionButtons.get(actionButton) ?? [];
|
|
171
|
-
this.actionButtons.set(actionButton, [...renderedActionButtons, templateData.actionButton]);
|
|
172
|
-
disposables.add({
|
|
173
|
-
dispose: () => {
|
|
174
|
-
const renderedActionButtons = this.actionButtons.get(actionButton) ?? [];
|
|
175
|
-
const renderedWidgetIndex = renderedActionButtons.findIndex(renderedActionButton => renderedActionButton === templateData.actionButton);
|
|
176
|
-
if (renderedWidgetIndex < 0) {
|
|
177
|
-
throw new Error('Disposing unknown action button');
|
|
178
|
-
}
|
|
179
|
-
if (renderedActionButtons.length === 1) {
|
|
180
|
-
this.actionButtons.delete(actionButton);
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
renderedActionButtons.splice(renderedWidgetIndex, 1);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
templateData.disposable = disposables;
|
|
188
|
-
}
|
|
189
|
-
renderCompressedElements() {
|
|
190
|
-
throw new Error('Should never happen since node is incompressible');
|
|
191
|
-
}
|
|
192
|
-
focusActionButton(actionButton) {
|
|
193
|
-
this.actionButtons.get(actionButton)?.forEach(renderedActionButton => renderedActionButton.focus());
|
|
194
|
-
}
|
|
195
|
-
disposeElement(node, index, template) {
|
|
196
|
-
template.disposable.dispose();
|
|
197
|
-
}
|
|
198
|
-
disposeTemplate(templateData) {
|
|
199
|
-
templateData.disposable.dispose();
|
|
200
|
-
templateData.templateDisposable.dispose();
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
ActionButtonRenderer = ActionButtonRenderer_1 = ( __decorate([
|
|
204
|
-
( __param(0, ICommandService)),
|
|
205
|
-
( __param(1, IContextMenuService)),
|
|
206
|
-
( __param(2, INotificationService))
|
|
207
|
-
], ActionButtonRenderer));
|
|
208
|
-
class SCMTreeDragAndDrop {
|
|
209
|
-
constructor(instantiationService) {
|
|
210
|
-
this.instantiationService = instantiationService;
|
|
211
|
-
}
|
|
212
|
-
getDragURI(element) {
|
|
213
|
-
if (isSCMResource(element)) {
|
|
214
|
-
return ( element.sourceUri.toString());
|
|
215
|
-
}
|
|
216
|
-
return null;
|
|
217
|
-
}
|
|
218
|
-
onDragStart(data, originalEvent) {
|
|
219
|
-
const items = SCMTreeDragAndDrop.getResourcesFromDragAndDropData(data);
|
|
220
|
-
if (originalEvent.dataTransfer && items?.length) {
|
|
221
|
-
this.instantiationService.invokeFunction(accessor => fillEditorsDragData(accessor, items, originalEvent));
|
|
222
|
-
const fileResources = ( items.filter(s => s.scheme === Schemas.file).map(r => r.fsPath));
|
|
223
|
-
if (fileResources.length) {
|
|
224
|
-
originalEvent.dataTransfer.setData(CodeDataTransfers.FILES, JSON.stringify(fileResources));
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
getDragLabel(elements, originalEvent) {
|
|
229
|
-
if (elements.length === 1) {
|
|
230
|
-
const element = elements[0];
|
|
231
|
-
if (isSCMResource(element)) {
|
|
232
|
-
return basename(element.sourceUri);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
return String(elements.length);
|
|
236
|
-
}
|
|
237
|
-
onDragOver(data, targetElement, targetIndex, targetSector, originalEvent) {
|
|
238
|
-
return true;
|
|
239
|
-
}
|
|
240
|
-
drop(data, targetElement, targetIndex, targetSector, originalEvent) { }
|
|
241
|
-
static getResourcesFromDragAndDropData(data) {
|
|
242
|
-
const uris = [];
|
|
243
|
-
for (const element of [...(data.context ?? []), ...data.elements]) {
|
|
244
|
-
if (isSCMResource(element)) {
|
|
245
|
-
uris.push(element.sourceUri);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
return uris;
|
|
249
|
-
}
|
|
250
|
-
dispose() { }
|
|
251
|
-
}
|
|
252
|
-
let InputRenderer = class InputRenderer {
|
|
253
|
-
static { InputRenderer_1 = this; }
|
|
254
|
-
static { this.DEFAULT_HEIGHT = 26; }
|
|
255
|
-
static { this.TEMPLATE_ID = 'input'; }
|
|
256
|
-
get templateId() { return InputRenderer_1.TEMPLATE_ID; }
|
|
257
|
-
constructor(outerLayout, overflowWidgetsDomNode, updateHeight, instantiationService) {
|
|
258
|
-
this.outerLayout = outerLayout;
|
|
259
|
-
this.overflowWidgetsDomNode = overflowWidgetsDomNode;
|
|
260
|
-
this.updateHeight = updateHeight;
|
|
261
|
-
this.instantiationService = instantiationService;
|
|
262
|
-
this.inputWidgets = ( new Map());
|
|
263
|
-
this.contentHeights = ( new WeakMap());
|
|
264
|
-
this.editorSelections = ( new WeakMap());
|
|
265
|
-
}
|
|
266
|
-
renderTemplate(container) {
|
|
267
|
-
container.parentElement.parentElement.querySelector('.monaco-tl-twistie').classList.add('force-no-twistie');
|
|
268
|
-
container.parentElement.parentElement.classList.add('force-no-hover');
|
|
269
|
-
const templateDisposable = ( new DisposableStore());
|
|
270
|
-
const inputElement = append(container, $('.scm-input'));
|
|
271
|
-
const inputWidget = this.instantiationService.createInstance(SCMInputWidget, inputElement, this.overflowWidgetsDomNode);
|
|
272
|
-
templateDisposable.add(inputWidget);
|
|
273
|
-
return { inputWidget, inputWidgetHeight: InputRenderer_1.DEFAULT_HEIGHT, elementDisposables: ( new DisposableStore()), templateDisposable };
|
|
274
|
-
}
|
|
275
|
-
renderElement(node, index, templateData) {
|
|
276
|
-
const input = node.element;
|
|
277
|
-
templateData.inputWidget.setInput(input);
|
|
278
|
-
const renderedWidgets = this.inputWidgets.get(input) ?? [];
|
|
279
|
-
this.inputWidgets.set(input, [...renderedWidgets, templateData.inputWidget]);
|
|
280
|
-
templateData.elementDisposables.add({
|
|
281
|
-
dispose: () => {
|
|
282
|
-
const renderedWidgets = this.inputWidgets.get(input) ?? [];
|
|
283
|
-
const renderedWidgetIndex = renderedWidgets.findIndex(renderedWidget => renderedWidget === templateData.inputWidget);
|
|
284
|
-
if (renderedWidgetIndex < 0) {
|
|
285
|
-
throw new Error('Disposing unknown input widget');
|
|
286
|
-
}
|
|
287
|
-
if (renderedWidgets.length === 1) {
|
|
288
|
-
this.inputWidgets.delete(input);
|
|
289
|
-
}
|
|
290
|
-
else {
|
|
291
|
-
renderedWidgets.splice(renderedWidgetIndex, 1);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
const selections = this.editorSelections.get(input);
|
|
296
|
-
if (selections) {
|
|
297
|
-
templateData.inputWidget.selections = selections;
|
|
298
|
-
}
|
|
299
|
-
templateData.elementDisposables.add(toDisposable(() => {
|
|
300
|
-
const selections = templateData.inputWidget.selections;
|
|
301
|
-
if (selections) {
|
|
302
|
-
this.editorSelections.set(input, selections);
|
|
303
|
-
}
|
|
304
|
-
}));
|
|
305
|
-
templateData.inputWidgetHeight = InputRenderer_1.DEFAULT_HEIGHT;
|
|
306
|
-
const onDidChangeContentHeight = () => {
|
|
307
|
-
const contentHeight = templateData.inputWidget.getContentHeight();
|
|
308
|
-
this.contentHeights.set(input, contentHeight);
|
|
309
|
-
if (templateData.inputWidgetHeight !== contentHeight) {
|
|
310
|
-
this.updateHeight(input, contentHeight + 10);
|
|
311
|
-
templateData.inputWidgetHeight = contentHeight;
|
|
312
|
-
templateData.inputWidget.layout();
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
const startListeningContentHeightChange = () => {
|
|
316
|
-
templateData.elementDisposables.add(templateData.inputWidget.onDidChangeContentHeight(onDidChangeContentHeight));
|
|
317
|
-
onDidChangeContentHeight();
|
|
318
|
-
};
|
|
319
|
-
disposableTimeout(startListeningContentHeightChange, 0, templateData.elementDisposables);
|
|
320
|
-
const layoutEditor = () => templateData.inputWidget.layout();
|
|
321
|
-
templateData.elementDisposables.add(this.outerLayout.onDidChange(layoutEditor));
|
|
322
|
-
layoutEditor();
|
|
323
|
-
}
|
|
324
|
-
renderCompressedElements() {
|
|
325
|
-
throw new Error('Should never happen since node is incompressible');
|
|
326
|
-
}
|
|
327
|
-
disposeElement(group, index, template) {
|
|
328
|
-
template.elementDisposables.clear();
|
|
329
|
-
}
|
|
330
|
-
disposeTemplate(templateData) {
|
|
331
|
-
templateData.templateDisposable.dispose();
|
|
332
|
-
}
|
|
333
|
-
getHeight(input) {
|
|
334
|
-
return (this.contentHeights.get(input) ?? InputRenderer_1.DEFAULT_HEIGHT) + 10;
|
|
335
|
-
}
|
|
336
|
-
getRenderedInputWidget(input) {
|
|
337
|
-
return this.inputWidgets.get(input);
|
|
338
|
-
}
|
|
339
|
-
getFocusedInput() {
|
|
340
|
-
for (const [input, inputWidgets] of this.inputWidgets) {
|
|
341
|
-
for (const inputWidget of inputWidgets) {
|
|
342
|
-
if (inputWidget.hasFocus()) {
|
|
343
|
-
return input;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
return undefined;
|
|
348
|
-
}
|
|
349
|
-
clearValidation() {
|
|
350
|
-
for (const [, inputWidgets] of this.inputWidgets) {
|
|
351
|
-
for (const inputWidget of inputWidgets) {
|
|
352
|
-
inputWidget.clearValidation();
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
|
-
InputRenderer = InputRenderer_1 = ( __decorate([
|
|
358
|
-
( __param(3, IInstantiationService))
|
|
359
|
-
], InputRenderer));
|
|
360
|
-
let ResourceGroupRenderer = class ResourceGroupRenderer {
|
|
361
|
-
static { ResourceGroupRenderer_1 = this; }
|
|
362
|
-
static { this.TEMPLATE_ID = 'resource group'; }
|
|
363
|
-
get templateId() { return ResourceGroupRenderer_1.TEMPLATE_ID; }
|
|
364
|
-
constructor(actionViewItemProvider, scmViewService) {
|
|
365
|
-
this.actionViewItemProvider = actionViewItemProvider;
|
|
366
|
-
this.scmViewService = scmViewService;
|
|
367
|
-
}
|
|
368
|
-
renderTemplate(container) {
|
|
369
|
-
container.parentElement.parentElement.querySelector('.monaco-tl-twistie').classList.add('force-twistie');
|
|
370
|
-
const element = append(container, $('.resource-group'));
|
|
371
|
-
const name = append(element, $('.name'));
|
|
372
|
-
const actionsContainer = append(element, $('.actions'));
|
|
373
|
-
const actionBar = ( new ActionBar(actionsContainer, { actionViewItemProvider: this.actionViewItemProvider }));
|
|
374
|
-
const countContainer = append(element, $('.count'));
|
|
375
|
-
const count = ( new CountBadge(countContainer, {}, defaultCountBadgeStyles));
|
|
376
|
-
const disposables = combinedDisposable(actionBar);
|
|
377
|
-
return { name, count, actionBar, elementDisposables: ( new DisposableStore()), disposables };
|
|
378
|
-
}
|
|
379
|
-
renderElement(node, index, template) {
|
|
380
|
-
const group = node.element;
|
|
381
|
-
template.name.textContent = group.label;
|
|
382
|
-
template.actionBar.clear();
|
|
383
|
-
template.actionBar.context = group;
|
|
384
|
-
template.count.setCount(group.resources.length);
|
|
385
|
-
const menus = this.scmViewService.menus.getRepositoryMenus(group.provider);
|
|
386
|
-
template.elementDisposables.add(connectPrimaryMenuToInlineActionBar(menus.getResourceGroupMenu(group), template.actionBar));
|
|
387
|
-
}
|
|
388
|
-
renderCompressedElements(node, index, templateData, height) {
|
|
389
|
-
throw new Error('Should never happen since node is incompressible');
|
|
390
|
-
}
|
|
391
|
-
disposeElement(group, index, template) {
|
|
392
|
-
template.elementDisposables.clear();
|
|
393
|
-
}
|
|
394
|
-
disposeTemplate(template) {
|
|
395
|
-
template.elementDisposables.dispose();
|
|
396
|
-
template.disposables.dispose();
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
ResourceGroupRenderer = ResourceGroupRenderer_1 = ( __decorate([
|
|
400
|
-
( __param(1, ISCMViewService))
|
|
401
|
-
], ResourceGroupRenderer));
|
|
402
|
-
class RepositoryPaneActionRunner extends ActionRunner {
|
|
403
|
-
constructor(getSelectedResources) {
|
|
404
|
-
super();
|
|
405
|
-
this.getSelectedResources = getSelectedResources;
|
|
406
|
-
}
|
|
407
|
-
async runAction(action, context) {
|
|
408
|
-
if (!(action instanceof MenuItemAction)) {
|
|
409
|
-
return super.runAction(action, context);
|
|
410
|
-
}
|
|
411
|
-
const selection = this.getSelectedResources();
|
|
412
|
-
const contextIsSelected = ( selection.some(s => s === context));
|
|
413
|
-
const actualContext = contextIsSelected ? selection : [context];
|
|
414
|
-
const args = flatten(( actualContext.map(e => ResourceTree.isResourceNode(e) ? ResourceTree.collect(e) : [e])));
|
|
415
|
-
await action.run(...args);
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
let ResourceRenderer = class ResourceRenderer {
|
|
419
|
-
static { ResourceRenderer_1 = this; }
|
|
420
|
-
static { this.TEMPLATE_ID = 'resource'; }
|
|
421
|
-
get templateId() { return ResourceRenderer_1.TEMPLATE_ID; }
|
|
422
|
-
constructor(viewMode, labels, actionViewItemProvider, actionRunner, labelService, scmViewService, themeService) {
|
|
423
|
-
this.viewMode = viewMode;
|
|
424
|
-
this.labels = labels;
|
|
425
|
-
this.actionViewItemProvider = actionViewItemProvider;
|
|
426
|
-
this.actionRunner = actionRunner;
|
|
427
|
-
this.labelService = labelService;
|
|
428
|
-
this.scmViewService = scmViewService;
|
|
429
|
-
this.themeService = themeService;
|
|
430
|
-
this.disposables = ( new DisposableStore());
|
|
431
|
-
this.renderedResources = ( new Map());
|
|
432
|
-
themeService.onDidColorThemeChange(this.onDidColorThemeChange, this, this.disposables);
|
|
433
|
-
}
|
|
434
|
-
renderTemplate(container) {
|
|
435
|
-
const element = append(container, $('.resource'));
|
|
436
|
-
const name = append(element, $('.name'));
|
|
437
|
-
const fileLabel = this.labels.create(name, { supportDescriptionHighlights: true, supportHighlights: true });
|
|
438
|
-
const actionsContainer = append(fileLabel.element, $('.actions'));
|
|
439
|
-
const actionBar = ( new ActionBar(actionsContainer, {
|
|
440
|
-
actionViewItemProvider: this.actionViewItemProvider,
|
|
441
|
-
actionRunner: this.actionRunner
|
|
442
|
-
}));
|
|
443
|
-
const decorationIcon = append(element, $('.decoration-icon'));
|
|
444
|
-
const actionBarMenuListener = ( new MutableDisposable());
|
|
445
|
-
const disposables = combinedDisposable(actionBar, fileLabel, actionBarMenuListener);
|
|
446
|
-
return { element, name, fileLabel, decorationIcon, actionBar, actionBarMenu: undefined, actionBarMenuListener, elementDisposables: ( new DisposableStore()), disposables };
|
|
447
|
-
}
|
|
448
|
-
renderElement(node, index, template) {
|
|
449
|
-
const resourceOrFolder = node.element;
|
|
450
|
-
const iconResource = ResourceTree.isResourceNode(resourceOrFolder) ? resourceOrFolder.element : resourceOrFolder;
|
|
451
|
-
const uri = ResourceTree.isResourceNode(resourceOrFolder) ? resourceOrFolder.uri : resourceOrFolder.sourceUri;
|
|
452
|
-
const fileKind = ResourceTree.isResourceNode(resourceOrFolder) ? FileKind.FOLDER : FileKind.FILE;
|
|
453
|
-
const tooltip = !ResourceTree.isResourceNode(resourceOrFolder) && resourceOrFolder.decorations.tooltip || '';
|
|
454
|
-
const hidePath = this.viewMode() === "tree" ;
|
|
455
|
-
let matches;
|
|
456
|
-
let descriptionMatches;
|
|
457
|
-
let strikethrough;
|
|
458
|
-
if (ResourceTree.isResourceNode(resourceOrFolder)) {
|
|
459
|
-
if (resourceOrFolder.element) {
|
|
460
|
-
const menus = this.scmViewService.menus.getRepositoryMenus(resourceOrFolder.element.resourceGroup.provider);
|
|
461
|
-
this._renderActionBar(template, resourceOrFolder, menus.getResourceMenu(resourceOrFolder.element));
|
|
462
|
-
template.element.classList.toggle('faded', resourceOrFolder.element.decorations.faded);
|
|
463
|
-
strikethrough = resourceOrFolder.element.decorations.strikeThrough;
|
|
464
|
-
}
|
|
465
|
-
else {
|
|
466
|
-
const menus = this.scmViewService.menus.getRepositoryMenus(resourceOrFolder.context.provider);
|
|
467
|
-
this._renderActionBar(template, resourceOrFolder, menus.getResourceFolderMenu(resourceOrFolder.context));
|
|
468
|
-
matches = createMatches(node.filterData);
|
|
469
|
-
template.element.classList.remove('faded');
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
else {
|
|
473
|
-
const menus = this.scmViewService.menus.getRepositoryMenus(resourceOrFolder.resourceGroup.provider);
|
|
474
|
-
this._renderActionBar(template, resourceOrFolder, menus.getResourceMenu(resourceOrFolder));
|
|
475
|
-
[matches, descriptionMatches] = this._processFilterData(uri, node.filterData);
|
|
476
|
-
template.element.classList.toggle('faded', resourceOrFolder.decorations.faded);
|
|
477
|
-
strikethrough = resourceOrFolder.decorations.strikeThrough;
|
|
478
|
-
}
|
|
479
|
-
const renderedData = {
|
|
480
|
-
tooltip, uri, fileLabelOptions: { hidePath, fileKind, matches, descriptionMatches, strikethrough }, iconResource
|
|
481
|
-
};
|
|
482
|
-
this.renderIcon(template, renderedData);
|
|
483
|
-
this.renderedResources.set(template, renderedData);
|
|
484
|
-
template.elementDisposables.add(toDisposable(() => this.renderedResources.delete(template)));
|
|
485
|
-
template.element.setAttribute('data-tooltip', tooltip);
|
|
486
|
-
}
|
|
487
|
-
disposeElement(resource, index, template) {
|
|
488
|
-
template.elementDisposables.clear();
|
|
489
|
-
}
|
|
490
|
-
renderCompressedElements(node, index, template, height) {
|
|
491
|
-
const compressed = node.element;
|
|
492
|
-
const folder = compressed.elements[compressed.elements.length - 1];
|
|
493
|
-
const label = ( compressed.elements.map(e => e.name));
|
|
494
|
-
const fileKind = FileKind.FOLDER;
|
|
495
|
-
const matches = createMatches(node.filterData);
|
|
496
|
-
template.fileLabel.setResource({ resource: folder.uri, name: label }, {
|
|
497
|
-
fileDecorations: { colors: false, badges: true },
|
|
498
|
-
fileKind,
|
|
499
|
-
matches,
|
|
500
|
-
separator: this.labelService.getSeparator(folder.uri.scheme)
|
|
501
|
-
});
|
|
502
|
-
const menus = this.scmViewService.menus.getRepositoryMenus(folder.context.provider);
|
|
503
|
-
this._renderActionBar(template, folder, menus.getResourceFolderMenu(folder.context));
|
|
504
|
-
template.name.classList.remove('strike-through');
|
|
505
|
-
template.element.classList.remove('faded');
|
|
506
|
-
template.decorationIcon.style.display = 'none';
|
|
507
|
-
template.decorationIcon.style.backgroundImage = '';
|
|
508
|
-
template.element.setAttribute('data-tooltip', '');
|
|
509
|
-
}
|
|
510
|
-
disposeCompressedElements(node, index, template, height) {
|
|
511
|
-
template.elementDisposables.clear();
|
|
512
|
-
}
|
|
513
|
-
disposeTemplate(template) {
|
|
514
|
-
template.elementDisposables.dispose();
|
|
515
|
-
template.disposables.dispose();
|
|
516
|
-
}
|
|
517
|
-
_renderActionBar(template, resourceOrFolder, menu) {
|
|
518
|
-
if (!template.actionBarMenu || template.actionBarMenu !== menu) {
|
|
519
|
-
template.actionBar.clear();
|
|
520
|
-
template.actionBarMenu = menu;
|
|
521
|
-
template.actionBarMenuListener.value = connectPrimaryMenuToInlineActionBar(menu, template.actionBar);
|
|
522
|
-
}
|
|
523
|
-
template.actionBar.context = resourceOrFolder;
|
|
524
|
-
}
|
|
525
|
-
_processFilterData(uri, filterData) {
|
|
526
|
-
if (!filterData) {
|
|
527
|
-
return [undefined, undefined];
|
|
528
|
-
}
|
|
529
|
-
if (!filterData.label) {
|
|
530
|
-
const matches = createMatches(filterData);
|
|
531
|
-
return [matches, undefined];
|
|
532
|
-
}
|
|
533
|
-
const fileName = basename(uri);
|
|
534
|
-
const label = filterData.label;
|
|
535
|
-
const pathLength = label.length - fileName.length;
|
|
536
|
-
const matches = createMatches(filterData.score);
|
|
537
|
-
if (label === fileName) {
|
|
538
|
-
return [matches, undefined];
|
|
539
|
-
}
|
|
540
|
-
const labelMatches = [];
|
|
541
|
-
const descriptionMatches = [];
|
|
542
|
-
for (const match of matches) {
|
|
543
|
-
if (match.start > pathLength) {
|
|
544
|
-
labelMatches.push({
|
|
545
|
-
start: match.start - pathLength,
|
|
546
|
-
end: match.end - pathLength
|
|
547
|
-
});
|
|
548
|
-
}
|
|
549
|
-
else if (match.end < pathLength) {
|
|
550
|
-
descriptionMatches.push(match);
|
|
551
|
-
}
|
|
552
|
-
else {
|
|
553
|
-
labelMatches.push({
|
|
554
|
-
start: 0,
|
|
555
|
-
end: match.end - pathLength
|
|
556
|
-
});
|
|
557
|
-
descriptionMatches.push({
|
|
558
|
-
start: match.start,
|
|
559
|
-
end: pathLength
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
return [labelMatches, descriptionMatches];
|
|
564
|
-
}
|
|
565
|
-
onDidColorThemeChange() {
|
|
566
|
-
for (const [template, data] of this.renderedResources) {
|
|
567
|
-
this.renderIcon(template, data);
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
renderIcon(template, data) {
|
|
571
|
-
const theme = this.themeService.getColorTheme();
|
|
572
|
-
const icon = theme.type === ColorScheme.LIGHT ? data.iconResource?.decorations.icon : data.iconResource?.decorations.iconDark;
|
|
573
|
-
template.fileLabel.setFile(data.uri, {
|
|
574
|
-
...data.fileLabelOptions,
|
|
575
|
-
fileDecorations: { colors: false, badges: !icon },
|
|
576
|
-
});
|
|
577
|
-
if (icon) {
|
|
578
|
-
if (ThemeIcon.isThemeIcon(icon)) {
|
|
579
|
-
template.decorationIcon.className = `decoration-icon ${ThemeIcon.asClassName(icon)}`;
|
|
580
|
-
if (icon.color) {
|
|
581
|
-
template.decorationIcon.style.color = theme.getColor(icon.color.id)?.toString() ?? '';
|
|
582
|
-
}
|
|
583
|
-
template.decorationIcon.style.display = '';
|
|
584
|
-
template.decorationIcon.style.backgroundImage = '';
|
|
585
|
-
}
|
|
586
|
-
else {
|
|
587
|
-
template.decorationIcon.className = 'decoration-icon';
|
|
588
|
-
template.decorationIcon.style.color = '';
|
|
589
|
-
template.decorationIcon.style.display = '';
|
|
590
|
-
template.decorationIcon.style.backgroundImage = asCSSUrl(icon);
|
|
591
|
-
}
|
|
592
|
-
template.decorationIcon.title = data.tooltip;
|
|
593
|
-
}
|
|
594
|
-
else {
|
|
595
|
-
template.decorationIcon.className = 'decoration-icon';
|
|
596
|
-
template.decorationIcon.style.color = '';
|
|
597
|
-
template.decorationIcon.style.display = 'none';
|
|
598
|
-
template.decorationIcon.style.backgroundImage = '';
|
|
599
|
-
template.decorationIcon.title = '';
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
dispose() {
|
|
603
|
-
this.disposables.dispose();
|
|
604
|
-
}
|
|
605
|
-
};
|
|
606
|
-
ResourceRenderer = ResourceRenderer_1 = ( __decorate([
|
|
607
|
-
( __param(4, ILabelService)),
|
|
608
|
-
( __param(5, ISCMViewService)),
|
|
609
|
-
( __param(6, IThemeService))
|
|
610
|
-
], ResourceRenderer));
|
|
611
|
-
class HistoryItemGroupActionRunner extends ActionRunner {
|
|
612
|
-
runAction(action, context) {
|
|
613
|
-
if (!(action instanceof MenuItemAction)) {
|
|
614
|
-
return super.runAction(action, context);
|
|
615
|
-
}
|
|
616
|
-
return action.run(context.repository.provider, context.id);
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
let HistoryItemGroupRenderer = class HistoryItemGroupRenderer {
|
|
620
|
-
static { HistoryItemGroupRenderer_1 = this; }
|
|
621
|
-
static { this.TEMPLATE_ID = 'history-item-group'; }
|
|
622
|
-
get templateId() { return HistoryItemGroupRenderer_1.TEMPLATE_ID; }
|
|
623
|
-
constructor(actionRunner, contextKeyService, contextMenuService, keybindingService, menuService, scmViewService, telemetryService) {
|
|
624
|
-
this.actionRunner = actionRunner;
|
|
625
|
-
this.contextKeyService = contextKeyService;
|
|
626
|
-
this.contextMenuService = contextMenuService;
|
|
627
|
-
this.keybindingService = keybindingService;
|
|
628
|
-
this.menuService = menuService;
|
|
629
|
-
this.scmViewService = scmViewService;
|
|
630
|
-
this.telemetryService = telemetryService;
|
|
631
|
-
}
|
|
632
|
-
renderTemplate(container) {
|
|
633
|
-
container.parentElement.parentElement.querySelector('.monaco-tl-twistie').classList.add('force-twistie');
|
|
634
|
-
const element = append(container, $('.history-item-group'));
|
|
635
|
-
const label = ( new IconLabel(element, { supportIcons: true }));
|
|
636
|
-
const iconContainer = prepend(label.element, $('.icon-container'));
|
|
637
|
-
const templateDisposables = ( new DisposableStore());
|
|
638
|
-
const toolBar = ( new WorkbenchToolBar(
|
|
639
|
-
append(element, $('.actions')),
|
|
640
|
-
{ actionRunner: this.actionRunner, menuOptions: { shouldForwardArgs: true } },
|
|
641
|
-
this.menuService,
|
|
642
|
-
this.contextKeyService,
|
|
643
|
-
this.contextMenuService,
|
|
644
|
-
this.keybindingService,
|
|
645
|
-
this.telemetryService
|
|
646
|
-
));
|
|
647
|
-
templateDisposables.add(toolBar);
|
|
648
|
-
const countContainer = append(element, $('.count'));
|
|
649
|
-
const count = ( new CountBadge(countContainer, {}, defaultCountBadgeStyles));
|
|
650
|
-
return { iconContainer, label, toolBar, count, elementDisposables: ( new DisposableStore()), templateDisposables };
|
|
651
|
-
}
|
|
652
|
-
renderElement(node, index, templateData, height) {
|
|
653
|
-
const historyItemGroup = node.element;
|
|
654
|
-
templateData.iconContainer.className = 'icon-container';
|
|
655
|
-
if (historyItemGroup.icon && ThemeIcon.isThemeIcon(historyItemGroup.icon)) {
|
|
656
|
-
templateData.iconContainer.classList.add(...ThemeIcon.asClassNameArray(historyItemGroup.icon));
|
|
657
|
-
}
|
|
658
|
-
templateData.label.setLabel(historyItemGroup.label, historyItemGroup.description, { title: historyItemGroup.ariaLabel });
|
|
659
|
-
templateData.count.setCount(historyItemGroup.count ?? 0);
|
|
660
|
-
const repositoryMenus = this.scmViewService.menus.getRepositoryMenus(historyItemGroup.repository.provider);
|
|
661
|
-
const historyProviderMenu = repositoryMenus.historyProviderMenu;
|
|
662
|
-
if (historyProviderMenu) {
|
|
663
|
-
const menu = historyProviderMenu.getHistoryItemGroupMenu(historyItemGroup);
|
|
664
|
-
const resetMenuId = historyItemGroup.direction === 'incoming' ? MenuId.SCMIncomingChanges : MenuId.SCMOutgoingChanges;
|
|
665
|
-
templateData.elementDisposables.add(connectPrimaryMenu(menu, (primary, secondary) => {
|
|
666
|
-
templateData.toolBar.setActions(primary, secondary, [resetMenuId]);
|
|
667
|
-
}));
|
|
668
|
-
templateData.toolBar.context = historyItemGroup;
|
|
669
|
-
}
|
|
670
|
-
else {
|
|
671
|
-
templateData.toolBar.setActions([], []);
|
|
672
|
-
templateData.toolBar.context = undefined;
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
renderCompressedElements(node, index, templateData, height) {
|
|
676
|
-
throw new Error('Should never happen since node is incompressible');
|
|
677
|
-
}
|
|
678
|
-
disposeElement(node, index, templateData, height) {
|
|
679
|
-
templateData.elementDisposables.clear();
|
|
680
|
-
}
|
|
681
|
-
disposeTemplate(templateData) {
|
|
682
|
-
templateData.elementDisposables.dispose();
|
|
683
|
-
templateData.templateDisposables.dispose();
|
|
684
|
-
}
|
|
685
|
-
};
|
|
686
|
-
HistoryItemGroupRenderer = HistoryItemGroupRenderer_1 = ( __decorate([
|
|
687
|
-
( __param(1, IContextKeyService)),
|
|
688
|
-
( __param(2, IContextMenuService)),
|
|
689
|
-
( __param(3, IKeybindingService)),
|
|
690
|
-
( __param(4, IMenuService)),
|
|
691
|
-
( __param(5, ISCMViewService)),
|
|
692
|
-
( __param(6, ITelemetryService))
|
|
693
|
-
], HistoryItemGroupRenderer));
|
|
694
|
-
class HistoryItemActionRunner extends ActionRunner {
|
|
695
|
-
async runAction(action, context) {
|
|
696
|
-
if (!(action instanceof MenuItemAction)) {
|
|
697
|
-
return super.runAction(action, context);
|
|
698
|
-
}
|
|
699
|
-
const args = [];
|
|
700
|
-
args.push(context.historyItemGroup.repository.provider);
|
|
701
|
-
args.push({
|
|
702
|
-
id: context.id,
|
|
703
|
-
parentIds: context.parentIds,
|
|
704
|
-
label: context.label,
|
|
705
|
-
description: context.description,
|
|
706
|
-
icon: context.icon,
|
|
707
|
-
timestamp: context.timestamp,
|
|
708
|
-
statistics: context.statistics,
|
|
709
|
-
});
|
|
710
|
-
await action.run(...args);
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
let HistoryItemRenderer = class HistoryItemRenderer {
|
|
714
|
-
static { HistoryItemRenderer_1 = this; }
|
|
715
|
-
static { this.TEMPLATE_ID = 'history-item'; }
|
|
716
|
-
get templateId() { return HistoryItemRenderer_1.TEMPLATE_ID; }
|
|
717
|
-
constructor(actionRunner, actionViewItemProvider, scmViewService) {
|
|
718
|
-
this.actionRunner = actionRunner;
|
|
719
|
-
this.actionViewItemProvider = actionViewItemProvider;
|
|
720
|
-
this.scmViewService = scmViewService;
|
|
721
|
-
}
|
|
722
|
-
renderTemplate(container) {
|
|
723
|
-
container.parentElement.parentElement.querySelector('.monaco-tl-twistie').classList.add('force-twistie');
|
|
724
|
-
const element = append(container, $('.history-item'));
|
|
725
|
-
const iconLabel = ( new IconLabel(element, { supportIcons: true }));
|
|
726
|
-
const iconContainer = prepend(iconLabel.element, $('.icon-container'));
|
|
727
|
-
const disposables = ( new DisposableStore());
|
|
728
|
-
const actionsContainer = append(element, $('.actions'));
|
|
729
|
-
const actionBar = ( new ActionBar(
|
|
730
|
-
actionsContainer,
|
|
731
|
-
{ actionRunner: this.actionRunner, actionViewItemProvider: this.actionViewItemProvider }
|
|
732
|
-
));
|
|
733
|
-
disposables.add(actionBar);
|
|
734
|
-
const statsContainer = append(element, $('.stats-container'));
|
|
735
|
-
const filesLabel = append(statsContainer, $('.files-label'));
|
|
736
|
-
const insertionsLabel = append(statsContainer, $('.insertions-label'));
|
|
737
|
-
const deletionsLabel = append(statsContainer, $('.deletions-label'));
|
|
738
|
-
return { iconContainer, label: iconLabel, actionBar, statsContainer, filesLabel, insertionsLabel, deletionsLabel, elementDisposables: ( new DisposableStore()), disposables };
|
|
739
|
-
}
|
|
740
|
-
renderElement(node, index, templateData, height) {
|
|
741
|
-
const historyItem = node.element;
|
|
742
|
-
templateData.iconContainer.className = 'icon-container';
|
|
743
|
-
if (historyItem.icon && ThemeIcon.isThemeIcon(historyItem.icon)) {
|
|
744
|
-
templateData.iconContainer.classList.add(...ThemeIcon.asClassNameArray(historyItem.icon));
|
|
745
|
-
}
|
|
746
|
-
templateData.label.setLabel(historyItem.label, historyItem.description);
|
|
747
|
-
templateData.actionBar.clear();
|
|
748
|
-
templateData.actionBar.context = historyItem;
|
|
749
|
-
const menus = this.scmViewService.menus.getRepositoryMenus(historyItem.historyItemGroup.repository.provider);
|
|
750
|
-
if (menus.historyProviderMenu) {
|
|
751
|
-
const historyItemMenu = menus.historyProviderMenu.getHistoryItemMenu(historyItem);
|
|
752
|
-
templateData.elementDisposables.add(connectPrimaryMenuToInlineActionBar(historyItemMenu, templateData.actionBar));
|
|
753
|
-
}
|
|
754
|
-
this.renderStatistics(node, index, templateData, height);
|
|
755
|
-
}
|
|
756
|
-
renderCompressedElements(node, index, templateData, height) {
|
|
757
|
-
throw new Error('Should never happen since node is incompressible');
|
|
758
|
-
}
|
|
759
|
-
renderStatistics(node, index, templateData, height) {
|
|
760
|
-
const historyItem = node.element;
|
|
761
|
-
if (historyItem.statistics) {
|
|
762
|
-
const statsAriaLabel = [
|
|
763
|
-
historyItem.statistics.files === 1 ?
|
|
764
|
-
( localizeWithPath(
|
|
765
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
766
|
-
'fileChanged',
|
|
767
|
-
"{0} file changed",
|
|
768
|
-
historyItem.statistics.files
|
|
769
|
-
)) :
|
|
770
|
-
( localizeWithPath(
|
|
771
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
772
|
-
'filesChanged',
|
|
773
|
-
"{0} files changed",
|
|
774
|
-
historyItem.statistics.files
|
|
775
|
-
)),
|
|
776
|
-
historyItem.statistics.insertions === 1 ? ( localizeWithPath(
|
|
777
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
778
|
-
'insertion',
|
|
779
|
-
"{0} insertion{1}",
|
|
780
|
-
historyItem.statistics.insertions,
|
|
781
|
-
'(+)'
|
|
782
|
-
)) :
|
|
783
|
-
historyItem.statistics.insertions > 1 ? ( localizeWithPath(
|
|
784
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
785
|
-
'insertions',
|
|
786
|
-
"{0} insertions{1}",
|
|
787
|
-
historyItem.statistics.insertions,
|
|
788
|
-
'(+)'
|
|
789
|
-
)) : '',
|
|
790
|
-
historyItem.statistics.deletions === 1 ? ( localizeWithPath(
|
|
791
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
792
|
-
'deletion',
|
|
793
|
-
"{0} deletion{1}",
|
|
794
|
-
historyItem.statistics.deletions,
|
|
795
|
-
'(-)'
|
|
796
|
-
)) :
|
|
797
|
-
historyItem.statistics.deletions > 1 ? ( localizeWithPath(
|
|
798
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
799
|
-
'deletions',
|
|
800
|
-
"{0} deletions{1}",
|
|
801
|
-
historyItem.statistics.deletions,
|
|
802
|
-
'(-)'
|
|
803
|
-
)) : ''
|
|
804
|
-
];
|
|
805
|
-
const statsTitle = statsAriaLabel
|
|
806
|
-
.filter(l => l !== '').join(', ');
|
|
807
|
-
templateData.statsContainer.title = statsTitle;
|
|
808
|
-
templateData.statsContainer.setAttribute('aria-label', statsTitle);
|
|
809
|
-
templateData.filesLabel.textContent = ( historyItem.statistics.files.toString());
|
|
810
|
-
templateData.insertionsLabel.textContent = historyItem.statistics.insertions > 0 ? `+${historyItem.statistics.insertions}` : '';
|
|
811
|
-
templateData.insertionsLabel.classList.toggle('hidden', historyItem.statistics.insertions === 0);
|
|
812
|
-
templateData.deletionsLabel.textContent = historyItem.statistics.deletions > 0 ? `-${historyItem.statistics.deletions}` : '';
|
|
813
|
-
templateData.deletionsLabel.classList.toggle('hidden', historyItem.statistics.deletions === 0);
|
|
814
|
-
}
|
|
815
|
-
templateData.statsContainer.classList.toggle('hidden', historyItem.statistics === undefined);
|
|
816
|
-
}
|
|
817
|
-
disposeElement(element, index, templateData, height) {
|
|
818
|
-
templateData.elementDisposables.clear();
|
|
819
|
-
}
|
|
820
|
-
disposeTemplate(templateData) {
|
|
821
|
-
templateData.disposables.dispose();
|
|
822
|
-
}
|
|
823
|
-
};
|
|
824
|
-
HistoryItemRenderer = HistoryItemRenderer_1 = ( __decorate([
|
|
825
|
-
( __param(2, ISCMViewService))
|
|
826
|
-
], HistoryItemRenderer));
|
|
827
|
-
let HistoryItemChangeRenderer = class HistoryItemChangeRenderer {
|
|
828
|
-
static { HistoryItemChangeRenderer_1 = this; }
|
|
829
|
-
static { this.TEMPLATE_ID = 'historyItemChange'; }
|
|
830
|
-
get templateId() { return HistoryItemChangeRenderer_1.TEMPLATE_ID; }
|
|
831
|
-
constructor(viewMode, labels, labelService) {
|
|
832
|
-
this.viewMode = viewMode;
|
|
833
|
-
this.labels = labels;
|
|
834
|
-
this.labelService = labelService;
|
|
835
|
-
}
|
|
836
|
-
renderTemplate(container) {
|
|
837
|
-
const element = append(container, $('.change'));
|
|
838
|
-
const name = append(element, $('.name'));
|
|
839
|
-
const fileLabel = this.labels.create(name, { supportDescriptionHighlights: true, supportHighlights: true });
|
|
840
|
-
const decorationIcon = append(element, $('.decoration-icon'));
|
|
841
|
-
return { element, name, fileLabel, decorationIcon, disposables: ( new DisposableStore()) };
|
|
842
|
-
}
|
|
843
|
-
renderElement(node, index, templateData, height) {
|
|
844
|
-
const historyItemChangeOrFolder = node.element;
|
|
845
|
-
const uri = ResourceTree.isResourceNode(historyItemChangeOrFolder) ? historyItemChangeOrFolder.element?.uri ?? historyItemChangeOrFolder.uri : historyItemChangeOrFolder.uri;
|
|
846
|
-
const fileKind = ResourceTree.isResourceNode(historyItemChangeOrFolder) ? FileKind.FOLDER : FileKind.FILE;
|
|
847
|
-
const hidePath = this.viewMode() === "tree" ;
|
|
848
|
-
templateData.fileLabel.setFile(uri, { fileDecorations: { colors: false, badges: true }, fileKind, hidePath, });
|
|
849
|
-
}
|
|
850
|
-
renderCompressedElements(node, index, templateData, height) {
|
|
851
|
-
const compressed = node.element;
|
|
852
|
-
const folder = compressed.elements[compressed.elements.length - 1];
|
|
853
|
-
const label = ( compressed.elements.map(e => e.name));
|
|
854
|
-
templateData.fileLabel.setResource({ resource: folder.uri, name: label }, {
|
|
855
|
-
fileDecorations: { colors: false, badges: true },
|
|
856
|
-
fileKind: FileKind.FOLDER,
|
|
857
|
-
separator: this.labelService.getSeparator(folder.uri.scheme)
|
|
858
|
-
});
|
|
859
|
-
}
|
|
860
|
-
disposeTemplate(templateData) {
|
|
861
|
-
templateData.disposables.dispose();
|
|
862
|
-
}
|
|
863
|
-
};
|
|
864
|
-
HistoryItemChangeRenderer = HistoryItemChangeRenderer_1 = ( __decorate([
|
|
865
|
-
( __param(2, ILabelService))
|
|
866
|
-
], HistoryItemChangeRenderer));
|
|
867
|
-
let SeparatorRenderer = class SeparatorRenderer {
|
|
868
|
-
static { SeparatorRenderer_1 = this; }
|
|
869
|
-
static { this.TEMPLATE_ID = 'separator'; }
|
|
870
|
-
get templateId() { return SeparatorRenderer_1.TEMPLATE_ID; }
|
|
871
|
-
constructor(contextKeyService, contextMenuService, keybindingService, menuService, telemetryService) {
|
|
872
|
-
this.contextKeyService = contextKeyService;
|
|
873
|
-
this.contextMenuService = contextMenuService;
|
|
874
|
-
this.keybindingService = keybindingService;
|
|
875
|
-
this.menuService = menuService;
|
|
876
|
-
this.telemetryService = telemetryService;
|
|
877
|
-
}
|
|
878
|
-
renderTemplate(container) {
|
|
879
|
-
container.parentElement.parentElement.querySelector('.monaco-tl-twistie').classList.add('force-no-twistie');
|
|
880
|
-
container.parentElement.parentElement.classList.add('cursor-default', 'force-no-hover');
|
|
881
|
-
const disposables = ( new DisposableStore());
|
|
882
|
-
const element = append(container, $('.separator-container'));
|
|
883
|
-
const label = ( new IconLabel(element, { supportIcons: true, }));
|
|
884
|
-
append(element, $('.separator'));
|
|
885
|
-
disposables.add(label);
|
|
886
|
-
const toolBar = ( new MenuWorkbenchToolBar(
|
|
887
|
-
append(element, $('.actions')),
|
|
888
|
-
MenuId.SCMChangesSeparator,
|
|
889
|
-
{ moreIcon: Codicon.gear },
|
|
890
|
-
this.menuService,
|
|
891
|
-
this.contextKeyService,
|
|
892
|
-
this.contextMenuService,
|
|
893
|
-
this.keybindingService,
|
|
894
|
-
this.telemetryService
|
|
895
|
-
));
|
|
896
|
-
disposables.add(toolBar);
|
|
897
|
-
return { label, disposables };
|
|
898
|
-
}
|
|
899
|
-
renderElement(element, index, templateData, height) {
|
|
900
|
-
templateData.label.setLabel(element.element.label, undefined, { title: element.element.ariaLabel });
|
|
901
|
-
}
|
|
902
|
-
renderCompressedElements(node, index, templateData, height) {
|
|
903
|
-
throw new Error('Should never happen since node is incompressible');
|
|
904
|
-
}
|
|
905
|
-
disposeTemplate(templateData) {
|
|
906
|
-
templateData.disposables.dispose();
|
|
907
|
-
}
|
|
908
|
-
};
|
|
909
|
-
SeparatorRenderer = SeparatorRenderer_1 = ( __decorate([
|
|
910
|
-
( __param(0, IContextKeyService)),
|
|
911
|
-
( __param(1, IContextMenuService)),
|
|
912
|
-
( __param(2, IKeybindingService)),
|
|
913
|
-
( __param(3, IMenuService)),
|
|
914
|
-
( __param(4, ITelemetryService))
|
|
915
|
-
], SeparatorRenderer));
|
|
916
|
-
class ListDelegate {
|
|
917
|
-
constructor(inputRenderer) {
|
|
918
|
-
this.inputRenderer = inputRenderer;
|
|
919
|
-
}
|
|
920
|
-
getHeight(element) {
|
|
921
|
-
if (isSCMInput(element)) {
|
|
922
|
-
return this.inputRenderer.getHeight(element);
|
|
923
|
-
}
|
|
924
|
-
else if (isSCMActionButton(element)) {
|
|
925
|
-
return ActionButtonRenderer.DEFAULT_HEIGHT + 10;
|
|
926
|
-
}
|
|
927
|
-
else {
|
|
928
|
-
return 22;
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
getTemplateId(element) {
|
|
932
|
-
if (isSCMRepository(element)) {
|
|
933
|
-
return RepositoryRenderer.TEMPLATE_ID;
|
|
934
|
-
}
|
|
935
|
-
else if (isSCMInput(element)) {
|
|
936
|
-
return InputRenderer.TEMPLATE_ID;
|
|
937
|
-
}
|
|
938
|
-
else if (isSCMActionButton(element)) {
|
|
939
|
-
return ActionButtonRenderer.TEMPLATE_ID;
|
|
940
|
-
}
|
|
941
|
-
else if (isSCMResourceGroup(element)) {
|
|
942
|
-
return ResourceGroupRenderer.TEMPLATE_ID;
|
|
943
|
-
}
|
|
944
|
-
else if (isSCMResource(element) || isSCMResourceNode(element)) {
|
|
945
|
-
return ResourceRenderer.TEMPLATE_ID;
|
|
946
|
-
}
|
|
947
|
-
else if (isSCMHistoryItemGroupTreeElement(element)) {
|
|
948
|
-
return HistoryItemGroupRenderer.TEMPLATE_ID;
|
|
949
|
-
}
|
|
950
|
-
else if (isSCMHistoryItemTreeElement(element)) {
|
|
951
|
-
return HistoryItemRenderer.TEMPLATE_ID;
|
|
952
|
-
}
|
|
953
|
-
else if (isSCMHistoryItemChangeTreeElement(element) || isSCMHistoryItemChangeNode(element)) {
|
|
954
|
-
return HistoryItemChangeRenderer.TEMPLATE_ID;
|
|
955
|
-
}
|
|
956
|
-
else if (isSCMViewSeparator(element)) {
|
|
957
|
-
return SeparatorRenderer.TEMPLATE_ID;
|
|
958
|
-
}
|
|
959
|
-
else {
|
|
960
|
-
throw new Error('Unknown element');
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
class SCMTreeCompressionDelegate {
|
|
965
|
-
isIncompressible(element) {
|
|
966
|
-
if (ResourceTree.isResourceNode(element)) {
|
|
967
|
-
return element.childrenCount === 0 || !element.parent || !element.parent.parent;
|
|
968
|
-
}
|
|
969
|
-
return true;
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
class SCMTreeFilter {
|
|
973
|
-
filter(element) {
|
|
974
|
-
if (isSCMResourceGroup(element)) {
|
|
975
|
-
return element.resources.length > 0 || !element.hideWhenEmpty;
|
|
976
|
-
}
|
|
977
|
-
else {
|
|
978
|
-
return true;
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
class SCMTreeSorter {
|
|
983
|
-
constructor(viewMode, viewSortKey) {
|
|
984
|
-
this.viewMode = viewMode;
|
|
985
|
-
this.viewSortKey = viewSortKey;
|
|
986
|
-
}
|
|
987
|
-
compare(one, other) {
|
|
988
|
-
if (isSCMRepository(one)) {
|
|
989
|
-
if (!isSCMRepository(other)) {
|
|
990
|
-
throw new Error('Invalid comparison');
|
|
991
|
-
}
|
|
992
|
-
return 0;
|
|
993
|
-
}
|
|
994
|
-
if (isSCMInput(one)) {
|
|
995
|
-
return -1;
|
|
996
|
-
}
|
|
997
|
-
else if (isSCMInput(other)) {
|
|
998
|
-
return 1;
|
|
999
|
-
}
|
|
1000
|
-
if (isSCMActionButton(one)) {
|
|
1001
|
-
return -1;
|
|
1002
|
-
}
|
|
1003
|
-
else if (isSCMActionButton(other)) {
|
|
1004
|
-
return 1;
|
|
1005
|
-
}
|
|
1006
|
-
if (isSCMResourceGroup(one)) {
|
|
1007
|
-
return isSCMResourceGroup(other) ? 0 : -1;
|
|
1008
|
-
}
|
|
1009
|
-
if (isSCMViewSeparator(one)) {
|
|
1010
|
-
return isSCMResourceGroup(other) ? 1 : -1;
|
|
1011
|
-
}
|
|
1012
|
-
if (isSCMHistoryItemGroupTreeElement(one)) {
|
|
1013
|
-
return isSCMHistoryItemGroupTreeElement(other) ? 0 : 1;
|
|
1014
|
-
}
|
|
1015
|
-
if (isSCMHistoryItemTreeElement(one)) {
|
|
1016
|
-
if (!isSCMHistoryItemTreeElement(other)) {
|
|
1017
|
-
throw new Error('Invalid comparison');
|
|
1018
|
-
}
|
|
1019
|
-
return 0;
|
|
1020
|
-
}
|
|
1021
|
-
if (isSCMHistoryItemChangeTreeElement(one) || isSCMHistoryItemChangeNode(one)) {
|
|
1022
|
-
if (this.viewMode() === "list" ) {
|
|
1023
|
-
if (!isSCMHistoryItemChangeTreeElement(other)) {
|
|
1024
|
-
throw new Error('Invalid comparison');
|
|
1025
|
-
}
|
|
1026
|
-
return comparePaths(one.uri.fsPath, other.uri.fsPath);
|
|
1027
|
-
}
|
|
1028
|
-
if (!isSCMHistoryItemChangeTreeElement(other) && !isSCMHistoryItemChangeNode(other)) {
|
|
1029
|
-
throw new Error('Invalid comparison');
|
|
1030
|
-
}
|
|
1031
|
-
const oneName = isSCMHistoryItemChangeNode(one) ? one.name : basename(one.uri);
|
|
1032
|
-
const otherName = isSCMHistoryItemChangeNode(other) ? other.name : basename(other.uri);
|
|
1033
|
-
return compareFileNames(oneName, otherName);
|
|
1034
|
-
}
|
|
1035
|
-
if (this.viewMode() === "list" ) {
|
|
1036
|
-
if (this.viewSortKey() === "name" ) {
|
|
1037
|
-
const oneName = basename(one.sourceUri);
|
|
1038
|
-
const otherName = basename(other.sourceUri);
|
|
1039
|
-
return compareFileNames(oneName, otherName);
|
|
1040
|
-
}
|
|
1041
|
-
if (this.viewSortKey() === "status" ) {
|
|
1042
|
-
const oneTooltip = one.decorations.tooltip ?? '';
|
|
1043
|
-
const otherTooltip = other.decorations.tooltip ?? '';
|
|
1044
|
-
if (oneTooltip !== otherTooltip) {
|
|
1045
|
-
return compare(oneTooltip, otherTooltip);
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
const onePath = one.sourceUri.fsPath;
|
|
1049
|
-
const otherPath = other.sourceUri.fsPath;
|
|
1050
|
-
return comparePaths(onePath, otherPath);
|
|
1051
|
-
}
|
|
1052
|
-
const oneIsDirectory = ResourceTree.isResourceNode(one);
|
|
1053
|
-
const otherIsDirectory = ResourceTree.isResourceNode(other);
|
|
1054
|
-
if (oneIsDirectory !== otherIsDirectory) {
|
|
1055
|
-
return oneIsDirectory ? -1 : 1;
|
|
1056
|
-
}
|
|
1057
|
-
const oneName = ResourceTree.isResourceNode(one) ? one.name : basename(one.sourceUri);
|
|
1058
|
-
const otherName = ResourceTree.isResourceNode(other) ? other.name : basename(other.sourceUri);
|
|
1059
|
-
return compareFileNames(oneName, otherName);
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
let SCMTreeKeyboardNavigationLabelProvider = class SCMTreeKeyboardNavigationLabelProvider {
|
|
1063
|
-
constructor(viewMode, labelService) {
|
|
1064
|
-
this.viewMode = viewMode;
|
|
1065
|
-
this.labelService = labelService;
|
|
1066
|
-
}
|
|
1067
|
-
getKeyboardNavigationLabel(element) {
|
|
1068
|
-
if (ResourceTree.isResourceNode(element)) {
|
|
1069
|
-
return element.name;
|
|
1070
|
-
}
|
|
1071
|
-
else if (isSCMRepository(element) || isSCMInput(element) || isSCMActionButton(element)) {
|
|
1072
|
-
return undefined;
|
|
1073
|
-
}
|
|
1074
|
-
else if (isSCMResourceGroup(element)) {
|
|
1075
|
-
return element.label;
|
|
1076
|
-
}
|
|
1077
|
-
else if (isSCMHistoryItemGroupTreeElement(element)) {
|
|
1078
|
-
return element.label;
|
|
1079
|
-
}
|
|
1080
|
-
else if (isSCMHistoryItemTreeElement(element)) {
|
|
1081
|
-
return element.label;
|
|
1082
|
-
}
|
|
1083
|
-
else if (isSCMViewSeparator(element)) {
|
|
1084
|
-
return element.label;
|
|
1085
|
-
}
|
|
1086
|
-
else {
|
|
1087
|
-
if (this.viewMode() === "list" ) {
|
|
1088
|
-
const uri = isSCMResource(element) ? element.sourceUri : element.uri;
|
|
1089
|
-
return [basename(uri), this.labelService.getUriLabel(uri, { relative: true })];
|
|
1090
|
-
}
|
|
1091
|
-
else {
|
|
1092
|
-
return basename(isSCMResource(element) ? element.sourceUri : element.uri);
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
getCompressedNodeKeyboardNavigationLabel(elements) {
|
|
1097
|
-
const folders = elements;
|
|
1098
|
-
return ( folders.map(e => e.name)).join('/');
|
|
1099
|
-
}
|
|
1100
|
-
};
|
|
1101
|
-
SCMTreeKeyboardNavigationLabelProvider = ( __decorate([
|
|
1102
|
-
( __param(1, ILabelService))
|
|
1103
|
-
], SCMTreeKeyboardNavigationLabelProvider));
|
|
1104
|
-
function getSCMResourceId(element) {
|
|
1105
|
-
if (isSCMRepository(element)) {
|
|
1106
|
-
const provider = element.provider;
|
|
1107
|
-
return `repo:${provider.id}`;
|
|
1108
|
-
}
|
|
1109
|
-
else if (isSCMInput(element)) {
|
|
1110
|
-
const provider = element.repository.provider;
|
|
1111
|
-
return `input:${provider.id}`;
|
|
1112
|
-
}
|
|
1113
|
-
else if (isSCMActionButton(element)) {
|
|
1114
|
-
const provider = element.repository.provider;
|
|
1115
|
-
return `actionButton:${provider.id}`;
|
|
1116
|
-
}
|
|
1117
|
-
else if (isSCMResourceGroup(element)) {
|
|
1118
|
-
const provider = element.provider;
|
|
1119
|
-
return `resourceGroup:${provider.id}/${element.id}`;
|
|
1120
|
-
}
|
|
1121
|
-
else if (isSCMResource(element)) {
|
|
1122
|
-
const group = element.resourceGroup;
|
|
1123
|
-
const provider = group.provider;
|
|
1124
|
-
return `resource:${provider.id}/${group.id}/${( element.sourceUri.toString())}`;
|
|
1125
|
-
}
|
|
1126
|
-
else if (isSCMResourceNode(element)) {
|
|
1127
|
-
const group = element.context;
|
|
1128
|
-
return `folder:${group.provider.id}/${group.id}/$FOLDER/${( element.uri.toString())}`;
|
|
1129
|
-
}
|
|
1130
|
-
else if (isSCMHistoryItemGroupTreeElement(element)) {
|
|
1131
|
-
const provider = element.repository.provider;
|
|
1132
|
-
return `historyItemGroup:${provider.id}/${element.id}`;
|
|
1133
|
-
}
|
|
1134
|
-
else if (isSCMHistoryItemTreeElement(element)) {
|
|
1135
|
-
const historyItemGroup = element.historyItemGroup;
|
|
1136
|
-
const provider = historyItemGroup.repository.provider;
|
|
1137
|
-
return `historyItem:${provider.id}/${historyItemGroup.id}/${element.id}/${element.parentIds.join(',')}`;
|
|
1138
|
-
}
|
|
1139
|
-
else if (isSCMHistoryItemChangeTreeElement(element)) {
|
|
1140
|
-
const historyItem = element.historyItem;
|
|
1141
|
-
const historyItemGroup = historyItem.historyItemGroup;
|
|
1142
|
-
const provider = historyItemGroup.repository.provider;
|
|
1143
|
-
return `historyItemChange:${provider.id}/${historyItemGroup.id}/${historyItem.id}/${( element.uri.toString())}`;
|
|
1144
|
-
}
|
|
1145
|
-
else if (isSCMHistoryItemChangeNode(element)) {
|
|
1146
|
-
const historyItem = element.context;
|
|
1147
|
-
const historyItemGroup = historyItem.historyItemGroup;
|
|
1148
|
-
const provider = historyItemGroup.repository.provider;
|
|
1149
|
-
return `folder:${provider.id}/${historyItemGroup.id}/${historyItem.id}/$FOLDER/${( element.uri.toString())}`;
|
|
1150
|
-
}
|
|
1151
|
-
else if (isSCMViewSeparator(element)) {
|
|
1152
|
-
const provider = element.repository.provider;
|
|
1153
|
-
return `separator:${provider.id}`;
|
|
1154
|
-
}
|
|
1155
|
-
else {
|
|
1156
|
-
throw new Error('Invalid tree element');
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
class SCMResourceIdentityProvider {
|
|
1160
|
-
getId(element) {
|
|
1161
|
-
return getSCMResourceId(element);
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
let SCMAccessibilityProvider = class SCMAccessibilityProvider {
|
|
1165
|
-
constructor(labelService) {
|
|
1166
|
-
this.labelService = labelService;
|
|
1167
|
-
}
|
|
1168
|
-
getWidgetAriaLabel() {
|
|
1169
|
-
return ( localizeWithPath(
|
|
1170
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1171
|
-
'scm',
|
|
1172
|
-
"Source Control Management"
|
|
1173
|
-
));
|
|
1174
|
-
}
|
|
1175
|
-
getAriaLabel(element) {
|
|
1176
|
-
if (ResourceTree.isResourceNode(element)) {
|
|
1177
|
-
return this.labelService.getUriLabel(element.uri, { relative: true, noPrefix: true }) || element.name;
|
|
1178
|
-
}
|
|
1179
|
-
else if (isSCMRepository(element)) {
|
|
1180
|
-
return `${element.provider.name} ${element.provider.label}`;
|
|
1181
|
-
}
|
|
1182
|
-
else if (isSCMInput(element)) {
|
|
1183
|
-
return ( localizeWithPath(
|
|
1184
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1185
|
-
'input',
|
|
1186
|
-
"Source Control Input"
|
|
1187
|
-
));
|
|
1188
|
-
}
|
|
1189
|
-
else if (isSCMActionButton(element)) {
|
|
1190
|
-
return element.button?.command.title ?? '';
|
|
1191
|
-
}
|
|
1192
|
-
else if (isSCMResourceGroup(element)) {
|
|
1193
|
-
return element.label;
|
|
1194
|
-
}
|
|
1195
|
-
else if (isSCMHistoryItemGroupTreeElement(element)) {
|
|
1196
|
-
return element.ariaLabel ?? `${element.label.trim()}${element.description ? `, ${element.description}` : ''}`;
|
|
1197
|
-
}
|
|
1198
|
-
else if (isSCMHistoryItemTreeElement(element)) {
|
|
1199
|
-
return `${stripIcons(element.label).trim()}${element.description ? `, ${element.description}` : ''}`;
|
|
1200
|
-
}
|
|
1201
|
-
else if (isSCMHistoryItemChangeTreeElement(element)) {
|
|
1202
|
-
const result = [basename(element.uri)];
|
|
1203
|
-
const path = this.labelService.getUriLabel(dirname(element.uri), { relative: true, noPrefix: true });
|
|
1204
|
-
if (path) {
|
|
1205
|
-
result.push(path);
|
|
1206
|
-
}
|
|
1207
|
-
return result.join(', ');
|
|
1208
|
-
}
|
|
1209
|
-
else if (isSCMViewSeparator(element)) {
|
|
1210
|
-
return element.ariaLabel ?? element.label;
|
|
1211
|
-
}
|
|
1212
|
-
else {
|
|
1213
|
-
const result = [];
|
|
1214
|
-
result.push(basename(element.sourceUri));
|
|
1215
|
-
if (element.decorations.tooltip) {
|
|
1216
|
-
result.push(element.decorations.tooltip);
|
|
1217
|
-
}
|
|
1218
|
-
const path = this.labelService.getUriLabel(dirname(element.sourceUri), { relative: true, noPrefix: true });
|
|
1219
|
-
if (path) {
|
|
1220
|
-
result.push(path);
|
|
1221
|
-
}
|
|
1222
|
-
return result.join(', ');
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
};
|
|
1226
|
-
SCMAccessibilityProvider = ( __decorate([
|
|
1227
|
-
( __param(0, ILabelService))
|
|
1228
|
-
], SCMAccessibilityProvider));
|
|
1229
|
-
const Menus = {
|
|
1230
|
-
ViewSort: ( new MenuId('SCMViewSort')),
|
|
1231
|
-
Repositories: ( new MenuId('SCMRepositories')),
|
|
1232
|
-
ChangesSettings: ( new MenuId('SCMChangesSettings')),
|
|
1233
|
-
};
|
|
1234
|
-
const ContextKeys = {
|
|
1235
|
-
SCMViewMode: ( new RawContextKey('scmViewMode', "list" )),
|
|
1236
|
-
SCMViewSortKey: ( new RawContextKey('scmViewSortKey', "path" )),
|
|
1237
|
-
SCMViewAreAllRepositoriesCollapsed: ( new RawContextKey('scmViewAreAllRepositoriesCollapsed', false)),
|
|
1238
|
-
SCMViewIsAnyRepositoryCollapsible: ( new RawContextKey('scmViewIsAnyRepositoryCollapsible', false)),
|
|
1239
|
-
SCMProvider: ( new RawContextKey('scmProvider', undefined)),
|
|
1240
|
-
SCMProviderRootUri: ( new RawContextKey('scmProviderRootUri', undefined)),
|
|
1241
|
-
SCMProviderHasRootUri: ( new RawContextKey('scmProviderHasRootUri', undefined)),
|
|
1242
|
-
RepositoryCount: ( new RawContextKey('scmRepositoryCount', 0)),
|
|
1243
|
-
RepositoryVisibilityCount: ( new RawContextKey('scmRepositoryVisibleCount', 0)),
|
|
1244
|
-
RepositoryVisibility(repository) {
|
|
1245
|
-
return ( new RawContextKey(`scmRepositoryVisible:${repository.provider.id}`, false));
|
|
1246
|
-
}
|
|
1247
|
-
};
|
|
1248
|
-
MenuRegistry.appendMenuItem(MenuId.SCMTitle, {
|
|
1249
|
-
title: ( localizeWithPath(
|
|
1250
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1251
|
-
'sortAction',
|
|
1252
|
-
"View & Sort"
|
|
1253
|
-
)),
|
|
1254
|
-
submenu: Menus.ViewSort,
|
|
1255
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', VIEW_PANE_ID)), ( ContextKeys.RepositoryCount.notEqualsTo(0)))),
|
|
1256
|
-
group: '0_view&sort',
|
|
1257
|
-
order: 1
|
|
1258
|
-
});
|
|
1259
|
-
MenuRegistry.appendMenuItem(MenuId.SCMTitle, {
|
|
1260
|
-
title: ( localizeWithPath(
|
|
1261
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1262
|
-
'scmChanges',
|
|
1263
|
-
"Incoming & Outgoing"
|
|
1264
|
-
)),
|
|
1265
|
-
submenu: Menus.ChangesSettings,
|
|
1266
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', VIEW_PANE_ID)), ( ContextKeys.RepositoryCount.notEqualsTo(0)))),
|
|
1267
|
-
group: '0_view&sort',
|
|
1268
|
-
order: 2
|
|
1269
|
-
});
|
|
1270
|
-
MenuRegistry.appendMenuItem(Menus.ViewSort, {
|
|
1271
|
-
title: ( localizeWithPath(
|
|
1272
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1273
|
-
'repositories',
|
|
1274
|
-
"Repositories"
|
|
1275
|
-
)),
|
|
1276
|
-
submenu: Menus.Repositories,
|
|
1277
|
-
when: ContextKeyExpr.greater(ContextKeys.RepositoryCount.key, 1),
|
|
1278
|
-
group: '0_repositories'
|
|
1279
|
-
});
|
|
1280
|
-
class SCMChangesSettingAction extends Action2 {
|
|
1281
|
-
constructor(settingKey, settingValue, desc) {
|
|
1282
|
-
super({
|
|
1283
|
-
...desc,
|
|
1284
|
-
f1: false,
|
|
1285
|
-
toggled: ( ContextKeyExpr.equals(`config.${settingKey}`, settingValue)),
|
|
1286
|
-
});
|
|
1287
|
-
this.settingKey = settingKey;
|
|
1288
|
-
this.settingValue = settingValue;
|
|
1289
|
-
}
|
|
1290
|
-
run(accessor) {
|
|
1291
|
-
const configurationService = accessor.get(IConfigurationService);
|
|
1292
|
-
configurationService.updateValue(this.settingKey, this.settingValue);
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
MenuRegistry.appendMenuItem(MenuId.SCMChangesSeparator, {
|
|
1296
|
-
title: ( localizeWithPath(
|
|
1297
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1298
|
-
'incomingChanges',
|
|
1299
|
-
"Show Incoming Changes"
|
|
1300
|
-
)),
|
|
1301
|
-
submenu: MenuId.SCMIncomingChangesSetting,
|
|
1302
|
-
group: '1_incoming&outgoing',
|
|
1303
|
-
order: 1
|
|
1304
|
-
});
|
|
1305
|
-
MenuRegistry.appendMenuItem(Menus.ChangesSettings, {
|
|
1306
|
-
title: ( localizeWithPath(
|
|
1307
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1308
|
-
'incomingChanges',
|
|
1309
|
-
"Show Incoming Changes"
|
|
1310
|
-
)),
|
|
1311
|
-
submenu: MenuId.SCMIncomingChangesSetting,
|
|
1312
|
-
group: '1_incoming&outgoing',
|
|
1313
|
-
order: 1
|
|
1314
|
-
});
|
|
1315
|
-
registerAction2(class extends SCMChangesSettingAction {
|
|
1316
|
-
constructor() {
|
|
1317
|
-
super('scm.showIncomingChanges', 'always', {
|
|
1318
|
-
id: 'workbench.scm.action.showIncomingChanges.always',
|
|
1319
|
-
title: ( localizeWithPath('vs/workbench/contrib/scm/browser/scmViewPane', 'always', "Always")),
|
|
1320
|
-
menu: { id: MenuId.SCMIncomingChangesSetting },
|
|
1321
|
-
});
|
|
1322
|
-
}
|
|
1323
|
-
});
|
|
1324
|
-
registerAction2(class extends SCMChangesSettingAction {
|
|
1325
|
-
constructor() {
|
|
1326
|
-
super('scm.showIncomingChanges', 'auto', {
|
|
1327
|
-
id: 'workbench.scm.action.showIncomingChanges.auto',
|
|
1328
|
-
title: ( localizeWithPath('vs/workbench/contrib/scm/browser/scmViewPane', 'auto', "Auto")),
|
|
1329
|
-
menu: {
|
|
1330
|
-
id: MenuId.SCMIncomingChangesSetting,
|
|
1331
|
-
}
|
|
1332
|
-
});
|
|
1333
|
-
}
|
|
1334
|
-
});
|
|
1335
|
-
registerAction2(class extends SCMChangesSettingAction {
|
|
1336
|
-
constructor() {
|
|
1337
|
-
super('scm.showIncomingChanges', 'never', {
|
|
1338
|
-
id: 'workbench.scm.action.showIncomingChanges.never',
|
|
1339
|
-
title: ( localizeWithPath('vs/workbench/contrib/scm/browser/scmViewPane', 'never', "Never")),
|
|
1340
|
-
menu: {
|
|
1341
|
-
id: MenuId.SCMIncomingChangesSetting,
|
|
1342
|
-
}
|
|
1343
|
-
});
|
|
1344
|
-
}
|
|
1345
|
-
});
|
|
1346
|
-
MenuRegistry.appendMenuItem(MenuId.SCMChangesSeparator, {
|
|
1347
|
-
title: ( localizeWithPath(
|
|
1348
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1349
|
-
'outgoingChanges',
|
|
1350
|
-
"Show Outgoing Changes"
|
|
1351
|
-
)),
|
|
1352
|
-
submenu: MenuId.SCMOutgoingChangesSetting,
|
|
1353
|
-
group: '1_incoming&outgoing',
|
|
1354
|
-
order: 2
|
|
1355
|
-
});
|
|
1356
|
-
MenuRegistry.appendMenuItem(Menus.ChangesSettings, {
|
|
1357
|
-
title: ( localizeWithPath(
|
|
1358
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1359
|
-
'outgoingChanges',
|
|
1360
|
-
"Show Outgoing Changes"
|
|
1361
|
-
)),
|
|
1362
|
-
submenu: MenuId.SCMOutgoingChangesSetting,
|
|
1363
|
-
group: '1_incoming&outgoing',
|
|
1364
|
-
order: 2
|
|
1365
|
-
});
|
|
1366
|
-
registerAction2(class extends SCMChangesSettingAction {
|
|
1367
|
-
constructor() {
|
|
1368
|
-
super('scm.showOutgoingChanges', 'always', {
|
|
1369
|
-
id: 'workbench.scm.action.showOutgoingChanges.always',
|
|
1370
|
-
title: ( localizeWithPath('vs/workbench/contrib/scm/browser/scmViewPane', 'always', "Always")),
|
|
1371
|
-
menu: {
|
|
1372
|
-
id: MenuId.SCMOutgoingChangesSetting,
|
|
1373
|
-
}
|
|
1374
|
-
});
|
|
1375
|
-
}
|
|
1376
|
-
});
|
|
1377
|
-
registerAction2(class extends SCMChangesSettingAction {
|
|
1378
|
-
constructor() {
|
|
1379
|
-
super('scm.showOutgoingChanges', 'auto', {
|
|
1380
|
-
id: 'workbench.scm.action.showOutgoingChanges.auto',
|
|
1381
|
-
title: ( localizeWithPath('vs/workbench/contrib/scm/browser/scmViewPane', 'auto', "Auto")),
|
|
1382
|
-
menu: {
|
|
1383
|
-
id: MenuId.SCMOutgoingChangesSetting,
|
|
1384
|
-
}
|
|
1385
|
-
});
|
|
1386
|
-
}
|
|
1387
|
-
});
|
|
1388
|
-
registerAction2(class extends SCMChangesSettingAction {
|
|
1389
|
-
constructor() {
|
|
1390
|
-
super('scm.showOutgoingChanges', 'never', {
|
|
1391
|
-
id: 'workbench.scm.action.showOutgoingChanges.never',
|
|
1392
|
-
title: ( localizeWithPath('vs/workbench/contrib/scm/browser/scmViewPane', 'never', "Never")),
|
|
1393
|
-
menu: {
|
|
1394
|
-
id: MenuId.SCMOutgoingChangesSetting,
|
|
1395
|
-
}
|
|
1396
|
-
});
|
|
1397
|
-
}
|
|
1398
|
-
});
|
|
1399
|
-
registerAction2(class extends Action2 {
|
|
1400
|
-
constructor() {
|
|
1401
|
-
super({
|
|
1402
|
-
id: 'workbench.scm.action.scm.showChangesSummary',
|
|
1403
|
-
title: ( localizeWithPath(
|
|
1404
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1405
|
-
'showChangesSummary',
|
|
1406
|
-
"Show Changes Summary"
|
|
1407
|
-
)),
|
|
1408
|
-
f1: false,
|
|
1409
|
-
toggled: ( ContextKeyExpr.equals('config.scm.showChangesSummary', true)),
|
|
1410
|
-
menu: [
|
|
1411
|
-
{ id: MenuId.SCMChangesSeparator, order: 3 },
|
|
1412
|
-
{ id: Menus.ChangesSettings, order: 3 },
|
|
1413
|
-
]
|
|
1414
|
-
});
|
|
1415
|
-
}
|
|
1416
|
-
run(accessor) {
|
|
1417
|
-
const configurationService = accessor.get(IConfigurationService);
|
|
1418
|
-
const configValue = configurationService.getValue('scm.showChangesSummary') === true;
|
|
1419
|
-
configurationService.updateValue('scm.showChangesSummary', !configValue);
|
|
1420
|
-
}
|
|
1421
|
-
});
|
|
1422
|
-
class RepositoryVisibilityAction extends Action2 {
|
|
1423
|
-
constructor(repository) {
|
|
1424
|
-
super({
|
|
1425
|
-
id: `workbench.scm.action.toggleRepositoryVisibility.${repository.provider.id}`,
|
|
1426
|
-
title: repository.provider.name,
|
|
1427
|
-
f1: false,
|
|
1428
|
-
precondition: ( ContextKeyExpr.or(( ContextKeys.RepositoryVisibilityCount.notEqualsTo(1)), ( ContextKeys.RepositoryVisibility(repository).isEqualTo(false)))),
|
|
1429
|
-
toggled: ( ContextKeys.RepositoryVisibility(repository).isEqualTo(true)),
|
|
1430
|
-
menu: { id: Menus.Repositories, group: '0_repositories' }
|
|
1431
|
-
});
|
|
1432
|
-
this.repository = repository;
|
|
1433
|
-
}
|
|
1434
|
-
run(accessor) {
|
|
1435
|
-
const scmViewService = accessor.get(ISCMViewService);
|
|
1436
|
-
scmViewService.toggleVisibility(this.repository);
|
|
1437
|
-
}
|
|
1438
|
-
}
|
|
1439
|
-
let RepositoryVisibilityActionController = class RepositoryVisibilityActionController {
|
|
1440
|
-
constructor(contextKeyService, scmViewService, scmService) {
|
|
1441
|
-
this.contextKeyService = contextKeyService;
|
|
1442
|
-
this.scmViewService = scmViewService;
|
|
1443
|
-
this.items = ( new Map());
|
|
1444
|
-
this.disposables = ( new DisposableStore());
|
|
1445
|
-
this.repositoryCountContextKey = ContextKeys.RepositoryCount.bindTo(contextKeyService);
|
|
1446
|
-
this.repositoryVisibilityCountContextKey = ContextKeys.RepositoryVisibilityCount.bindTo(contextKeyService);
|
|
1447
|
-
scmViewService.onDidChangeVisibleRepositories(this.onDidChangeVisibleRepositories, this, this.disposables);
|
|
1448
|
-
scmService.onDidAddRepository(this.onDidAddRepository, this, this.disposables);
|
|
1449
|
-
scmService.onDidRemoveRepository(this.onDidRemoveRepository, this, this.disposables);
|
|
1450
|
-
for (const repository of scmService.repositories) {
|
|
1451
|
-
this.onDidAddRepository(repository);
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
onDidAddRepository(repository) {
|
|
1455
|
-
const action = registerAction2(class extends RepositoryVisibilityAction {
|
|
1456
|
-
constructor() {
|
|
1457
|
-
super(repository);
|
|
1458
|
-
}
|
|
1459
|
-
});
|
|
1460
|
-
const contextKey = ContextKeys.RepositoryVisibility(repository).bindTo(this.contextKeyService);
|
|
1461
|
-
contextKey.set(this.scmViewService.isVisible(repository));
|
|
1462
|
-
this.items.set(repository, {
|
|
1463
|
-
contextKey,
|
|
1464
|
-
dispose() {
|
|
1465
|
-
contextKey.reset();
|
|
1466
|
-
action.dispose();
|
|
1467
|
-
}
|
|
1468
|
-
});
|
|
1469
|
-
this.updateRepositoryContextKeys();
|
|
1470
|
-
}
|
|
1471
|
-
onDidRemoveRepository(repository) {
|
|
1472
|
-
this.items.get(repository)?.dispose();
|
|
1473
|
-
this.items.delete(repository);
|
|
1474
|
-
this.updateRepositoryContextKeys();
|
|
1475
|
-
}
|
|
1476
|
-
onDidChangeVisibleRepositories() {
|
|
1477
|
-
let count = 0;
|
|
1478
|
-
for (const [repository, item] of this.items) {
|
|
1479
|
-
const isVisible = this.scmViewService.isVisible(repository);
|
|
1480
|
-
item.contextKey.set(isVisible);
|
|
1481
|
-
if (isVisible) {
|
|
1482
|
-
count++;
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
this.repositoryCountContextKey.set(this.items.size);
|
|
1486
|
-
this.repositoryVisibilityCountContextKey.set(count);
|
|
1487
|
-
}
|
|
1488
|
-
updateRepositoryContextKeys() {
|
|
1489
|
-
this.repositoryCountContextKey.set(this.items.size);
|
|
1490
|
-
this.repositoryVisibilityCountContextKey.set(Iterable.reduce(( this.items.keys()), (r, repository) => r + (this.scmViewService.isVisible(repository) ? 1 : 0), 0));
|
|
1491
|
-
}
|
|
1492
|
-
dispose() {
|
|
1493
|
-
this.disposables.dispose();
|
|
1494
|
-
dispose(( this.items.values()));
|
|
1495
|
-
this.items.clear();
|
|
1496
|
-
}
|
|
1497
|
-
};
|
|
1498
|
-
RepositoryVisibilityActionController = ( __decorate([
|
|
1499
|
-
( __param(0, IContextKeyService)),
|
|
1500
|
-
( __param(1, ISCMViewService)),
|
|
1501
|
-
( __param(2, ISCMService))
|
|
1502
|
-
], RepositoryVisibilityActionController));
|
|
1503
|
-
class SetListViewModeAction extends ViewAction {
|
|
1504
|
-
constructor(id = 'workbench.scm.action.setListViewMode', menu = {}) {
|
|
1505
|
-
super({
|
|
1506
|
-
id,
|
|
1507
|
-
title: ( localizeWithPath(
|
|
1508
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1509
|
-
'setListViewMode',
|
|
1510
|
-
"View as List"
|
|
1511
|
-
)),
|
|
1512
|
-
viewId: VIEW_PANE_ID,
|
|
1513
|
-
f1: false,
|
|
1514
|
-
icon: Codicon.listTree,
|
|
1515
|
-
toggled: ( ContextKeys.SCMViewMode.isEqualTo("list" )),
|
|
1516
|
-
menu: { id: Menus.ViewSort, group: '1_viewmode', ...menu }
|
|
1517
|
-
});
|
|
1518
|
-
}
|
|
1519
|
-
async runInView(_, view) {
|
|
1520
|
-
view.viewMode = "list" ;
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
class SetListViewModeNavigationAction extends SetListViewModeAction {
|
|
1524
|
-
constructor() {
|
|
1525
|
-
super('workbench.scm.action.setListViewModeNavigation', {
|
|
1526
|
-
id: MenuId.SCMTitle,
|
|
1527
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', VIEW_PANE_ID)), ( ContextKeys.RepositoryCount.notEqualsTo(0)), ( ContextKeys.SCMViewMode.isEqualTo("tree" )))),
|
|
1528
|
-
group: 'navigation',
|
|
1529
|
-
order: -1000
|
|
1530
|
-
});
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1533
|
-
class SetTreeViewModeAction extends ViewAction {
|
|
1534
|
-
constructor(id = 'workbench.scm.action.setTreeViewMode', menu = {}) {
|
|
1535
|
-
super({
|
|
1536
|
-
id,
|
|
1537
|
-
title: ( localizeWithPath(
|
|
1538
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1539
|
-
'setTreeViewMode',
|
|
1540
|
-
"View as Tree"
|
|
1541
|
-
)),
|
|
1542
|
-
viewId: VIEW_PANE_ID,
|
|
1543
|
-
f1: false,
|
|
1544
|
-
icon: Codicon.listFlat,
|
|
1545
|
-
toggled: ( ContextKeys.SCMViewMode.isEqualTo("tree" )),
|
|
1546
|
-
menu: { id: Menus.ViewSort, group: '1_viewmode', ...menu }
|
|
1547
|
-
});
|
|
1548
|
-
}
|
|
1549
|
-
async runInView(_, view) {
|
|
1550
|
-
view.viewMode = "tree" ;
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
class SetTreeViewModeNavigationAction extends SetTreeViewModeAction {
|
|
1554
|
-
constructor() {
|
|
1555
|
-
super('workbench.scm.action.setTreeViewModeNavigation', {
|
|
1556
|
-
id: MenuId.SCMTitle,
|
|
1557
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', VIEW_PANE_ID)), ( ContextKeys.RepositoryCount.notEqualsTo(0)), ( ContextKeys.SCMViewMode.isEqualTo("list" )))),
|
|
1558
|
-
group: 'navigation',
|
|
1559
|
-
order: -1000
|
|
1560
|
-
});
|
|
1561
|
-
}
|
|
1562
|
-
}
|
|
1563
|
-
registerAction2(SetListViewModeAction);
|
|
1564
|
-
registerAction2(SetTreeViewModeAction);
|
|
1565
|
-
registerAction2(SetListViewModeNavigationAction);
|
|
1566
|
-
registerAction2(SetTreeViewModeNavigationAction);
|
|
1567
|
-
class RepositorySortAction extends ViewAction {
|
|
1568
|
-
constructor(sortKey, title) {
|
|
1569
|
-
super({
|
|
1570
|
-
id: `workbench.scm.action.repositories.setSortKey.${sortKey}`,
|
|
1571
|
-
title,
|
|
1572
|
-
viewId: VIEW_PANE_ID,
|
|
1573
|
-
f1: false,
|
|
1574
|
-
toggled: ( RepositoryContextKeys.RepositorySortKey.isEqualTo(sortKey)),
|
|
1575
|
-
menu: [
|
|
1576
|
-
{
|
|
1577
|
-
id: Menus.Repositories,
|
|
1578
|
-
group: '1_sort'
|
|
1579
|
-
},
|
|
1580
|
-
{
|
|
1581
|
-
id: MenuId.SCMSourceControlTitle,
|
|
1582
|
-
group: '1_sort',
|
|
1583
|
-
},
|
|
1584
|
-
]
|
|
1585
|
-
});
|
|
1586
|
-
this.sortKey = sortKey;
|
|
1587
|
-
}
|
|
1588
|
-
runInView(accessor) {
|
|
1589
|
-
accessor.get(ISCMViewService).toggleSortKey(this.sortKey);
|
|
1590
|
-
}
|
|
1591
|
-
}
|
|
1592
|
-
class RepositorySortByDiscoveryTimeAction extends RepositorySortAction {
|
|
1593
|
-
constructor() {
|
|
1594
|
-
super("discoveryTime" , ( localizeWithPath(
|
|
1595
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1596
|
-
'repositorySortByDiscoveryTime',
|
|
1597
|
-
"Sort by Discovery Time"
|
|
1598
|
-
)));
|
|
1599
|
-
}
|
|
1600
|
-
}
|
|
1601
|
-
class RepositorySortByNameAction extends RepositorySortAction {
|
|
1602
|
-
constructor() {
|
|
1603
|
-
super("name" , ( localizeWithPath(
|
|
1604
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1605
|
-
'repositorySortByName',
|
|
1606
|
-
"Sort by Name"
|
|
1607
|
-
)));
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
class RepositorySortByPathAction extends RepositorySortAction {
|
|
1611
|
-
constructor() {
|
|
1612
|
-
super("path" , ( localizeWithPath(
|
|
1613
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1614
|
-
'repositorySortByPath',
|
|
1615
|
-
"Sort by Path"
|
|
1616
|
-
)));
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
registerAction2(RepositorySortByDiscoveryTimeAction);
|
|
1620
|
-
registerAction2(RepositorySortByNameAction);
|
|
1621
|
-
registerAction2(RepositorySortByPathAction);
|
|
1622
|
-
class SetSortKeyAction extends ViewAction {
|
|
1623
|
-
constructor(sortKey, title) {
|
|
1624
|
-
super({
|
|
1625
|
-
id: `workbench.scm.action.setSortKey.${sortKey}`,
|
|
1626
|
-
title,
|
|
1627
|
-
viewId: VIEW_PANE_ID,
|
|
1628
|
-
f1: false,
|
|
1629
|
-
toggled: ( ContextKeys.SCMViewSortKey.isEqualTo(sortKey)),
|
|
1630
|
-
precondition: ( ContextKeys.SCMViewMode.isEqualTo("list" )),
|
|
1631
|
-
menu: { id: Menus.ViewSort, group: '2_sort' }
|
|
1632
|
-
});
|
|
1633
|
-
this.sortKey = sortKey;
|
|
1634
|
-
}
|
|
1635
|
-
async runInView(_, view) {
|
|
1636
|
-
view.viewSortKey = this.sortKey;
|
|
1637
|
-
}
|
|
1638
|
-
}
|
|
1639
|
-
class SetSortByNameAction extends SetSortKeyAction {
|
|
1640
|
-
constructor() {
|
|
1641
|
-
super("name" , ( localizeWithPath(
|
|
1642
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1643
|
-
'sortChangesByName',
|
|
1644
|
-
"Sort Changes by Name"
|
|
1645
|
-
)));
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
|
-
class SetSortByPathAction extends SetSortKeyAction {
|
|
1649
|
-
constructor() {
|
|
1650
|
-
super("path" , ( localizeWithPath(
|
|
1651
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1652
|
-
'sortChangesByPath',
|
|
1653
|
-
"Sort Changes by Path"
|
|
1654
|
-
)));
|
|
1655
|
-
}
|
|
1656
|
-
}
|
|
1657
|
-
class SetSortByStatusAction extends SetSortKeyAction {
|
|
1658
|
-
constructor() {
|
|
1659
|
-
super("status" , ( localizeWithPath(
|
|
1660
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1661
|
-
'sortChangesByStatus',
|
|
1662
|
-
"Sort Changes by Status"
|
|
1663
|
-
)));
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
registerAction2(SetSortByNameAction);
|
|
1667
|
-
registerAction2(SetSortByPathAction);
|
|
1668
|
-
registerAction2(SetSortByStatusAction);
|
|
1669
|
-
class CollapseAllRepositoriesAction extends ViewAction {
|
|
1670
|
-
constructor() {
|
|
1671
|
-
super({
|
|
1672
|
-
id: `workbench.scm.action.collapseAllRepositories`,
|
|
1673
|
-
title: ( localizeWithPath(
|
|
1674
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1675
|
-
'collapse all',
|
|
1676
|
-
"Collapse All Repositories"
|
|
1677
|
-
)),
|
|
1678
|
-
viewId: VIEW_PANE_ID,
|
|
1679
|
-
f1: false,
|
|
1680
|
-
icon: Codicon.collapseAll,
|
|
1681
|
-
menu: {
|
|
1682
|
-
id: MenuId.SCMTitle,
|
|
1683
|
-
group: 'navigation',
|
|
1684
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', VIEW_PANE_ID)), ( ContextKeys.SCMViewIsAnyRepositoryCollapsible.isEqualTo(true)), ( ContextKeys.SCMViewAreAllRepositoriesCollapsed.isEqualTo(false))))
|
|
1685
|
-
}
|
|
1686
|
-
});
|
|
1687
|
-
}
|
|
1688
|
-
async runInView(_, view) {
|
|
1689
|
-
view.collapseAllRepositories();
|
|
1690
|
-
}
|
|
1691
|
-
}
|
|
1692
|
-
class ExpandAllRepositoriesAction extends ViewAction {
|
|
1693
|
-
constructor() {
|
|
1694
|
-
super({
|
|
1695
|
-
id: `workbench.scm.action.expandAllRepositories`,
|
|
1696
|
-
title: ( localizeWithPath(
|
|
1697
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1698
|
-
'expand all',
|
|
1699
|
-
"Expand All Repositories"
|
|
1700
|
-
)),
|
|
1701
|
-
viewId: VIEW_PANE_ID,
|
|
1702
|
-
f1: false,
|
|
1703
|
-
icon: Codicon.expandAll,
|
|
1704
|
-
menu: {
|
|
1705
|
-
id: MenuId.SCMTitle,
|
|
1706
|
-
group: 'navigation',
|
|
1707
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', VIEW_PANE_ID)), ( ContextKeys.SCMViewIsAnyRepositoryCollapsible.isEqualTo(true)), ( ContextKeys.SCMViewAreAllRepositoriesCollapsed.isEqualTo(true))))
|
|
1708
|
-
}
|
|
1709
|
-
});
|
|
1710
|
-
}
|
|
1711
|
-
async runInView(_, view) {
|
|
1712
|
-
view.expandAllRepositories();
|
|
1713
|
-
}
|
|
1714
|
-
}
|
|
1715
|
-
registerAction2(CollapseAllRepositoriesAction);
|
|
1716
|
-
registerAction2(ExpandAllRepositoriesAction);
|
|
1717
|
-
let SCMInputWidgetActionRunner = class SCMInputWidgetActionRunner extends ActionRunner {
|
|
1718
|
-
get runningActions() { return this._runningActions; }
|
|
1719
|
-
constructor(input, storageService) {
|
|
1720
|
-
super();
|
|
1721
|
-
this.input = input;
|
|
1722
|
-
this.storageService = storageService;
|
|
1723
|
-
this._runningActions = ( new Set());
|
|
1724
|
-
}
|
|
1725
|
-
async runAction(action) {
|
|
1726
|
-
try {
|
|
1727
|
-
if (this.runningActions.size !== 0) {
|
|
1728
|
-
this._cts?.cancel();
|
|
1729
|
-
if (action.id === "scm.input.cancelAction" ) {
|
|
1730
|
-
return;
|
|
1731
|
-
}
|
|
1732
|
-
}
|
|
1733
|
-
const context = [];
|
|
1734
|
-
for (const group of this.input.repository.provider.groups) {
|
|
1735
|
-
context.push({
|
|
1736
|
-
resourceGroupId: group.id,
|
|
1737
|
-
resources: [...( group.resources.map(r => r.sourceUri))]
|
|
1738
|
-
});
|
|
1739
|
-
}
|
|
1740
|
-
this._runningActions.add(action);
|
|
1741
|
-
this._cts = ( new CancellationTokenSource());
|
|
1742
|
-
await action.run(...[this.input.repository.provider.rootUri, context, this._cts.token]);
|
|
1743
|
-
}
|
|
1744
|
-
finally {
|
|
1745
|
-
this._runningActions.delete(action);
|
|
1746
|
-
if (this._runningActions.size === 0) {
|
|
1747
|
-
this.storageService.store("scm.input.lastActionId" , action.id, 0 , 0 );
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
}
|
|
1751
|
-
};
|
|
1752
|
-
SCMInputWidgetActionRunner = ( __decorate([
|
|
1753
|
-
( __param(1, IStorageService))
|
|
1754
|
-
], SCMInputWidgetActionRunner));
|
|
1755
|
-
let SCMInputWidgetToolbar = class SCMInputWidgetToolbar extends WorkbenchToolBar {
|
|
1756
|
-
get dropdownActions() { return this._dropdownActions; }
|
|
1757
|
-
get dropdownAction() { return this._dropdownAction; }
|
|
1758
|
-
constructor(container, options, menuService, contextKeyService, contextMenuService, commandService, keybindingService, storageService, telemetryService) {
|
|
1759
|
-
super(container, { resetMenu: MenuId.SCMInputBox, ...options }, menuService, contextKeyService, contextMenuService, keybindingService, telemetryService);
|
|
1760
|
-
this.menuService = menuService;
|
|
1761
|
-
this.contextKeyService = contextKeyService;
|
|
1762
|
-
this.storageService = storageService;
|
|
1763
|
-
this._dropdownActions = [];
|
|
1764
|
-
this._onDidChange = ( new Emitter());
|
|
1765
|
-
this.onDidChange = this._onDidChange.event;
|
|
1766
|
-
this.repositoryDisposables = ( new DisposableStore());
|
|
1767
|
-
this._dropdownAction = ( new Action('scmInputMoreActions', ( localizeWithPath(
|
|
1768
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1769
|
-
'scmInputMoreActions',
|
|
1770
|
-
"More Actions..."
|
|
1771
|
-
)), 'codicon-chevron-down'));
|
|
1772
|
-
this._cancelAction = ( new MenuItemAction({
|
|
1773
|
-
id: "scm.input.cancelAction" ,
|
|
1774
|
-
title: ( localizeWithPath(
|
|
1775
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
1776
|
-
'scmInputCancelAction',
|
|
1777
|
-
"Cancel"
|
|
1778
|
-
)),
|
|
1779
|
-
icon: Codicon.debugStop,
|
|
1780
|
-
}, undefined, undefined, undefined, contextKeyService, commandService));
|
|
1781
|
-
}
|
|
1782
|
-
setInput(input) {
|
|
1783
|
-
this.repositoryDisposables.clear();
|
|
1784
|
-
const contextKeyService = this.contextKeyService.createOverlay([
|
|
1785
|
-
['scmProvider', input.repository.provider.contextValue],
|
|
1786
|
-
['scmProviderRootUri', input.repository.provider.rootUri?.toString()],
|
|
1787
|
-
['scmProviderHasRootUri', !!input.repository.provider.rootUri]
|
|
1788
|
-
]);
|
|
1789
|
-
const menu = this.repositoryDisposables.add(this.menuService.createMenu(MenuId.SCMInputBox, contextKeyService, { emitEventsForSubmenuChanges: true }));
|
|
1790
|
-
const isEnabled = () => {
|
|
1791
|
-
return ( input.repository.provider.groups.some(g => g.resources.length > 0));
|
|
1792
|
-
};
|
|
1793
|
-
const updateToolbar = () => {
|
|
1794
|
-
const actions = [];
|
|
1795
|
-
createAndFillInActionBarActions(menu, { shouldForwardArgs: true }, actions);
|
|
1796
|
-
for (const action of actions) {
|
|
1797
|
-
action.enabled = isEnabled();
|
|
1798
|
-
}
|
|
1799
|
-
this._dropdownAction.enabled = isEnabled();
|
|
1800
|
-
let primaryAction = undefined;
|
|
1801
|
-
if (actions.length === 1) {
|
|
1802
|
-
primaryAction = actions[0];
|
|
1803
|
-
}
|
|
1804
|
-
else if (actions.length > 1) {
|
|
1805
|
-
const lastActionId = this.storageService.get("scm.input.lastActionId" , 0 , '');
|
|
1806
|
-
primaryAction = actions.find(a => a.id === lastActionId) ?? actions[0];
|
|
1807
|
-
}
|
|
1808
|
-
this._dropdownActions = actions.length === 1 ? [] : actions;
|
|
1809
|
-
super.setActions(primaryAction ? [primaryAction] : [], []);
|
|
1810
|
-
this._onDidChange.fire();
|
|
1811
|
-
};
|
|
1812
|
-
this.repositoryDisposables.add(menu.onDidChange(() => updateToolbar()));
|
|
1813
|
-
this.repositoryDisposables.add(input.repository.provider.onDidChangeResources(() => updateToolbar()));
|
|
1814
|
-
this.repositoryDisposables.add(this.storageService.onDidChangeValue(0 , "scm.input.lastActionId" , this.repositoryDisposables)(() => updateToolbar()));
|
|
1815
|
-
this.actionRunner = ( new SCMInputWidgetActionRunner(input, this.storageService));
|
|
1816
|
-
this.repositoryDisposables.add(this.actionRunner.onWillRun(e => {
|
|
1817
|
-
if (this.actionRunner.runningActions.size === 0) {
|
|
1818
|
-
super.setActions([this._cancelAction], []);
|
|
1819
|
-
this._onDidChange.fire();
|
|
1820
|
-
}
|
|
1821
|
-
}));
|
|
1822
|
-
this.repositoryDisposables.add(this.actionRunner.onDidRun(e => {
|
|
1823
|
-
if (this.actionRunner.runningActions.size === 0) {
|
|
1824
|
-
updateToolbar();
|
|
1825
|
-
}
|
|
1826
|
-
}));
|
|
1827
|
-
updateToolbar();
|
|
1828
|
-
}
|
|
1829
|
-
};
|
|
1830
|
-
SCMInputWidgetToolbar = ( __decorate([
|
|
1831
|
-
( __param(2, IMenuService)),
|
|
1832
|
-
( __param(3, IContextKeyService)),
|
|
1833
|
-
( __param(4, IContextMenuService)),
|
|
1834
|
-
( __param(5, ICommandService)),
|
|
1835
|
-
( __param(6, IKeybindingService)),
|
|
1836
|
-
( __param(7, IStorageService)),
|
|
1837
|
-
( __param(8, ITelemetryService))
|
|
1838
|
-
], SCMInputWidgetToolbar));
|
|
1839
|
-
class SCMInputWidgetEditorOptions {
|
|
1840
|
-
constructor(overflowWidgetsDomNode, configurationService) {
|
|
1841
|
-
this.overflowWidgetsDomNode = overflowWidgetsDomNode;
|
|
1842
|
-
this.configurationService = configurationService;
|
|
1843
|
-
this._onDidChange = ( new Emitter());
|
|
1844
|
-
this.onDidChange = this._onDidChange.event;
|
|
1845
|
-
this.defaultInputFontFamily = DEFAULT_FONT_FAMILY;
|
|
1846
|
-
this._disposables = ( new DisposableStore());
|
|
1847
|
-
const onDidChangeConfiguration = Event.filter(this.configurationService.onDidChangeConfiguration, e => {
|
|
1848
|
-
return e.affectsConfiguration('editor.accessibilitySupport') ||
|
|
1849
|
-
e.affectsConfiguration('editor.cursorBlinking') ||
|
|
1850
|
-
e.affectsConfiguration('editor.fontFamily') ||
|
|
1851
|
-
e.affectsConfiguration('editor.rulers') ||
|
|
1852
|
-
e.affectsConfiguration('editor.wordWrap') ||
|
|
1853
|
-
e.affectsConfiguration('scm.inputFontFamily') ||
|
|
1854
|
-
e.affectsConfiguration('scm.inputFontSize');
|
|
1855
|
-
}, this._disposables);
|
|
1856
|
-
this._disposables.add(onDidChangeConfiguration(() => this._onDidChange.fire()));
|
|
1857
|
-
}
|
|
1858
|
-
getEditorConstructionOptions() {
|
|
1859
|
-
const fontFamily = this._getEditorFontFamily();
|
|
1860
|
-
const fontSize = this._getEditorFontSize();
|
|
1861
|
-
const lineHeight = this._getEditorLineHeight(fontSize);
|
|
1862
|
-
return {
|
|
1863
|
-
...getSimpleEditorOptions(this.configurationService),
|
|
1864
|
-
...this._getEditorLanguageConfiguration(),
|
|
1865
|
-
cursorWidth: 1,
|
|
1866
|
-
dragAndDrop: true,
|
|
1867
|
-
dropIntoEditor: { enabled: true },
|
|
1868
|
-
fontFamily: fontFamily,
|
|
1869
|
-
fontSize: fontSize,
|
|
1870
|
-
formatOnType: true,
|
|
1871
|
-
lineDecorationsWidth: 6,
|
|
1872
|
-
lineHeight: lineHeight,
|
|
1873
|
-
overflowWidgetsDomNode: this.overflowWidgetsDomNode,
|
|
1874
|
-
padding: { top: 2, bottom: 2 },
|
|
1875
|
-
quickSuggestions: false,
|
|
1876
|
-
renderWhitespace: 'none',
|
|
1877
|
-
scrollbar: {
|
|
1878
|
-
alwaysConsumeMouseWheel: false,
|
|
1879
|
-
vertical: 'hidden'
|
|
1880
|
-
},
|
|
1881
|
-
wrappingIndent: 'none',
|
|
1882
|
-
wrappingStrategy: 'advanced',
|
|
1883
|
-
};
|
|
1884
|
-
}
|
|
1885
|
-
getEditorOptions() {
|
|
1886
|
-
const fontFamily = this._getEditorFontFamily();
|
|
1887
|
-
const fontSize = this._getEditorFontSize();
|
|
1888
|
-
const lineHeight = this._getEditorLineHeight(fontSize);
|
|
1889
|
-
const accessibilitySupport = this.configurationService.getValue('editor.accessibilitySupport');
|
|
1890
|
-
const cursorBlinking = this.configurationService.getValue('editor.cursorBlinking');
|
|
1891
|
-
return { ...this._getEditorLanguageConfiguration(), accessibilitySupport, cursorBlinking, fontFamily, fontSize, lineHeight };
|
|
1892
|
-
}
|
|
1893
|
-
_getEditorFontFamily() {
|
|
1894
|
-
const inputFontFamily = this.configurationService.getValue('scm.inputFontFamily').trim();
|
|
1895
|
-
if (inputFontFamily.toLowerCase() === 'editor') {
|
|
1896
|
-
return this.configurationService.getValue('editor.fontFamily').trim();
|
|
1897
|
-
}
|
|
1898
|
-
if (inputFontFamily.length !== 0 && inputFontFamily.toLowerCase() !== 'default') {
|
|
1899
|
-
return inputFontFamily;
|
|
1900
|
-
}
|
|
1901
|
-
return this.defaultInputFontFamily;
|
|
1902
|
-
}
|
|
1903
|
-
_getEditorFontSize() {
|
|
1904
|
-
return this.configurationService.getValue('scm.inputFontSize');
|
|
1905
|
-
}
|
|
1906
|
-
_getEditorLanguageConfiguration() {
|
|
1907
|
-
const rulersConfig = this.configurationService.inspect('editor.rulers', { overrideIdentifier: 'scminput' });
|
|
1908
|
-
const rulers = rulersConfig.overrideIdentifiers?.includes('scminput') ? EditorOptions.rulers.validate(rulersConfig.value) : [];
|
|
1909
|
-
const wordWrapConfig = this.configurationService.inspect('editor.wordWrap', { overrideIdentifier: 'scminput' });
|
|
1910
|
-
const wordWrap = wordWrapConfig.overrideIdentifiers?.includes('scminput') ? EditorOptions.wordWrap.validate(wordWrapConfig.value) : 'on';
|
|
1911
|
-
return { rulers, wordWrap };
|
|
1912
|
-
}
|
|
1913
|
-
_getEditorLineHeight(fontSize) {
|
|
1914
|
-
return Math.round(fontSize * 1.5);
|
|
1915
|
-
}
|
|
1916
|
-
dispose() {
|
|
1917
|
-
this._disposables.dispose();
|
|
1918
|
-
}
|
|
1919
|
-
}
|
|
1920
|
-
let SCMInputWidget = class SCMInputWidget {
|
|
1921
|
-
static { SCMInputWidget_1 = this; }
|
|
1922
|
-
static { this.ValidationTimeouts = {
|
|
1923
|
-
[2 ]: 5000,
|
|
1924
|
-
[1 ]: 8000,
|
|
1925
|
-
[0 ]: 10000
|
|
1926
|
-
}; }
|
|
1927
|
-
get input() {
|
|
1928
|
-
return this.model?.input;
|
|
1929
|
-
}
|
|
1930
|
-
async setInput(input) {
|
|
1931
|
-
if (input === this.input) {
|
|
1932
|
-
return;
|
|
1933
|
-
}
|
|
1934
|
-
this.clearValidation();
|
|
1935
|
-
this.element.classList.remove('synthetic-focus');
|
|
1936
|
-
this.repositoryDisposables.clear();
|
|
1937
|
-
this.repositoryIdContextKey.set(input?.repository.id);
|
|
1938
|
-
if (!input) {
|
|
1939
|
-
this.model?.textModelRef?.dispose();
|
|
1940
|
-
this.inputEditor.setModel(undefined);
|
|
1941
|
-
this.model = undefined;
|
|
1942
|
-
return;
|
|
1943
|
-
}
|
|
1944
|
-
const uri = input.repository.provider.inputBoxDocumentUri;
|
|
1945
|
-
if (this.configurationService.getValue('editor.wordBasedSuggestions', { resource: uri }) !== 'off') {
|
|
1946
|
-
this.configurationService.updateValue('editor.wordBasedSuggestions', 'off', { resource: uri }, 8 );
|
|
1947
|
-
}
|
|
1948
|
-
const modelValue = { input, textModelRef: undefined };
|
|
1949
|
-
this.model = modelValue;
|
|
1950
|
-
const modelRef = await this.textModelService.createModelReference(uri);
|
|
1951
|
-
if (this.model !== modelValue) {
|
|
1952
|
-
modelRef.dispose();
|
|
1953
|
-
return;
|
|
1954
|
-
}
|
|
1955
|
-
modelValue.textModelRef = modelRef;
|
|
1956
|
-
const textModel = modelRef.object.textEditorModel;
|
|
1957
|
-
this.inputEditor.setModel(textModel);
|
|
1958
|
-
const validationDelayer = ( new ThrottledDelayer(200));
|
|
1959
|
-
const validate = async () => {
|
|
1960
|
-
const position = this.inputEditor.getSelection()?.getStartPosition();
|
|
1961
|
-
const offset = position && textModel.getOffsetAt(position);
|
|
1962
|
-
const value = textModel.getValue();
|
|
1963
|
-
this.setValidation(await input.validateInput(value, offset || 0));
|
|
1964
|
-
};
|
|
1965
|
-
const triggerValidation = () => validationDelayer.trigger(validate);
|
|
1966
|
-
this.repositoryDisposables.add(validationDelayer);
|
|
1967
|
-
this.repositoryDisposables.add(this.inputEditor.onDidChangeCursorPosition(triggerValidation));
|
|
1968
|
-
const opts = this.modelService.getCreationOptions(textModel.getLanguageId(), textModel.uri, textModel.isForSimpleWidget);
|
|
1969
|
-
const onEnter = Event.filter(this.inputEditor.onKeyDown, e => e.keyCode === 3 , this.repositoryDisposables);
|
|
1970
|
-
this.repositoryDisposables.add(onEnter(() => textModel.detectIndentation(opts.insertSpaces, opts.tabSize)));
|
|
1971
|
-
textModel.setValue(input.value);
|
|
1972
|
-
this.repositoryDisposables.add(input.onDidChange(({ value, reason }) => {
|
|
1973
|
-
const currentValue = textModel.getValue();
|
|
1974
|
-
if (value === currentValue) {
|
|
1975
|
-
return;
|
|
1976
|
-
}
|
|
1977
|
-
textModel.pushStackElement();
|
|
1978
|
-
textModel.pushEditOperations(null, [EditOperation.replaceMove(textModel.getFullModelRange(), value)], () => []);
|
|
1979
|
-
const position = reason === SCMInputChangeReason.HistoryPrevious
|
|
1980
|
-
? textModel.getFullModelRange().getStartPosition()
|
|
1981
|
-
: textModel.getFullModelRange().getEndPosition();
|
|
1982
|
-
this.inputEditor.setPosition(position);
|
|
1983
|
-
this.inputEditor.revealPositionInCenterIfOutsideViewport(position);
|
|
1984
|
-
}));
|
|
1985
|
-
this.repositoryDisposables.add(input.onDidChangeFocus(() => this.focus()));
|
|
1986
|
-
this.repositoryDisposables.add(input.onDidChangeValidationMessage((e) => this.setValidation(e, { focus: true, timeout: true })));
|
|
1987
|
-
this.repositoryDisposables.add(input.onDidChangeValidateInput((e) => triggerValidation()));
|
|
1988
|
-
const updatePlaceholderVisibility = () => this.placeholderTextContainer.classList.toggle('hidden', textModel.getValueLength() > 0);
|
|
1989
|
-
this.repositoryDisposables.add(textModel.onDidChangeContent(() => {
|
|
1990
|
-
input.setValue(textModel.getValue(), true);
|
|
1991
|
-
updatePlaceholderVisibility();
|
|
1992
|
-
triggerValidation();
|
|
1993
|
-
}));
|
|
1994
|
-
updatePlaceholderVisibility();
|
|
1995
|
-
const updatePlaceholderText = () => {
|
|
1996
|
-
const binding = this.keybindingService.lookupKeybinding('scm.acceptInput');
|
|
1997
|
-
const label = binding ? binding.getLabel() : (isMacintosh ? 'Cmd+Enter' : 'Ctrl+Enter');
|
|
1998
|
-
const placeholderText = format(input.placeholder, label);
|
|
1999
|
-
this.inputEditor.updateOptions({ ariaLabel: placeholderText });
|
|
2000
|
-
this.placeholderTextContainer.textContent = placeholderText;
|
|
2001
|
-
};
|
|
2002
|
-
this.repositoryDisposables.add(input.onDidChangePlaceholder(updatePlaceholderText));
|
|
2003
|
-
this.repositoryDisposables.add(this.keybindingService.onDidUpdateKeybindings(updatePlaceholderText));
|
|
2004
|
-
updatePlaceholderText();
|
|
2005
|
-
let commitTemplate = '';
|
|
2006
|
-
const updateTemplate = () => {
|
|
2007
|
-
if (typeof input.repository.provider.commitTemplate === 'undefined' || !input.visible) {
|
|
2008
|
-
return;
|
|
2009
|
-
}
|
|
2010
|
-
const oldCommitTemplate = commitTemplate;
|
|
2011
|
-
commitTemplate = input.repository.provider.commitTemplate;
|
|
2012
|
-
const value = textModel.getValue();
|
|
2013
|
-
if (value && value !== oldCommitTemplate) {
|
|
2014
|
-
return;
|
|
2015
|
-
}
|
|
2016
|
-
textModel.setValue(commitTemplate);
|
|
2017
|
-
};
|
|
2018
|
-
this.repositoryDisposables.add(input.repository.provider.onDidChangeCommitTemplate(updateTemplate, this));
|
|
2019
|
-
updateTemplate();
|
|
2020
|
-
const updateEnablement = (enabled) => {
|
|
2021
|
-
this.inputEditor.updateOptions({ readOnly: !enabled });
|
|
2022
|
-
};
|
|
2023
|
-
this.repositoryDisposables.add(input.onDidChangeEnablement(enabled => updateEnablement(enabled)));
|
|
2024
|
-
updateEnablement(input.enabled);
|
|
2025
|
-
this.toolbar.setInput(input);
|
|
2026
|
-
}
|
|
2027
|
-
get selections() {
|
|
2028
|
-
return this.inputEditor.getSelections();
|
|
2029
|
-
}
|
|
2030
|
-
set selections(selections) {
|
|
2031
|
-
if (selections) {
|
|
2032
|
-
this.inputEditor.setSelections(selections);
|
|
2033
|
-
}
|
|
2034
|
-
}
|
|
2035
|
-
setValidation(validation, options) {
|
|
2036
|
-
if (this._validationTimer) {
|
|
2037
|
-
clearTimeout(this._validationTimer);
|
|
2038
|
-
this._validationTimer = 0;
|
|
2039
|
-
}
|
|
2040
|
-
this.validation = validation;
|
|
2041
|
-
this.renderValidation();
|
|
2042
|
-
if (options?.focus && !this.hasFocus()) {
|
|
2043
|
-
this.focus();
|
|
2044
|
-
}
|
|
2045
|
-
if (validation && options?.timeout) {
|
|
2046
|
-
this._validationTimer = setTimeout(() => this.setValidation(undefined), SCMInputWidget_1.ValidationTimeouts[validation.type]);
|
|
2047
|
-
}
|
|
2048
|
-
}
|
|
2049
|
-
constructor(container, overflowWidgetsDomNode, contextKeyService, modelService, textModelService, keybindingService, configurationService, instantiationService, scmViewService, contextViewService, openerService, contextMenuService) {
|
|
2050
|
-
this.modelService = modelService;
|
|
2051
|
-
this.textModelService = textModelService;
|
|
2052
|
-
this.keybindingService = keybindingService;
|
|
2053
|
-
this.configurationService = configurationService;
|
|
2054
|
-
this.instantiationService = instantiationService;
|
|
2055
|
-
this.scmViewService = scmViewService;
|
|
2056
|
-
this.contextViewService = contextViewService;
|
|
2057
|
-
this.openerService = openerService;
|
|
2058
|
-
this.contextMenuService = contextMenuService;
|
|
2059
|
-
this.disposables = ( new DisposableStore());
|
|
2060
|
-
this.repositoryDisposables = ( new DisposableStore());
|
|
2061
|
-
this.validationDisposable = Disposable.None;
|
|
2062
|
-
this.validationHasFocus = false;
|
|
2063
|
-
this.lastLayoutWasTrash = false;
|
|
2064
|
-
this.shouldFocusAfterLayout = false;
|
|
2065
|
-
this.element = append(container, $('.scm-editor'));
|
|
2066
|
-
this.editorContainer = append(this.element, $('.scm-editor-container'));
|
|
2067
|
-
this.placeholderTextContainer = append(this.editorContainer, $('.scm-editor-placeholder'));
|
|
2068
|
-
this.toolbarContainer = append(this.element, $('.scm-editor-toolbar'));
|
|
2069
|
-
this.contextKeyService = contextKeyService.createScoped(this.element);
|
|
2070
|
-
this.repositoryIdContextKey = this.contextKeyService.createKey('scmRepository', undefined);
|
|
2071
|
-
this.inputEditorOptions = ( new SCMInputWidgetEditorOptions(overflowWidgetsDomNode, this.configurationService));
|
|
2072
|
-
this.disposables.add(this.inputEditorOptions.onDidChange(this.onDidChangeEditorOptions, this));
|
|
2073
|
-
this.disposables.add(this.inputEditorOptions);
|
|
2074
|
-
const editorConstructionOptions = this.inputEditorOptions.getEditorConstructionOptions();
|
|
2075
|
-
this.setPlaceholderFontStyles(editorConstructionOptions.fontFamily, editorConstructionOptions.fontSize, editorConstructionOptions.lineHeight);
|
|
2076
|
-
const codeEditorWidgetOptions = {
|
|
2077
|
-
isSimpleWidget: true,
|
|
2078
|
-
contributions: EditorExtensionsRegistry.getSomeEditorContributions([
|
|
2079
|
-
ColorDetector.ID,
|
|
2080
|
-
ContextMenuController.ID,
|
|
2081
|
-
DragAndDropController.ID,
|
|
2082
|
-
DropIntoEditorController.ID,
|
|
2083
|
-
LinkDetector.ID,
|
|
2084
|
-
MenuPreventer.ID,
|
|
2085
|
-
MessageController.ID,
|
|
2086
|
-
HoverController.ID,
|
|
2087
|
-
SelectionClipboardContributionID,
|
|
2088
|
-
SnippetController2.ID,
|
|
2089
|
-
SuggestController.ID,
|
|
2090
|
-
InlineCompletionsController.ID,
|
|
2091
|
-
CodeActionController.ID,
|
|
2092
|
-
FormatOnType.ID,
|
|
2093
|
-
EditorDictation.ID
|
|
2094
|
-
])
|
|
2095
|
-
};
|
|
2096
|
-
const services = ( new ServiceCollection([IContextKeyService, this.contextKeyService]));
|
|
2097
|
-
const instantiationService2 = instantiationService.createChild(services);
|
|
2098
|
-
this.inputEditor = instantiationService2.createInstance(CodeEditorWidget, this.editorContainer, editorConstructionOptions, codeEditorWidgetOptions);
|
|
2099
|
-
this.disposables.add(this.inputEditor);
|
|
2100
|
-
this.disposables.add(this.inputEditor.onDidFocusEditorText(() => {
|
|
2101
|
-
if (this.input?.repository) {
|
|
2102
|
-
this.scmViewService.focus(this.input.repository);
|
|
2103
|
-
}
|
|
2104
|
-
this.element.classList.add('synthetic-focus');
|
|
2105
|
-
this.renderValidation();
|
|
2106
|
-
}));
|
|
2107
|
-
this.disposables.add(this.inputEditor.onDidBlurEditorText(() => {
|
|
2108
|
-
this.element.classList.remove('synthetic-focus');
|
|
2109
|
-
setTimeout(() => {
|
|
2110
|
-
if (!this.validation || !this.validationHasFocus) {
|
|
2111
|
-
this.clearValidation();
|
|
2112
|
-
}
|
|
2113
|
-
}, 0);
|
|
2114
|
-
}));
|
|
2115
|
-
const firstLineKey = this.contextKeyService.createKey('scmInputIsInFirstPosition', false);
|
|
2116
|
-
const lastLineKey = this.contextKeyService.createKey('scmInputIsInLastPosition', false);
|
|
2117
|
-
this.disposables.add(this.inputEditor.onDidChangeCursorPosition(({ position }) => {
|
|
2118
|
-
const viewModel = this.inputEditor._getViewModel();
|
|
2119
|
-
const lastLineNumber = viewModel.getLineCount();
|
|
2120
|
-
const lastLineCol = viewModel.getLineLength(lastLineNumber) + 1;
|
|
2121
|
-
const viewPosition = viewModel.coordinatesConverter.convertModelPositionToViewPosition(position);
|
|
2122
|
-
firstLineKey.set(viewPosition.lineNumber === 1 && viewPosition.column === 1);
|
|
2123
|
-
lastLineKey.set(viewPosition.lineNumber === lastLineNumber && viewPosition.column === lastLineCol);
|
|
2124
|
-
}));
|
|
2125
|
-
this.disposables.add(this.inputEditor.onDidScrollChange(e => {
|
|
2126
|
-
this.toolbarContainer.classList.toggle('scroll-decoration', e.scrollTop > 0);
|
|
2127
|
-
}));
|
|
2128
|
-
Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.showInputActionButton'))(() => this.layout(), this, this.disposables);
|
|
2129
|
-
this.onDidChangeContentHeight = Event.signal(Event.filter(this.inputEditor.onDidContentSizeChange, e => e.contentHeightChanged, this.disposables));
|
|
2130
|
-
this.toolbar = instantiationService2.createInstance(SCMInputWidgetToolbar, this.toolbarContainer, {
|
|
2131
|
-
actionViewItemProvider: (action, options) => {
|
|
2132
|
-
if (action instanceof MenuItemAction && this.toolbar.dropdownActions.length > 1) {
|
|
2133
|
-
return instantiationService.createInstance(DropdownWithPrimaryActionViewItem, action, this.toolbar.dropdownAction, this.toolbar.dropdownActions, '', this.contextMenuService, { actionRunner: this.toolbar.actionRunner, hoverDelegate: options.hoverDelegate });
|
|
2134
|
-
}
|
|
2135
|
-
return createActionViewItem(instantiationService, action, options);
|
|
2136
|
-
},
|
|
2137
|
-
menuOptions: {
|
|
2138
|
-
shouldForwardArgs: true
|
|
2139
|
-
}
|
|
2140
|
-
});
|
|
2141
|
-
this.disposables.add(this.toolbar.onDidChange(() => this.layout()));
|
|
2142
|
-
this.disposables.add(this.toolbar);
|
|
2143
|
-
}
|
|
2144
|
-
getContentHeight() {
|
|
2145
|
-
const lineHeight = this.inputEditor.getOption(67 );
|
|
2146
|
-
const { top, bottom } = this.inputEditor.getOption(84 );
|
|
2147
|
-
const inputMinLinesConfig = this.configurationService.getValue('scm.inputMinLineCount');
|
|
2148
|
-
const inputMinLines = typeof inputMinLinesConfig === 'number' ? clamp(inputMinLinesConfig, 1, 50) : 1;
|
|
2149
|
-
const editorMinHeight = inputMinLines * lineHeight + top + bottom;
|
|
2150
|
-
const inputMaxLinesConfig = this.configurationService.getValue('scm.inputMaxLineCount');
|
|
2151
|
-
const inputMaxLines = typeof inputMaxLinesConfig === 'number' ? clamp(inputMaxLinesConfig, 1, 50) : 10;
|
|
2152
|
-
const editorMaxHeight = inputMaxLines * lineHeight + top + bottom;
|
|
2153
|
-
return clamp(this.inputEditor.getContentHeight(), editorMinHeight, editorMaxHeight);
|
|
2154
|
-
}
|
|
2155
|
-
layout() {
|
|
2156
|
-
const editorHeight = this.getContentHeight();
|
|
2157
|
-
const toolbarWidth = this.getToolbarWidth();
|
|
2158
|
-
const dimension = ( new Dimension(this.element.clientWidth - toolbarWidth, editorHeight));
|
|
2159
|
-
if (dimension.width < 0) {
|
|
2160
|
-
this.lastLayoutWasTrash = true;
|
|
2161
|
-
return;
|
|
2162
|
-
}
|
|
2163
|
-
this.lastLayoutWasTrash = false;
|
|
2164
|
-
this.inputEditor.layout(dimension);
|
|
2165
|
-
this.placeholderTextContainer.style.width = `${dimension.width}px`;
|
|
2166
|
-
this.renderValidation();
|
|
2167
|
-
const showInputActionButton = this.configurationService.getValue('scm.showInputActionButton') === true;
|
|
2168
|
-
this.toolbarContainer.classList.toggle('hidden', !showInputActionButton || this.toolbar?.isEmpty() === true);
|
|
2169
|
-
if (this.shouldFocusAfterLayout) {
|
|
2170
|
-
this.shouldFocusAfterLayout = false;
|
|
2171
|
-
this.focus();
|
|
2172
|
-
}
|
|
2173
|
-
}
|
|
2174
|
-
focus() {
|
|
2175
|
-
if (this.lastLayoutWasTrash) {
|
|
2176
|
-
this.lastLayoutWasTrash = false;
|
|
2177
|
-
this.shouldFocusAfterLayout = true;
|
|
2178
|
-
return;
|
|
2179
|
-
}
|
|
2180
|
-
this.inputEditor.focus();
|
|
2181
|
-
this.element.classList.add('synthetic-focus');
|
|
2182
|
-
}
|
|
2183
|
-
hasFocus() {
|
|
2184
|
-
return this.inputEditor.hasTextFocus();
|
|
2185
|
-
}
|
|
2186
|
-
onDidChangeEditorOptions() {
|
|
2187
|
-
const editorOptions = this.inputEditorOptions.getEditorOptions();
|
|
2188
|
-
this.inputEditor.updateOptions(editorOptions);
|
|
2189
|
-
this.setPlaceholderFontStyles(editorOptions.fontFamily, editorOptions.fontSize, editorOptions.lineHeight);
|
|
2190
|
-
}
|
|
2191
|
-
renderValidation() {
|
|
2192
|
-
this.clearValidation();
|
|
2193
|
-
this.element.classList.toggle('validation-info', this.validation?.type === 2 );
|
|
2194
|
-
this.element.classList.toggle('validation-warning', this.validation?.type === 1 );
|
|
2195
|
-
this.element.classList.toggle('validation-error', this.validation?.type === 0 );
|
|
2196
|
-
if (!this.validation || !this.inputEditor.hasTextFocus()) {
|
|
2197
|
-
return;
|
|
2198
|
-
}
|
|
2199
|
-
const disposables = ( new DisposableStore());
|
|
2200
|
-
this.validationDisposable = this.contextViewService.showContextView({
|
|
2201
|
-
getAnchor: () => this.element,
|
|
2202
|
-
render: container => {
|
|
2203
|
-
this.element.style.borderBottomLeftRadius = '0';
|
|
2204
|
-
this.element.style.borderBottomRightRadius = '0';
|
|
2205
|
-
const validationContainer = append(container, $('.scm-editor-validation-container'));
|
|
2206
|
-
validationContainer.classList.toggle('validation-info', this.validation.type === 2 );
|
|
2207
|
-
validationContainer.classList.toggle('validation-warning', this.validation.type === 1 );
|
|
2208
|
-
validationContainer.classList.toggle('validation-error', this.validation.type === 0 );
|
|
2209
|
-
validationContainer.style.width = `${this.element.clientWidth + 2}px`;
|
|
2210
|
-
const element = append(validationContainer, $('.scm-editor-validation'));
|
|
2211
|
-
const message = this.validation.message;
|
|
2212
|
-
if (typeof message === 'string') {
|
|
2213
|
-
element.textContent = message;
|
|
2214
|
-
}
|
|
2215
|
-
else {
|
|
2216
|
-
const tracker = trackFocus(element);
|
|
2217
|
-
disposables.add(tracker);
|
|
2218
|
-
disposables.add(tracker.onDidFocus(() => (this.validationHasFocus = true)));
|
|
2219
|
-
disposables.add(tracker.onDidBlur(() => {
|
|
2220
|
-
this.validationHasFocus = false;
|
|
2221
|
-
this.element.style.borderBottomLeftRadius = '2px';
|
|
2222
|
-
this.element.style.borderBottomRightRadius = '2px';
|
|
2223
|
-
this.contextViewService.hideContextView();
|
|
2224
|
-
}));
|
|
2225
|
-
const renderer = disposables.add(this.instantiationService.createInstance(MarkdownRenderer, {}));
|
|
2226
|
-
const renderedMarkdown = renderer.render(message, {
|
|
2227
|
-
actionHandler: {
|
|
2228
|
-
callback: (link) => {
|
|
2229
|
-
openLinkFromMarkdown(this.openerService, link, message.isTrusted);
|
|
2230
|
-
this.element.style.borderBottomLeftRadius = '2px';
|
|
2231
|
-
this.element.style.borderBottomRightRadius = '2px';
|
|
2232
|
-
this.contextViewService.hideContextView();
|
|
2233
|
-
},
|
|
2234
|
-
disposables: disposables
|
|
2235
|
-
},
|
|
2236
|
-
});
|
|
2237
|
-
disposables.add(renderedMarkdown);
|
|
2238
|
-
element.appendChild(renderedMarkdown.element);
|
|
2239
|
-
}
|
|
2240
|
-
const actionsContainer = append(validationContainer, $('.scm-editor-validation-actions'));
|
|
2241
|
-
const actionbar = ( new ActionBar(actionsContainer));
|
|
2242
|
-
const action = ( new Action('scmInputWidget.validationMessage.close', ( localizeWithPath('vs/workbench/contrib/scm/browser/scmViewPane', 'label.close', "Close")), ThemeIcon.asClassName(Codicon.close), true, () => {
|
|
2243
|
-
this.contextViewService.hideContextView();
|
|
2244
|
-
this.element.style.borderBottomLeftRadius = '2px';
|
|
2245
|
-
this.element.style.borderBottomRightRadius = '2px';
|
|
2246
|
-
}));
|
|
2247
|
-
disposables.add(actionbar);
|
|
2248
|
-
actionbar.push(action, { icon: true, label: false });
|
|
2249
|
-
return Disposable.None;
|
|
2250
|
-
},
|
|
2251
|
-
onHide: () => {
|
|
2252
|
-
this.validationHasFocus = false;
|
|
2253
|
-
this.element.style.borderBottomLeftRadius = '2px';
|
|
2254
|
-
this.element.style.borderBottomRightRadius = '2px';
|
|
2255
|
-
disposables.dispose();
|
|
2256
|
-
},
|
|
2257
|
-
anchorAlignment: 0
|
|
2258
|
-
});
|
|
2259
|
-
}
|
|
2260
|
-
getToolbarWidth() {
|
|
2261
|
-
const showInputActionButton = this.configurationService.getValue('scm.showInputActionButton');
|
|
2262
|
-
if (!this.toolbar || !showInputActionButton || this.toolbar?.isEmpty() === true) {
|
|
2263
|
-
return 0;
|
|
2264
|
-
}
|
|
2265
|
-
return this.toolbar.dropdownActions.length === 0 ?
|
|
2266
|
-
26 :
|
|
2267
|
-
39 ;
|
|
2268
|
-
}
|
|
2269
|
-
setPlaceholderFontStyles(fontFamily, fontSize, lineHeight) {
|
|
2270
|
-
this.placeholderTextContainer.style.fontFamily = fontFamily;
|
|
2271
|
-
this.placeholderTextContainer.style.fontSize = `${fontSize}px`;
|
|
2272
|
-
this.placeholderTextContainer.style.lineHeight = `${lineHeight}px`;
|
|
2273
|
-
}
|
|
2274
|
-
clearValidation() {
|
|
2275
|
-
this.validationDisposable.dispose();
|
|
2276
|
-
this.validationHasFocus = false;
|
|
2277
|
-
}
|
|
2278
|
-
dispose() {
|
|
2279
|
-
this.setInput(undefined);
|
|
2280
|
-
this.repositoryDisposables.dispose();
|
|
2281
|
-
this.clearValidation();
|
|
2282
|
-
this.disposables.dispose();
|
|
2283
|
-
}
|
|
2284
|
-
};
|
|
2285
|
-
SCMInputWidget = SCMInputWidget_1 = ( __decorate([
|
|
2286
|
-
( __param(2, IContextKeyService)),
|
|
2287
|
-
( __param(3, IModelService)),
|
|
2288
|
-
( __param(4, ITextModelService)),
|
|
2289
|
-
( __param(5, IKeybindingService)),
|
|
2290
|
-
( __param(6, IConfigurationService)),
|
|
2291
|
-
( __param(7, IInstantiationService)),
|
|
2292
|
-
( __param(8, ISCMViewService)),
|
|
2293
|
-
( __param(9, IContextViewService)),
|
|
2294
|
-
( __param(10, IOpenerService)),
|
|
2295
|
-
( __param(11, IContextMenuService))
|
|
2296
|
-
], SCMInputWidget));
|
|
2297
|
-
let SCMViewPane = class SCMViewPane extends ViewPane {
|
|
2298
|
-
get viewMode() { return this._viewMode; }
|
|
2299
|
-
set viewMode(mode) {
|
|
2300
|
-
if (this._viewMode === mode) {
|
|
2301
|
-
return;
|
|
2302
|
-
}
|
|
2303
|
-
this._viewMode = mode;
|
|
2304
|
-
this.viewSortKey = this.getViewSortKey();
|
|
2305
|
-
this.updateChildren();
|
|
2306
|
-
this.onDidActiveEditorChange();
|
|
2307
|
-
this._onDidChangeViewMode.fire(mode);
|
|
2308
|
-
this.viewModeContextKey.set(mode);
|
|
2309
|
-
this.updateIndentStyles(this.themeService.getFileIconTheme());
|
|
2310
|
-
this.storageService.store(`scm.viewMode`, mode, 1 , 0 );
|
|
2311
|
-
}
|
|
2312
|
-
get viewSortKey() { return this._viewSortKey; }
|
|
2313
|
-
set viewSortKey(sortKey) {
|
|
2314
|
-
if (this._viewSortKey === sortKey) {
|
|
2315
|
-
return;
|
|
2316
|
-
}
|
|
2317
|
-
this._viewSortKey = sortKey;
|
|
2318
|
-
this.updateChildren();
|
|
2319
|
-
this.viewSortKeyContextKey.set(sortKey);
|
|
2320
|
-
this._onDidChangeViewSortKey.fire(sortKey);
|
|
2321
|
-
if (this._viewMode === "list" ) {
|
|
2322
|
-
this.storageService.store(`scm.viewSortKey`, sortKey, 1 , 0 );
|
|
2323
|
-
}
|
|
2324
|
-
}
|
|
2325
|
-
constructor(options, commandService, editorService, logService, menuService, scmService, scmViewService, storageService, uriIdentityService, keybindingService, themeService, contextMenuService, instantiationService, viewDescriptorService, configurationService, contextKeyService, openerService, telemetryService) {
|
|
2326
|
-
super({ ...options, titleMenuId: MenuId.SCMTitle }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
|
2327
|
-
this.commandService = commandService;
|
|
2328
|
-
this.editorService = editorService;
|
|
2329
|
-
this.logService = logService;
|
|
2330
|
-
this.menuService = menuService;
|
|
2331
|
-
this.scmService = scmService;
|
|
2332
|
-
this.scmViewService = scmViewService;
|
|
2333
|
-
this.storageService = storageService;
|
|
2334
|
-
this.uriIdentityService = uriIdentityService;
|
|
2335
|
-
this._onDidChangeViewMode = ( new Emitter());
|
|
2336
|
-
this.onDidChangeViewMode = this._onDidChangeViewMode.event;
|
|
2337
|
-
this._onDidChangeViewSortKey = ( new Emitter());
|
|
2338
|
-
this.onDidChangeViewSortKey = this._onDidChangeViewSortKey.event;
|
|
2339
|
-
this.items = ( new DisposableMap());
|
|
2340
|
-
this.visibilityDisposables = ( new DisposableStore());
|
|
2341
|
-
this.treeOperationSequencer = ( new Sequencer());
|
|
2342
|
-
this.revealResourceThrottler = ( new Throttler());
|
|
2343
|
-
this.updateChildrenThrottler = ( new Throttler());
|
|
2344
|
-
this.disposables = ( new DisposableStore());
|
|
2345
|
-
this._viewMode = this.getViewMode();
|
|
2346
|
-
this._viewSortKey = this.getViewSortKey();
|
|
2347
|
-
this.viewModeContextKey = ContextKeys.SCMViewMode.bindTo(contextKeyService);
|
|
2348
|
-
this.viewModeContextKey.set(this._viewMode);
|
|
2349
|
-
this.viewSortKeyContextKey = ContextKeys.SCMViewSortKey.bindTo(contextKeyService);
|
|
2350
|
-
this.viewSortKeyContextKey.set(this.viewSortKey);
|
|
2351
|
-
this.areAllRepositoriesCollapsedContextKey = ContextKeys.SCMViewAreAllRepositoriesCollapsed.bindTo(contextKeyService);
|
|
2352
|
-
this.isAnyRepositoryCollapsibleContextKey = ContextKeys.SCMViewIsAnyRepositoryCollapsible.bindTo(contextKeyService);
|
|
2353
|
-
this.scmProviderContextKey = ContextKeys.SCMProvider.bindTo(contextKeyService);
|
|
2354
|
-
this.scmProviderRootUriContextKey = ContextKeys.SCMProviderRootUri.bindTo(contextKeyService);
|
|
2355
|
-
this.scmProviderHasRootUriContextKey = ContextKeys.SCMProviderHasRootUri.bindTo(contextKeyService);
|
|
2356
|
-
this._onDidLayout = ( new Emitter());
|
|
2357
|
-
this.layoutCache = { height: undefined, width: undefined, onDidChange: this._onDidLayout.event };
|
|
2358
|
-
this.storageService.onDidChangeValue(1 , undefined, this.disposables)(e => {
|
|
2359
|
-
switch (e.key) {
|
|
2360
|
-
case 'scm.viewMode':
|
|
2361
|
-
this.viewMode = this.getViewMode();
|
|
2362
|
-
break;
|
|
2363
|
-
case 'scm.viewSortKey':
|
|
2364
|
-
this.viewSortKey = this.getViewSortKey();
|
|
2365
|
-
break;
|
|
2366
|
-
}
|
|
2367
|
-
}, this, this.disposables);
|
|
2368
|
-
this.storageService.onWillSaveState(e => {
|
|
2369
|
-
this.viewMode = this.getViewMode();
|
|
2370
|
-
this.viewSortKey = this.getViewSortKey();
|
|
2371
|
-
this.storeTreeViewState();
|
|
2372
|
-
}, this, this.disposables);
|
|
2373
|
-
this.disposables.add(this.instantiationService.createInstance(ScmInputContentProvider));
|
|
2374
|
-
Event.any(this.scmService.onDidAddRepository, this.scmService.onDidRemoveRepository)(() => this._onDidChangeViewWelcomeState.fire(), this, this.disposables);
|
|
2375
|
-
this.disposables.add(this.revealResourceThrottler);
|
|
2376
|
-
this.disposables.add(this.updateChildrenThrottler);
|
|
2377
|
-
}
|
|
2378
|
-
layoutBody(height = this.layoutCache.height, width = this.layoutCache.width) {
|
|
2379
|
-
if (height === undefined) {
|
|
2380
|
-
return;
|
|
2381
|
-
}
|
|
2382
|
-
if (width !== undefined) {
|
|
2383
|
-
super.layoutBody(height, width);
|
|
2384
|
-
}
|
|
2385
|
-
this.layoutCache.height = height;
|
|
2386
|
-
this.layoutCache.width = width;
|
|
2387
|
-
this._onDidLayout.fire();
|
|
2388
|
-
this.treeContainer.style.height = `${height}px`;
|
|
2389
|
-
this.tree.layout(height, width);
|
|
2390
|
-
}
|
|
2391
|
-
renderBody(container) {
|
|
2392
|
-
super.renderBody(container);
|
|
2393
|
-
this.treeContainer = append(container, $('.scm-view.show-file-icons'));
|
|
2394
|
-
this.treeContainer.classList.add('file-icon-themable-tree');
|
|
2395
|
-
this.treeContainer.classList.add('show-file-icons');
|
|
2396
|
-
const updateActionsVisibility = () => this.treeContainer.classList.toggle('show-actions', this.configurationService.getValue('scm.alwaysShowActions'));
|
|
2397
|
-
Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.alwaysShowActions'), this.disposables)(updateActionsVisibility, this, this.disposables);
|
|
2398
|
-
updateActionsVisibility();
|
|
2399
|
-
const updateProviderCountVisibility = () => {
|
|
2400
|
-
const value = this.configurationService.getValue('scm.providerCountBadge');
|
|
2401
|
-
this.treeContainer.classList.toggle('hide-provider-counts', value === 'hidden');
|
|
2402
|
-
this.treeContainer.classList.toggle('auto-provider-counts', value === 'auto');
|
|
2403
|
-
};
|
|
2404
|
-
Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.providerCountBadge'), this.disposables)(updateProviderCountVisibility, this, this.disposables);
|
|
2405
|
-
updateProviderCountVisibility();
|
|
2406
|
-
const viewState = this.loadTreeViewState();
|
|
2407
|
-
this.createTree(this.treeContainer, viewState);
|
|
2408
|
-
this.onDidChangeBodyVisibility(async (visible) => {
|
|
2409
|
-
if (visible) {
|
|
2410
|
-
await this.tree.setInput(this.scmViewService, viewState);
|
|
2411
|
-
Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.alwaysShowRepositories'), this.visibilityDisposables)(() => {
|
|
2412
|
-
this.updateActions();
|
|
2413
|
-
this.updateChildren();
|
|
2414
|
-
}, this, this.visibilityDisposables);
|
|
2415
|
-
Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.inputMinLineCount') ||
|
|
2416
|
-
e.affectsConfiguration('scm.inputMaxLineCount') ||
|
|
2417
|
-
e.affectsConfiguration('scm.showActionButton') ||
|
|
2418
|
-
e.affectsConfiguration('scm.showChangesSummary') ||
|
|
2419
|
-
e.affectsConfiguration('scm.showIncomingChanges') ||
|
|
2420
|
-
e.affectsConfiguration('scm.showOutgoingChanges'), this.visibilityDisposables)(() => this.updateChildren(), this, this.visibilityDisposables);
|
|
2421
|
-
this.editorService.onDidActiveEditorChange(this.onDidActiveEditorChange, this, this.visibilityDisposables);
|
|
2422
|
-
this.scmViewService.onDidChangeVisibleRepositories(this.onDidChangeVisibleRepositories, this, this.visibilityDisposables);
|
|
2423
|
-
this.onDidChangeVisibleRepositories({ added: this.scmViewService.visibleRepositories, removed: Iterable.empty() });
|
|
2424
|
-
if (typeof this.treeScrollTop === 'number') {
|
|
2425
|
-
this.tree.scrollTop = this.treeScrollTop;
|
|
2426
|
-
this.treeScrollTop = undefined;
|
|
2427
|
-
}
|
|
2428
|
-
}
|
|
2429
|
-
else {
|
|
2430
|
-
this.visibilityDisposables.clear();
|
|
2431
|
-
this.onDidChangeVisibleRepositories({ added: Iterable.empty(), removed: [...( this.items.keys())] });
|
|
2432
|
-
this.treeScrollTop = this.tree.scrollTop;
|
|
2433
|
-
}
|
|
2434
|
-
this.updateRepositoryCollapseAllContextKeys();
|
|
2435
|
-
}, this, this.disposables);
|
|
2436
|
-
this.disposables.add(this.instantiationService.createInstance(RepositoryVisibilityActionController));
|
|
2437
|
-
this.themeService.onDidFileIconThemeChange(this.updateIndentStyles, this, this.disposables);
|
|
2438
|
-
this.updateIndentStyles(this.themeService.getFileIconTheme());
|
|
2439
|
-
}
|
|
2440
|
-
createTree(container, viewState) {
|
|
2441
|
-
const overflowWidgetsDomNode = $('.scm-overflow-widgets-container.monaco-editor');
|
|
2442
|
-
this.inputRenderer = this.instantiationService.createInstance(InputRenderer, this.layoutCache, overflowWidgetsDomNode, (input, height) => { this.tree.updateElementHeight(input, height); });
|
|
2443
|
-
this.actionButtonRenderer = this.instantiationService.createInstance(ActionButtonRenderer);
|
|
2444
|
-
this.listLabels = this.instantiationService.createInstance(ResourceLabels, { onDidChangeVisibility: this.onDidChangeBodyVisibility });
|
|
2445
|
-
this.disposables.add(this.listLabels);
|
|
2446
|
-
const resourceActionRunner = ( new RepositoryPaneActionRunner(() => this.getSelectedResources()));
|
|
2447
|
-
resourceActionRunner.onWillRun(() => this.tree.domFocus(), this, this.disposables);
|
|
2448
|
-
this.disposables.add(resourceActionRunner);
|
|
2449
|
-
const historyItemGroupActionRunner = ( new HistoryItemGroupActionRunner());
|
|
2450
|
-
historyItemGroupActionRunner.onWillRun(() => this.tree.domFocus(), this, this.disposables);
|
|
2451
|
-
this.disposables.add(historyItemGroupActionRunner);
|
|
2452
|
-
const historyItemActionRunner = ( new HistoryItemActionRunner());
|
|
2453
|
-
historyItemActionRunner.onWillRun(() => this.tree.domFocus(), this, this.disposables);
|
|
2454
|
-
this.disposables.add(historyItemActionRunner);
|
|
2455
|
-
const treeDataSource = this.instantiationService.createInstance(SCMTreeDataSource, () => this.viewMode);
|
|
2456
|
-
this.disposables.add(treeDataSource);
|
|
2457
|
-
this.tree = this.instantiationService.createInstance(WorkbenchCompressibleAsyncDataTree, 'SCM Tree Repo', container, ( new ListDelegate(this.inputRenderer)), ( new SCMTreeCompressionDelegate()), [
|
|
2458
|
-
this.inputRenderer,
|
|
2459
|
-
this.actionButtonRenderer,
|
|
2460
|
-
this.instantiationService.createInstance(RepositoryRenderer, MenuId.SCMTitle, getActionViewItemProvider(this.instantiationService)),
|
|
2461
|
-
this.instantiationService.createInstance(ResourceGroupRenderer, getActionViewItemProvider(this.instantiationService)),
|
|
2462
|
-
this.instantiationService.createInstance(ResourceRenderer, () => this.viewMode, this.listLabels, getActionViewItemProvider(this.instantiationService), resourceActionRunner),
|
|
2463
|
-
this.instantiationService.createInstance(HistoryItemGroupRenderer, historyItemGroupActionRunner),
|
|
2464
|
-
this.instantiationService.createInstance(HistoryItemRenderer, historyItemActionRunner, getActionViewItemProvider(this.instantiationService)),
|
|
2465
|
-
this.instantiationService.createInstance(HistoryItemChangeRenderer, () => this.viewMode, this.listLabels),
|
|
2466
|
-
this.instantiationService.createInstance(SeparatorRenderer)
|
|
2467
|
-
], treeDataSource, {
|
|
2468
|
-
horizontalScrolling: false,
|
|
2469
|
-
setRowLineHeight: false,
|
|
2470
|
-
transformOptimization: false,
|
|
2471
|
-
filter: ( new SCMTreeFilter()),
|
|
2472
|
-
dnd: ( new SCMTreeDragAndDrop(this.instantiationService)),
|
|
2473
|
-
identityProvider: ( new SCMResourceIdentityProvider()),
|
|
2474
|
-
sorter: ( new SCMTreeSorter(() => this.viewMode, () => this.viewSortKey)),
|
|
2475
|
-
keyboardNavigationLabelProvider: this.instantiationService.createInstance(SCMTreeKeyboardNavigationLabelProvider, () => this.viewMode),
|
|
2476
|
-
overrideStyles: {
|
|
2477
|
-
listBackground: this.viewDescriptorService.getViewLocationById(this.id) === 1 ? PANEL_BACKGROUND : SIDE_BAR_BACKGROUND
|
|
2478
|
-
},
|
|
2479
|
-
collapseByDefault: (e) => {
|
|
2480
|
-
if (isSCMRepository(e) || isSCMResourceGroup(e) || isSCMResourceNode(e) || isSCMHistoryItemChangeNode(e)) {
|
|
2481
|
-
return false;
|
|
2482
|
-
}
|
|
2483
|
-
return (viewState?.expanded ?? []).indexOf(getSCMResourceId(e)) === -1;
|
|
2484
|
-
},
|
|
2485
|
-
accessibilityProvider: this.instantiationService.createInstance(SCMAccessibilityProvider)
|
|
2486
|
-
});
|
|
2487
|
-
this.disposables.add(this.tree);
|
|
2488
|
-
this.tree.onDidOpen(this.open, this, this.disposables);
|
|
2489
|
-
this.tree.onContextMenu(this.onListContextMenu, this, this.disposables);
|
|
2490
|
-
this.tree.onDidScroll(this.inputRenderer.clearValidation, this.inputRenderer, this.disposables);
|
|
2491
|
-
Event.filter(this.tree.onDidChangeCollapseState, e => isSCMRepository(e.node.element?.element), this.disposables)(this.updateRepositoryCollapseAllContextKeys, this, this.disposables);
|
|
2492
|
-
append(container, overflowWidgetsDomNode);
|
|
2493
|
-
}
|
|
2494
|
-
async open(e) {
|
|
2495
|
-
if (!e.element) {
|
|
2496
|
-
return;
|
|
2497
|
-
}
|
|
2498
|
-
else if (isSCMRepository(e.element)) {
|
|
2499
|
-
this.scmViewService.focus(e.element);
|
|
2500
|
-
return;
|
|
2501
|
-
}
|
|
2502
|
-
else if (isSCMInput(e.element)) {
|
|
2503
|
-
this.scmViewService.focus(e.element.repository);
|
|
2504
|
-
const widgets = this.inputRenderer.getRenderedInputWidget(e.element);
|
|
2505
|
-
if (widgets) {
|
|
2506
|
-
for (const widget of widgets) {
|
|
2507
|
-
widget.focus();
|
|
2508
|
-
}
|
|
2509
|
-
this.tree.setFocus([], e.browserEvent);
|
|
2510
|
-
const selection = this.tree.getSelection();
|
|
2511
|
-
if (selection.length === 1 && selection[0] === e.element) {
|
|
2512
|
-
setTimeout(() => this.tree.setSelection([]));
|
|
2513
|
-
}
|
|
2514
|
-
}
|
|
2515
|
-
return;
|
|
2516
|
-
}
|
|
2517
|
-
else if (isSCMActionButton(e.element)) {
|
|
2518
|
-
this.scmViewService.focus(e.element.repository);
|
|
2519
|
-
this.actionButtonRenderer.focusActionButton(e.element);
|
|
2520
|
-
this.tree.setFocus([], e.browserEvent);
|
|
2521
|
-
return;
|
|
2522
|
-
}
|
|
2523
|
-
else if (isSCMResourceGroup(e.element)) {
|
|
2524
|
-
const provider = e.element.provider;
|
|
2525
|
-
const repository = Iterable.find(this.scmService.repositories, r => r.provider === provider);
|
|
2526
|
-
if (repository) {
|
|
2527
|
-
this.scmViewService.focus(repository);
|
|
2528
|
-
}
|
|
2529
|
-
return;
|
|
2530
|
-
}
|
|
2531
|
-
else if (isSCMResource(e.element)) {
|
|
2532
|
-
if (e.element.command?.id === API_OPEN_EDITOR_COMMAND_ID || e.element.command?.id === API_OPEN_DIFF_EDITOR_COMMAND_ID) {
|
|
2533
|
-
await this.commandService.executeCommand(e.element.command.id, ...(e.element.command.arguments || []), e);
|
|
2534
|
-
}
|
|
2535
|
-
else {
|
|
2536
|
-
await e.element.open(!!e.editorOptions.preserveFocus);
|
|
2537
|
-
if (e.editorOptions.pinned) {
|
|
2538
|
-
const activeEditorPane = this.editorService.activeEditorPane;
|
|
2539
|
-
activeEditorPane?.group.pinEditor(activeEditorPane.input);
|
|
2540
|
-
}
|
|
2541
|
-
}
|
|
2542
|
-
const provider = e.element.resourceGroup.provider;
|
|
2543
|
-
const repository = Iterable.find(this.scmService.repositories, r => r.provider === provider);
|
|
2544
|
-
if (repository) {
|
|
2545
|
-
this.scmViewService.focus(repository);
|
|
2546
|
-
}
|
|
2547
|
-
}
|
|
2548
|
-
else if (isSCMResourceNode(e.element)) {
|
|
2549
|
-
const provider = e.element.context.provider;
|
|
2550
|
-
const repository = Iterable.find(this.scmService.repositories, r => r.provider === provider);
|
|
2551
|
-
if (repository) {
|
|
2552
|
-
this.scmViewService.focus(repository);
|
|
2553
|
-
}
|
|
2554
|
-
return;
|
|
2555
|
-
}
|
|
2556
|
-
else if (isSCMHistoryItemGroupTreeElement(e.element)) {
|
|
2557
|
-
this.scmViewService.focus(e.element.repository);
|
|
2558
|
-
return;
|
|
2559
|
-
}
|
|
2560
|
-
else if (isSCMHistoryItemTreeElement(e.element)) {
|
|
2561
|
-
this.scmViewService.focus(e.element.historyItemGroup.repository);
|
|
2562
|
-
return;
|
|
2563
|
-
}
|
|
2564
|
-
else if (isSCMHistoryItemChangeTreeElement(e.element)) {
|
|
2565
|
-
if (e.element.originalUri && e.element.modifiedUri) {
|
|
2566
|
-
await this.commandService.executeCommand(API_OPEN_DIFF_EDITOR_COMMAND_ID, ...toDiffEditorArguments(e.element.uri, e.element.originalUri, e.element.modifiedUri), e);
|
|
2567
|
-
}
|
|
2568
|
-
this.scmViewService.focus(e.element.historyItem.historyItemGroup.repository);
|
|
2569
|
-
return;
|
|
2570
|
-
}
|
|
2571
|
-
else if (isSCMHistoryItemChangeNode(e.element)) {
|
|
2572
|
-
this.scmViewService.focus(e.element.context.historyItemGroup.repository);
|
|
2573
|
-
return;
|
|
2574
|
-
}
|
|
2575
|
-
}
|
|
2576
|
-
onDidActiveEditorChange() {
|
|
2577
|
-
if (!this.configurationService.getValue('scm.autoReveal')) {
|
|
2578
|
-
return;
|
|
2579
|
-
}
|
|
2580
|
-
const uri = EditorResourceAccessor.getOriginalUri(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
2581
|
-
if (!uri) {
|
|
2582
|
-
return;
|
|
2583
|
-
}
|
|
2584
|
-
if (( this.tree.getFocus().some(
|
|
2585
|
-
e => isSCMResource(e) && this.uriIdentityService.extUri.isEqual(e.sourceUri, uri)
|
|
2586
|
-
)) &&
|
|
2587
|
-
( this.tree.getSelection().some(
|
|
2588
|
-
e => isSCMResource(e) && this.uriIdentityService.extUri.isEqual(e.sourceUri, uri)
|
|
2589
|
-
))) {
|
|
2590
|
-
return;
|
|
2591
|
-
}
|
|
2592
|
-
this.revealResourceThrottler.queue(() => this.treeOperationSequencer.queue(async () => {
|
|
2593
|
-
for (const repository of this.scmViewService.visibleRepositories) {
|
|
2594
|
-
const item = this.items.get(repository);
|
|
2595
|
-
if (!item) {
|
|
2596
|
-
continue;
|
|
2597
|
-
}
|
|
2598
|
-
for (let j = repository.provider.groups.length - 1; j >= 0; j--) {
|
|
2599
|
-
const groupItem = repository.provider.groups[j];
|
|
2600
|
-
const resource = this.viewMode === "tree"
|
|
2601
|
-
? groupItem.resourceTree.getNode(uri)?.element
|
|
2602
|
-
: groupItem.resources.find(r => this.uriIdentityService.extUri.isEqual(r.sourceUri, uri));
|
|
2603
|
-
if (resource) {
|
|
2604
|
-
await this.tree.expandTo(resource);
|
|
2605
|
-
this.tree.setSelection([resource]);
|
|
2606
|
-
this.tree.setFocus([resource]);
|
|
2607
|
-
return;
|
|
2608
|
-
}
|
|
2609
|
-
}
|
|
2610
|
-
}
|
|
2611
|
-
}));
|
|
2612
|
-
}
|
|
2613
|
-
onDidChangeVisibleRepositories({ added, removed }) {
|
|
2614
|
-
for (const repository of added) {
|
|
2615
|
-
const repositoryDisposables = ( new DisposableStore());
|
|
2616
|
-
repositoryDisposables.add(repository.provider.onDidChange(() => this.updateChildren(repository)));
|
|
2617
|
-
repositoryDisposables.add(repository.input.onDidChangeVisibility(() => this.updateChildren(repository)));
|
|
2618
|
-
repositoryDisposables.add(repository.provider.onDidChangeResourceGroups(() => this.updateChildren(repository)));
|
|
2619
|
-
repositoryDisposables.add(Event.runAndSubscribe(repository.provider.onDidChangeHistoryProvider, () => {
|
|
2620
|
-
if (!repository.provider.historyProvider) {
|
|
2621
|
-
this.logService.debug('SCMViewPane:onDidChangeVisibleRepositories - no history provider present');
|
|
2622
|
-
return;
|
|
2623
|
-
}
|
|
2624
|
-
repositoryDisposables.add(repository.provider.historyProvider.onDidChangeCurrentHistoryItemGroup(() => {
|
|
2625
|
-
this.updateChildren(repository);
|
|
2626
|
-
this.logService.debug('SCMViewPane:onDidChangeCurrentHistoryItemGroup - update children');
|
|
2627
|
-
}));
|
|
2628
|
-
this.logService.debug('SCMViewPane:onDidChangeVisibleRepositories - onDidChangeCurrentHistoryItemGroup listener added');
|
|
2629
|
-
}));
|
|
2630
|
-
const resourceGroupDisposables = repositoryDisposables.add(( new DisposableMap()));
|
|
2631
|
-
const onDidChangeResourceGroups = () => {
|
|
2632
|
-
for (const [resourceGroup] of resourceGroupDisposables) {
|
|
2633
|
-
if (!repository.provider.groups.includes(resourceGroup)) {
|
|
2634
|
-
resourceGroupDisposables.deleteAndDispose(resourceGroup);
|
|
2635
|
-
}
|
|
2636
|
-
}
|
|
2637
|
-
for (const resourceGroup of repository.provider.groups) {
|
|
2638
|
-
if (!( resourceGroupDisposables.has(resourceGroup))) {
|
|
2639
|
-
const disposableStore = ( new DisposableStore());
|
|
2640
|
-
disposableStore.add(resourceGroup.onDidChange(() => this.updateChildren(repository)));
|
|
2641
|
-
disposableStore.add(resourceGroup.onDidChangeResources(() => this.updateChildren(repository)));
|
|
2642
|
-
resourceGroupDisposables.set(resourceGroup, disposableStore);
|
|
2643
|
-
}
|
|
2644
|
-
}
|
|
2645
|
-
};
|
|
2646
|
-
repositoryDisposables.add(repository.provider.onDidChangeResourceGroups(onDidChangeResourceGroups));
|
|
2647
|
-
onDidChangeResourceGroups();
|
|
2648
|
-
this.items.set(repository, repositoryDisposables);
|
|
2649
|
-
}
|
|
2650
|
-
for (const repository of removed) {
|
|
2651
|
-
this.items.deleteAndDispose(repository);
|
|
2652
|
-
}
|
|
2653
|
-
this.updateChildren();
|
|
2654
|
-
this.onDidActiveEditorChange();
|
|
2655
|
-
}
|
|
2656
|
-
onListContextMenu(e) {
|
|
2657
|
-
if (!e.element) {
|
|
2658
|
-
const menu = this.menuService.createMenu(Menus.ViewSort, this.contextKeyService);
|
|
2659
|
-
const actions = [];
|
|
2660
|
-
createAndFillInContextMenuActions(menu, undefined, actions);
|
|
2661
|
-
return this.contextMenuService.showContextMenu({
|
|
2662
|
-
getAnchor: () => e.anchor,
|
|
2663
|
-
getActions: () => actions,
|
|
2664
|
-
onHide: () => {
|
|
2665
|
-
menu.dispose();
|
|
2666
|
-
}
|
|
2667
|
-
});
|
|
2668
|
-
}
|
|
2669
|
-
const element = e.element;
|
|
2670
|
-
let context = element;
|
|
2671
|
-
let actions = [];
|
|
2672
|
-
let actionRunner = ( new RepositoryPaneActionRunner(() => this.getSelectedResources()));
|
|
2673
|
-
if (isSCMRepository(element)) {
|
|
2674
|
-
const menus = this.scmViewService.menus.getRepositoryMenus(element.provider);
|
|
2675
|
-
const menu = menus.repositoryContextMenu;
|
|
2676
|
-
context = element.provider;
|
|
2677
|
-
actionRunner = ( new RepositoryActionRunner(() => this.getSelectedRepositories()));
|
|
2678
|
-
actions = collectContextMenuActions(menu);
|
|
2679
|
-
}
|
|
2680
|
-
else if (isSCMInput(element) || isSCMActionButton(element)) ;
|
|
2681
|
-
else if (isSCMResourceGroup(element)) {
|
|
2682
|
-
const menus = this.scmViewService.menus.getRepositoryMenus(element.provider);
|
|
2683
|
-
const menu = menus.getResourceGroupMenu(element);
|
|
2684
|
-
actions = collectContextMenuActions(menu);
|
|
2685
|
-
}
|
|
2686
|
-
else if (isSCMResource(element)) {
|
|
2687
|
-
const menus = this.scmViewService.menus.getRepositoryMenus(element.resourceGroup.provider);
|
|
2688
|
-
const menu = menus.getResourceMenu(element);
|
|
2689
|
-
actions = collectContextMenuActions(menu);
|
|
2690
|
-
}
|
|
2691
|
-
else if (isSCMResourceNode(element)) {
|
|
2692
|
-
if (element.element) {
|
|
2693
|
-
const menus = this.scmViewService.menus.getRepositoryMenus(element.element.resourceGroup.provider);
|
|
2694
|
-
const menu = menus.getResourceMenu(element.element);
|
|
2695
|
-
actions = collectContextMenuActions(menu);
|
|
2696
|
-
}
|
|
2697
|
-
else {
|
|
2698
|
-
const menus = this.scmViewService.menus.getRepositoryMenus(element.context.provider);
|
|
2699
|
-
const menu = menus.getResourceFolderMenu(element.context);
|
|
2700
|
-
actions = collectContextMenuActions(menu);
|
|
2701
|
-
}
|
|
2702
|
-
}
|
|
2703
|
-
else if (isSCMHistoryItemGroupTreeElement(element)) {
|
|
2704
|
-
const menus = this.scmViewService.menus.getRepositoryMenus(element.repository.provider);
|
|
2705
|
-
const menu = menus.historyProviderMenu?.getHistoryItemGroupContextMenu(element);
|
|
2706
|
-
if (menu) {
|
|
2707
|
-
actionRunner = ( new HistoryItemGroupActionRunner());
|
|
2708
|
-
createAndFillInContextMenuActions(menu, { shouldForwardArgs: true }, actions);
|
|
2709
|
-
}
|
|
2710
|
-
}
|
|
2711
|
-
else if (isSCMHistoryItemTreeElement(element)) {
|
|
2712
|
-
const menus = this.scmViewService.menus.getRepositoryMenus(element.historyItemGroup.repository.provider);
|
|
2713
|
-
const menu = menus.historyProviderMenu?.getHistoryItemMenu(element);
|
|
2714
|
-
if (menu) {
|
|
2715
|
-
actionRunner = ( new HistoryItemActionRunner());
|
|
2716
|
-
actions = collectContextMenuActions(menu);
|
|
2717
|
-
}
|
|
2718
|
-
}
|
|
2719
|
-
actionRunner.onWillRun(() => this.tree.domFocus());
|
|
2720
|
-
this.contextMenuService.showContextMenu({
|
|
2721
|
-
getAnchor: () => e.anchor,
|
|
2722
|
-
getActions: () => actions,
|
|
2723
|
-
getActionsContext: () => context,
|
|
2724
|
-
actionRunner
|
|
2725
|
-
});
|
|
2726
|
-
}
|
|
2727
|
-
getSelectedRepositories() {
|
|
2728
|
-
const focusedRepositories = this.tree.getFocus().filter(r => !!r && isSCMRepository(r));
|
|
2729
|
-
const selectedRepositories = this.tree.getSelection().filter(r => !!r && isSCMRepository(r));
|
|
2730
|
-
return Array.from(( new Set([...focusedRepositories, ...selectedRepositories])));
|
|
2731
|
-
}
|
|
2732
|
-
getSelectedResources() {
|
|
2733
|
-
return this.tree.getSelection()
|
|
2734
|
-
.filter(r => !!r && !isSCMResourceGroup(r));
|
|
2735
|
-
}
|
|
2736
|
-
getViewMode() {
|
|
2737
|
-
let mode = this.configurationService.getValue('scm.defaultViewMode') === 'list' ? "list" : "tree" ;
|
|
2738
|
-
const storageMode = this.storageService.get(`scm.viewMode`, 1 );
|
|
2739
|
-
if (typeof storageMode === 'string') {
|
|
2740
|
-
mode = storageMode;
|
|
2741
|
-
}
|
|
2742
|
-
return mode;
|
|
2743
|
-
}
|
|
2744
|
-
getViewSortKey() {
|
|
2745
|
-
if (this._viewMode === "tree" ) {
|
|
2746
|
-
return "path" ;
|
|
2747
|
-
}
|
|
2748
|
-
let viewSortKey;
|
|
2749
|
-
const viewSortKeyString = this.configurationService.getValue('scm.defaultViewSortKey');
|
|
2750
|
-
switch (viewSortKeyString) {
|
|
2751
|
-
case 'name':
|
|
2752
|
-
viewSortKey = "name" ;
|
|
2753
|
-
break;
|
|
2754
|
-
case 'status':
|
|
2755
|
-
viewSortKey = "status" ;
|
|
2756
|
-
break;
|
|
2757
|
-
default:
|
|
2758
|
-
viewSortKey = "path" ;
|
|
2759
|
-
break;
|
|
2760
|
-
}
|
|
2761
|
-
const storageSortKey = this.storageService.get(`scm.viewSortKey`, 1 );
|
|
2762
|
-
if (typeof storageSortKey === 'string') {
|
|
2763
|
-
viewSortKey = storageSortKey;
|
|
2764
|
-
}
|
|
2765
|
-
return viewSortKey;
|
|
2766
|
-
}
|
|
2767
|
-
loadTreeViewState() {
|
|
2768
|
-
const storageViewState = this.storageService.get('scm.viewState2', 1 );
|
|
2769
|
-
if (!storageViewState) {
|
|
2770
|
-
return undefined;
|
|
2771
|
-
}
|
|
2772
|
-
try {
|
|
2773
|
-
const treeViewState = JSON.parse(storageViewState);
|
|
2774
|
-
return treeViewState;
|
|
2775
|
-
}
|
|
2776
|
-
catch {
|
|
2777
|
-
return undefined;
|
|
2778
|
-
}
|
|
2779
|
-
}
|
|
2780
|
-
storeTreeViewState() {
|
|
2781
|
-
if (this.tree) {
|
|
2782
|
-
this.storageService.store('scm.viewState2', JSON.stringify(this.tree.getViewState()), 1 , 1 );
|
|
2783
|
-
}
|
|
2784
|
-
}
|
|
2785
|
-
updateChildren(element) {
|
|
2786
|
-
this.updateChildrenThrottler.queue(() => this.treeOperationSequencer.queue(async () => {
|
|
2787
|
-
const focusedInput = this.inputRenderer.getFocusedInput();
|
|
2788
|
-
if (element && this.tree.hasNode(element)) {
|
|
2789
|
-
await this.tree.updateChildren(element);
|
|
2790
|
-
}
|
|
2791
|
-
else {
|
|
2792
|
-
await this.tree.updateChildren(undefined);
|
|
2793
|
-
}
|
|
2794
|
-
if (focusedInput) {
|
|
2795
|
-
this.inputRenderer.getRenderedInputWidget(focusedInput)?.forEach(widget => widget.focus());
|
|
2796
|
-
}
|
|
2797
|
-
this.updateScmProviderContextKeys();
|
|
2798
|
-
this.updateRepositoryCollapseAllContextKeys();
|
|
2799
|
-
}));
|
|
2800
|
-
}
|
|
2801
|
-
updateIndentStyles(theme) {
|
|
2802
|
-
this.treeContainer.classList.toggle('list-view-mode', this.viewMode === "list" );
|
|
2803
|
-
this.treeContainer.classList.toggle('tree-view-mode', this.viewMode === "tree" );
|
|
2804
|
-
this.treeContainer.classList.toggle('align-icons-and-twisties', (this.viewMode === "list" && theme.hasFileIcons) || (theme.hasFileIcons && !theme.hasFolderIcons));
|
|
2805
|
-
this.treeContainer.classList.toggle('hide-arrows', this.viewMode === "tree" && theme.hidesExplorerArrows === true);
|
|
2806
|
-
}
|
|
2807
|
-
updateScmProviderContextKeys() {
|
|
2808
|
-
const alwaysShowRepositories = this.configurationService.getValue('scm.alwaysShowRepositories');
|
|
2809
|
-
if (!alwaysShowRepositories && this.items.size === 1) {
|
|
2810
|
-
const provider = Iterable.first(( this.items.keys())).provider;
|
|
2811
|
-
this.scmProviderContextKey.set(provider.contextValue);
|
|
2812
|
-
this.scmProviderRootUriContextKey.set(provider.rootUri?.toString());
|
|
2813
|
-
this.scmProviderHasRootUriContextKey.set(!!provider.rootUri);
|
|
2814
|
-
}
|
|
2815
|
-
else {
|
|
2816
|
-
this.scmProviderContextKey.set(undefined);
|
|
2817
|
-
this.scmProviderRootUriContextKey.set(undefined);
|
|
2818
|
-
this.scmProviderHasRootUriContextKey.set(false);
|
|
2819
|
-
}
|
|
2820
|
-
}
|
|
2821
|
-
updateRepositoryCollapseAllContextKeys() {
|
|
2822
|
-
if (!this.isBodyVisible() || this.items.size === 1) {
|
|
2823
|
-
this.isAnyRepositoryCollapsibleContextKey.set(false);
|
|
2824
|
-
this.areAllRepositoriesCollapsedContextKey.set(false);
|
|
2825
|
-
return;
|
|
2826
|
-
}
|
|
2827
|
-
this.isAnyRepositoryCollapsibleContextKey.set(( this.scmViewService.visibleRepositories.some(r => this.tree.hasElement(r) && this.tree.isCollapsible(r))));
|
|
2828
|
-
this.areAllRepositoriesCollapsedContextKey.set(this.scmViewService.visibleRepositories.every(r => this.tree.hasElement(r) && (!this.tree.isCollapsible(r) || this.tree.isCollapsed(r))));
|
|
2829
|
-
}
|
|
2830
|
-
collapseAllRepositories() {
|
|
2831
|
-
for (const repository of this.scmViewService.visibleRepositories) {
|
|
2832
|
-
if (this.tree.isCollapsible(repository)) {
|
|
2833
|
-
this.tree.collapse(repository);
|
|
2834
|
-
}
|
|
2835
|
-
}
|
|
2836
|
-
}
|
|
2837
|
-
expandAllRepositories() {
|
|
2838
|
-
for (const repository of this.scmViewService.visibleRepositories) {
|
|
2839
|
-
if (this.tree.isCollapsible(repository)) {
|
|
2840
|
-
this.tree.expand(repository);
|
|
2841
|
-
}
|
|
2842
|
-
}
|
|
2843
|
-
}
|
|
2844
|
-
shouldShowWelcome() {
|
|
2845
|
-
return this.scmService.repositoryCount === 0;
|
|
2846
|
-
}
|
|
2847
|
-
getActionsContext() {
|
|
2848
|
-
return this.scmViewService.visibleRepositories.length === 1 ? this.scmViewService.visibleRepositories[0].provider : undefined;
|
|
2849
|
-
}
|
|
2850
|
-
focus() {
|
|
2851
|
-
super.focus();
|
|
2852
|
-
if (this.isExpanded()) {
|
|
2853
|
-
if (this.tree.getFocus().length === 0) {
|
|
2854
|
-
for (const repository of this.scmViewService.visibleRepositories) {
|
|
2855
|
-
const widgets = this.inputRenderer.getRenderedInputWidget(repository.input);
|
|
2856
|
-
if (widgets) {
|
|
2857
|
-
for (const widget of widgets) {
|
|
2858
|
-
widget.focus();
|
|
2859
|
-
}
|
|
2860
|
-
return;
|
|
2861
|
-
}
|
|
2862
|
-
}
|
|
2863
|
-
}
|
|
2864
|
-
this.tree.domFocus();
|
|
2865
|
-
}
|
|
2866
|
-
}
|
|
2867
|
-
dispose() {
|
|
2868
|
-
this.visibilityDisposables.dispose();
|
|
2869
|
-
this.disposables.dispose();
|
|
2870
|
-
this.items.dispose();
|
|
2871
|
-
super.dispose();
|
|
2872
|
-
}
|
|
2873
|
-
};
|
|
2874
|
-
SCMViewPane = ( __decorate([
|
|
2875
|
-
( __param(1, ICommandService)),
|
|
2876
|
-
( __param(2, IEditorService)),
|
|
2877
|
-
( __param(3, ILogService)),
|
|
2878
|
-
( __param(4, IMenuService)),
|
|
2879
|
-
( __param(5, ISCMService)),
|
|
2880
|
-
( __param(6, ISCMViewService)),
|
|
2881
|
-
( __param(7, IStorageService)),
|
|
2882
|
-
( __param(8, IUriIdentityService)),
|
|
2883
|
-
( __param(9, IKeybindingService)),
|
|
2884
|
-
( __param(10, IThemeService)),
|
|
2885
|
-
( __param(11, IContextMenuService)),
|
|
2886
|
-
( __param(12, IInstantiationService)),
|
|
2887
|
-
( __param(13, IViewDescriptorService)),
|
|
2888
|
-
( __param(14, IConfigurationService)),
|
|
2889
|
-
( __param(15, IContextKeyService)),
|
|
2890
|
-
( __param(16, IOpenerService)),
|
|
2891
|
-
( __param(17, ITelemetryService))
|
|
2892
|
-
], SCMViewPane));
|
|
2893
|
-
let SCMTreeDataSource = class SCMTreeDataSource {
|
|
2894
|
-
constructor(viewMode, configurationService, logService, scmViewService, uriIdentityService) {
|
|
2895
|
-
this.viewMode = viewMode;
|
|
2896
|
-
this.configurationService = configurationService;
|
|
2897
|
-
this.logService = logService;
|
|
2898
|
-
this.scmViewService = scmViewService;
|
|
2899
|
-
this.uriIdentityService = uriIdentityService;
|
|
2900
|
-
this.historyProviderCache = ( new Map());
|
|
2901
|
-
this.repositoryDisposables = ( new DisposableMap());
|
|
2902
|
-
this.disposables = ( new DisposableStore());
|
|
2903
|
-
const onDidChangeConfiguration = Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.showChangesSummary'), this.disposables);
|
|
2904
|
-
this.disposables.add(onDidChangeConfiguration(() => this.historyProviderCache.clear()));
|
|
2905
|
-
this.scmViewService.onDidChangeVisibleRepositories(this.onDidChangeVisibleRepositories, this, this.disposables);
|
|
2906
|
-
this.onDidChangeVisibleRepositories({ added: this.scmViewService.visibleRepositories, removed: Iterable.empty() });
|
|
2907
|
-
}
|
|
2908
|
-
hasChildren(inputOrElement) {
|
|
2909
|
-
if (isSCMViewService(inputOrElement)) {
|
|
2910
|
-
return this.scmViewService.visibleRepositories.length !== 0;
|
|
2911
|
-
}
|
|
2912
|
-
else if (isSCMRepository(inputOrElement)) {
|
|
2913
|
-
return true;
|
|
2914
|
-
}
|
|
2915
|
-
else if (isSCMInput(inputOrElement)) {
|
|
2916
|
-
return false;
|
|
2917
|
-
}
|
|
2918
|
-
else if (isSCMActionButton(inputOrElement)) {
|
|
2919
|
-
return false;
|
|
2920
|
-
}
|
|
2921
|
-
else if (isSCMResourceGroup(inputOrElement)) {
|
|
2922
|
-
return true;
|
|
2923
|
-
}
|
|
2924
|
-
else if (isSCMResource(inputOrElement)) {
|
|
2925
|
-
return false;
|
|
2926
|
-
}
|
|
2927
|
-
else if (ResourceTree.isResourceNode(inputOrElement)) {
|
|
2928
|
-
return inputOrElement.childrenCount > 0;
|
|
2929
|
-
}
|
|
2930
|
-
else if (isSCMHistoryItemGroupTreeElement(inputOrElement)) {
|
|
2931
|
-
return true;
|
|
2932
|
-
}
|
|
2933
|
-
else if (isSCMHistoryItemTreeElement(inputOrElement)) {
|
|
2934
|
-
return true;
|
|
2935
|
-
}
|
|
2936
|
-
else if (isSCMHistoryItemChangeTreeElement(inputOrElement)) {
|
|
2937
|
-
return false;
|
|
2938
|
-
}
|
|
2939
|
-
else if (isSCMViewSeparator(inputOrElement)) {
|
|
2940
|
-
return false;
|
|
2941
|
-
}
|
|
2942
|
-
else {
|
|
2943
|
-
throw new Error('hasChildren not implemented.');
|
|
2944
|
-
}
|
|
2945
|
-
}
|
|
2946
|
-
async getChildren(inputOrElement) {
|
|
2947
|
-
const { alwaysShowRepositories, showActionButton } = this.getConfiguration();
|
|
2948
|
-
const repositoryCount = this.scmViewService.visibleRepositories.length;
|
|
2949
|
-
if (isSCMViewService(inputOrElement) && (repositoryCount > 1 || alwaysShowRepositories)) {
|
|
2950
|
-
return this.scmViewService.visibleRepositories;
|
|
2951
|
-
}
|
|
2952
|
-
else if ((isSCMViewService(inputOrElement) && repositoryCount === 1 && !alwaysShowRepositories) || isSCMRepository(inputOrElement)) {
|
|
2953
|
-
const children = [];
|
|
2954
|
-
inputOrElement = isSCMRepository(inputOrElement) ? inputOrElement : this.scmViewService.visibleRepositories[0];
|
|
2955
|
-
const actionButton = inputOrElement.provider.actionButton;
|
|
2956
|
-
const resourceGroups = inputOrElement.provider.groups;
|
|
2957
|
-
if (inputOrElement.input.visible) {
|
|
2958
|
-
children.push(inputOrElement.input);
|
|
2959
|
-
}
|
|
2960
|
-
if (showActionButton && actionButton) {
|
|
2961
|
-
children.push({
|
|
2962
|
-
type: 'actionButton',
|
|
2963
|
-
repository: inputOrElement,
|
|
2964
|
-
button: actionButton
|
|
2965
|
-
});
|
|
2966
|
-
}
|
|
2967
|
-
const hasSomeChanges = ( resourceGroups.some(group => group.resources.length > 0));
|
|
2968
|
-
if (hasSomeChanges || (repositoryCount === 1 && (!showActionButton || !actionButton))) {
|
|
2969
|
-
children.push(...resourceGroups);
|
|
2970
|
-
}
|
|
2971
|
-
const historyItemGroups = await this.getHistoryItemGroups(inputOrElement);
|
|
2972
|
-
if (historyItemGroups.length > 0) {
|
|
2973
|
-
let label = ( localizeWithPath(
|
|
2974
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
2975
|
-
'syncSeparatorHeader',
|
|
2976
|
-
"Incoming/Outgoing"
|
|
2977
|
-
));
|
|
2978
|
-
let ariaLabel = ( localizeWithPath(
|
|
2979
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
2980
|
-
'syncSeparatorHeaderAriaLabel',
|
|
2981
|
-
"Incoming and outgoing changes"
|
|
2982
|
-
));
|
|
2983
|
-
const incomingHistoryItems = historyItemGroups.find(g => g.direction === 'incoming');
|
|
2984
|
-
const outgoingHistoryItems = historyItemGroups.find(g => g.direction === 'outgoing');
|
|
2985
|
-
if (incomingHistoryItems && !outgoingHistoryItems) {
|
|
2986
|
-
label = ( localizeWithPath(
|
|
2987
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
2988
|
-
'syncIncomingSeparatorHeader',
|
|
2989
|
-
"Incoming"
|
|
2990
|
-
));
|
|
2991
|
-
ariaLabel = ( localizeWithPath(
|
|
2992
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
2993
|
-
'syncIncomingSeparatorHeaderAriaLabel',
|
|
2994
|
-
"Incoming changes"
|
|
2995
|
-
));
|
|
2996
|
-
}
|
|
2997
|
-
else if (!incomingHistoryItems && outgoingHistoryItems) {
|
|
2998
|
-
label = ( localizeWithPath(
|
|
2999
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
3000
|
-
'syncOutgoingSeparatorHeader',
|
|
3001
|
-
"Outgoing"
|
|
3002
|
-
));
|
|
3003
|
-
ariaLabel = ( localizeWithPath(
|
|
3004
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
3005
|
-
'syncOutgoingSeparatorHeaderAriaLabel',
|
|
3006
|
-
"Outgoing changes"
|
|
3007
|
-
));
|
|
3008
|
-
}
|
|
3009
|
-
children.push({ label, ariaLabel, repository: inputOrElement, type: 'separator' });
|
|
3010
|
-
}
|
|
3011
|
-
children.push(...historyItemGroups);
|
|
3012
|
-
return children;
|
|
3013
|
-
}
|
|
3014
|
-
else if (isSCMResourceGroup(inputOrElement)) {
|
|
3015
|
-
if (this.viewMode() === "list" ) {
|
|
3016
|
-
return inputOrElement.resources;
|
|
3017
|
-
}
|
|
3018
|
-
else if (this.viewMode() === "tree" ) {
|
|
3019
|
-
const children = [];
|
|
3020
|
-
for (const node of inputOrElement.resourceTree.root.children) {
|
|
3021
|
-
children.push(node.element && node.childrenCount === 0 ? node.element : node);
|
|
3022
|
-
}
|
|
3023
|
-
return children;
|
|
3024
|
-
}
|
|
3025
|
-
}
|
|
3026
|
-
else if (isSCMResourceNode(inputOrElement) || isSCMHistoryItemChangeNode(inputOrElement)) {
|
|
3027
|
-
const children = [];
|
|
3028
|
-
for (const node of inputOrElement.children) {
|
|
3029
|
-
children.push(node.element && node.childrenCount === 0 ? node.element : node);
|
|
3030
|
-
}
|
|
3031
|
-
return children;
|
|
3032
|
-
}
|
|
3033
|
-
else if (isSCMHistoryItemGroupTreeElement(inputOrElement)) {
|
|
3034
|
-
return this.getHistoryItems(inputOrElement);
|
|
3035
|
-
}
|
|
3036
|
-
else if (isSCMHistoryItemTreeElement(inputOrElement)) {
|
|
3037
|
-
return this.getHistoryItemChanges(inputOrElement);
|
|
3038
|
-
}
|
|
3039
|
-
return [];
|
|
3040
|
-
}
|
|
3041
|
-
async getHistoryItemGroups(element) {
|
|
3042
|
-
const { showIncomingChanges, showOutgoingChanges } = this.getConfiguration();
|
|
3043
|
-
const scmProvider = element.provider;
|
|
3044
|
-
const historyProvider = scmProvider.historyProvider;
|
|
3045
|
-
const currentHistoryItemGroup = historyProvider?.currentHistoryItemGroup;
|
|
3046
|
-
if (!historyProvider || !currentHistoryItemGroup || (showIncomingChanges === 'never' && showOutgoingChanges === 'never')) {
|
|
3047
|
-
return [];
|
|
3048
|
-
}
|
|
3049
|
-
const children = [];
|
|
3050
|
-
const historyProviderCacheEntry = this.getHistoryProviderCacheEntry(element);
|
|
3051
|
-
let incomingHistoryItemGroup = historyProviderCacheEntry?.incomingHistoryItemGroup;
|
|
3052
|
-
let outgoingHistoryItemGroup = historyProviderCacheEntry?.outgoingHistoryItemGroup;
|
|
3053
|
-
if (!incomingHistoryItemGroup && !outgoingHistoryItemGroup) {
|
|
3054
|
-
const ancestor = await historyProvider.resolveHistoryItemGroupCommonAncestor(currentHistoryItemGroup.id, currentHistoryItemGroup.base?.id);
|
|
3055
|
-
if (!ancestor) {
|
|
3056
|
-
return [];
|
|
3057
|
-
}
|
|
3058
|
-
incomingHistoryItemGroup = currentHistoryItemGroup.base ? {
|
|
3059
|
-
id: currentHistoryItemGroup.base.id,
|
|
3060
|
-
label: currentHistoryItemGroup.base.label,
|
|
3061
|
-
ariaLabel: ( localizeWithPath(
|
|
3062
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
3063
|
-
'incomingChangesAriaLabel',
|
|
3064
|
-
"Incoming changes from {0}",
|
|
3065
|
-
currentHistoryItemGroup.base.label
|
|
3066
|
-
)),
|
|
3067
|
-
icon: Codicon.arrowCircleDown,
|
|
3068
|
-
direction: 'incoming',
|
|
3069
|
-
ancestor: ancestor.id,
|
|
3070
|
-
count: ancestor.behind,
|
|
3071
|
-
repository: element,
|
|
3072
|
-
type: 'historyItemGroup'
|
|
3073
|
-
} : undefined;
|
|
3074
|
-
outgoingHistoryItemGroup = {
|
|
3075
|
-
id: currentHistoryItemGroup.id,
|
|
3076
|
-
label: currentHistoryItemGroup.label,
|
|
3077
|
-
ariaLabel: ( localizeWithPath(
|
|
3078
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
3079
|
-
'outgoingChangesAriaLabel',
|
|
3080
|
-
"Outgoing changes to {0}",
|
|
3081
|
-
currentHistoryItemGroup.label
|
|
3082
|
-
)),
|
|
3083
|
-
icon: Codicon.arrowCircleUp,
|
|
3084
|
-
direction: 'outgoing',
|
|
3085
|
-
ancestor: ancestor.id,
|
|
3086
|
-
count: ancestor.ahead,
|
|
3087
|
-
repository: element,
|
|
3088
|
-
type: 'historyItemGroup'
|
|
3089
|
-
};
|
|
3090
|
-
this.historyProviderCache.set(element, {
|
|
3091
|
-
...historyProviderCacheEntry,
|
|
3092
|
-
incomingHistoryItemGroup,
|
|
3093
|
-
outgoingHistoryItemGroup
|
|
3094
|
-
});
|
|
3095
|
-
}
|
|
3096
|
-
if (incomingHistoryItemGroup &&
|
|
3097
|
-
(showIncomingChanges === 'always' ||
|
|
3098
|
-
(showIncomingChanges === 'auto' && (incomingHistoryItemGroup.count ?? 0) > 0))) {
|
|
3099
|
-
children.push(incomingHistoryItemGroup);
|
|
3100
|
-
}
|
|
3101
|
-
if (outgoingHistoryItemGroup &&
|
|
3102
|
-
(showOutgoingChanges === 'always' ||
|
|
3103
|
-
(showOutgoingChanges === 'auto' && (outgoingHistoryItemGroup.count ?? 0) > 0))) {
|
|
3104
|
-
children.push(outgoingHistoryItemGroup);
|
|
3105
|
-
}
|
|
3106
|
-
return children;
|
|
3107
|
-
}
|
|
3108
|
-
async getHistoryItems(element) {
|
|
3109
|
-
const repository = element.repository;
|
|
3110
|
-
const historyProvider = repository.provider.historyProvider;
|
|
3111
|
-
if (!historyProvider) {
|
|
3112
|
-
return [];
|
|
3113
|
-
}
|
|
3114
|
-
const historyProviderCacheEntry = this.getHistoryProviderCacheEntry(repository);
|
|
3115
|
-
const historyItemsMap = historyProviderCacheEntry.historyItems;
|
|
3116
|
-
let historyItemsElement = historyProviderCacheEntry.historyItems.get(element.id);
|
|
3117
|
-
if (!historyItemsElement) {
|
|
3118
|
-
const historyItems = (await historyProvider.provideHistoryItems(element.id, { limit: { id: element.ancestor } })) ?? [];
|
|
3119
|
-
const { showChangesSummary } = this.getConfiguration();
|
|
3120
|
-
const allChanges = showChangesSummary && historyItems.length >= 2 ?
|
|
3121
|
-
await historyProvider.provideHistoryItemSummary(historyItems[0].id, element.ancestor) : undefined;
|
|
3122
|
-
historyItemsElement = [allChanges, historyItems];
|
|
3123
|
-
this.historyProviderCache.set(repository, {
|
|
3124
|
-
...historyProviderCacheEntry,
|
|
3125
|
-
historyItems: historyItemsMap.set(element.id, historyItemsElement)
|
|
3126
|
-
});
|
|
3127
|
-
}
|
|
3128
|
-
const children = [];
|
|
3129
|
-
if (historyItemsElement[0]) {
|
|
3130
|
-
children.push({
|
|
3131
|
-
...historyItemsElement[0],
|
|
3132
|
-
icon: historyItemsElement[0].icon ?? Codicon.files,
|
|
3133
|
-
label: ( localizeWithPath(
|
|
3134
|
-
'vs/workbench/contrib/scm/browser/scmViewPane',
|
|
3135
|
-
'allChanges',
|
|
3136
|
-
"All Changes"
|
|
3137
|
-
)),
|
|
3138
|
-
historyItemGroup: element,
|
|
3139
|
-
type: 'allChanges'
|
|
3140
|
-
});
|
|
3141
|
-
}
|
|
3142
|
-
children.push(...( historyItemsElement[1]
|
|
3143
|
-
.map(historyItem => ({
|
|
3144
|
-
...historyItem,
|
|
3145
|
-
historyItemGroup: element,
|
|
3146
|
-
type: 'historyItem'
|
|
3147
|
-
}))));
|
|
3148
|
-
return children;
|
|
3149
|
-
}
|
|
3150
|
-
async getHistoryItemChanges(element) {
|
|
3151
|
-
const repository = element.historyItemGroup.repository;
|
|
3152
|
-
const historyProvider = repository.provider.historyProvider;
|
|
3153
|
-
if (!historyProvider) {
|
|
3154
|
-
return [];
|
|
3155
|
-
}
|
|
3156
|
-
const historyProviderCacheEntry = this.getHistoryProviderCacheEntry(repository);
|
|
3157
|
-
const historyItemChangesMap = historyProviderCacheEntry.historyItemChanges;
|
|
3158
|
-
const historyItemParentId = element.parentIds.length > 0 ? element.parentIds[0] : undefined;
|
|
3159
|
-
let historyItemChanges = historyItemChangesMap.get(`${element.id}/${historyItemParentId}`);
|
|
3160
|
-
if (!historyItemChanges) {
|
|
3161
|
-
const historyItemParentId = element.parentIds.length > 0 ? element.parentIds[0] : undefined;
|
|
3162
|
-
historyItemChanges = (await historyProvider.provideHistoryItemChanges(element.id, historyItemParentId)) ?? [];
|
|
3163
|
-
this.historyProviderCache.set(repository, {
|
|
3164
|
-
...historyProviderCacheEntry,
|
|
3165
|
-
historyItemChanges: historyItemChangesMap.set(`${element.id}/${historyItemParentId}`, historyItemChanges)
|
|
3166
|
-
});
|
|
3167
|
-
}
|
|
3168
|
-
if (this.viewMode() === "list" ) {
|
|
3169
|
-
return ( historyItemChanges.map(change => ({
|
|
3170
|
-
...change,
|
|
3171
|
-
historyItem: element,
|
|
3172
|
-
type: 'historyItemChange'
|
|
3173
|
-
})));
|
|
3174
|
-
}
|
|
3175
|
-
const tree = ( new ResourceTree(
|
|
3176
|
-
element,
|
|
3177
|
-
repository.provider.rootUri ?? URI.file('/'),
|
|
3178
|
-
this.uriIdentityService.extUri
|
|
3179
|
-
));
|
|
3180
|
-
for (const change of historyItemChanges) {
|
|
3181
|
-
tree.add(change.uri, {
|
|
3182
|
-
...change,
|
|
3183
|
-
historyItem: element,
|
|
3184
|
-
type: 'historyItemChange'
|
|
3185
|
-
});
|
|
3186
|
-
}
|
|
3187
|
-
const children = [];
|
|
3188
|
-
for (const node of tree.root.children) {
|
|
3189
|
-
children.push(node.element ?? node);
|
|
3190
|
-
}
|
|
3191
|
-
return children;
|
|
3192
|
-
}
|
|
3193
|
-
getParent(element) {
|
|
3194
|
-
if (isSCMResourceNode(element)) {
|
|
3195
|
-
if (element.parent === element.context.resourceTree.root) {
|
|
3196
|
-
return element.context;
|
|
3197
|
-
}
|
|
3198
|
-
else if (element.parent) {
|
|
3199
|
-
return element.parent;
|
|
3200
|
-
}
|
|
3201
|
-
else {
|
|
3202
|
-
throw new Error('Invalid element passed to getParent');
|
|
3203
|
-
}
|
|
3204
|
-
}
|
|
3205
|
-
else if (isSCMResource(element)) {
|
|
3206
|
-
if (this.viewMode() === "list" ) {
|
|
3207
|
-
return element.resourceGroup;
|
|
3208
|
-
}
|
|
3209
|
-
const node = element.resourceGroup.resourceTree.getNode(element.sourceUri);
|
|
3210
|
-
const result = node?.parent;
|
|
3211
|
-
if (!result) {
|
|
3212
|
-
throw new Error('Invalid element passed to getParent');
|
|
3213
|
-
}
|
|
3214
|
-
if (result === element.resourceGroup.resourceTree.root) {
|
|
3215
|
-
return element.resourceGroup;
|
|
3216
|
-
}
|
|
3217
|
-
return result;
|
|
3218
|
-
}
|
|
3219
|
-
else {
|
|
3220
|
-
throw new Error('Unexpected call to getParent');
|
|
3221
|
-
}
|
|
3222
|
-
}
|
|
3223
|
-
getConfiguration() {
|
|
3224
|
-
return {
|
|
3225
|
-
alwaysShowRepositories: this.configurationService.getValue('scm.alwaysShowRepositories'),
|
|
3226
|
-
showActionButton: this.configurationService.getValue('scm.showActionButton'),
|
|
3227
|
-
showChangesSummary: this.configurationService.getValue('scm.showChangesSummary'),
|
|
3228
|
-
showIncomingChanges: this.configurationService.getValue('scm.showIncomingChanges'),
|
|
3229
|
-
showOutgoingChanges: this.configurationService.getValue('scm.showOutgoingChanges')
|
|
3230
|
-
};
|
|
3231
|
-
}
|
|
3232
|
-
onDidChangeVisibleRepositories({ added, removed }) {
|
|
3233
|
-
for (const repository of added) {
|
|
3234
|
-
const repositoryDisposables = ( new DisposableStore());
|
|
3235
|
-
repositoryDisposables.add(Event.runAndSubscribe(repository.provider.onDidChangeHistoryProvider, () => {
|
|
3236
|
-
if (!repository.provider.historyProvider) {
|
|
3237
|
-
this.logService.debug('SCMTreeDataSource:onDidChangeVisibleRepositories - no history provider present');
|
|
3238
|
-
return;
|
|
3239
|
-
}
|
|
3240
|
-
repositoryDisposables.add(repository.provider.historyProvider.onDidChangeCurrentHistoryItemGroup(() => {
|
|
3241
|
-
this.historyProviderCache.delete(repository);
|
|
3242
|
-
this.logService.debug('SCMTreeDataSource:onDidChangeCurrentHistoryItemGroup - cache cleared');
|
|
3243
|
-
}));
|
|
3244
|
-
this.logService.debug('SCMTreeDataSource:onDidChangeVisibleRepositories - onDidChangeCurrentHistoryItemGroup listener added');
|
|
3245
|
-
}));
|
|
3246
|
-
this.repositoryDisposables.set(repository, repositoryDisposables);
|
|
3247
|
-
}
|
|
3248
|
-
for (const repository of removed) {
|
|
3249
|
-
this.repositoryDisposables.deleteAndDispose(repository);
|
|
3250
|
-
this.historyProviderCache.delete(repository);
|
|
3251
|
-
}
|
|
3252
|
-
}
|
|
3253
|
-
getHistoryProviderCacheEntry(repository) {
|
|
3254
|
-
return this.historyProviderCache.get(repository) ?? {
|
|
3255
|
-
incomingHistoryItemGroup: undefined,
|
|
3256
|
-
outgoingHistoryItemGroup: undefined,
|
|
3257
|
-
historyItems: ( new Map()),
|
|
3258
|
-
historyItemChanges: ( new Map())
|
|
3259
|
-
};
|
|
3260
|
-
}
|
|
3261
|
-
dispose() {
|
|
3262
|
-
this.repositoryDisposables.dispose();
|
|
3263
|
-
this.disposables.dispose();
|
|
3264
|
-
}
|
|
3265
|
-
};
|
|
3266
|
-
SCMTreeDataSource = ( __decorate([
|
|
3267
|
-
( __param(1, IConfigurationService)),
|
|
3268
|
-
( __param(2, ILogService)),
|
|
3269
|
-
( __param(3, ISCMViewService)),
|
|
3270
|
-
( __param(4, IUriIdentityService))
|
|
3271
|
-
], SCMTreeDataSource));
|
|
3272
|
-
class SCMActionButton {
|
|
3273
|
-
constructor(container, contextMenuService, commandService, notificationService) {
|
|
3274
|
-
this.container = container;
|
|
3275
|
-
this.contextMenuService = contextMenuService;
|
|
3276
|
-
this.commandService = commandService;
|
|
3277
|
-
this.notificationService = notificationService;
|
|
3278
|
-
this.disposables = ( new MutableDisposable());
|
|
3279
|
-
}
|
|
3280
|
-
dispose() {
|
|
3281
|
-
this.disposables?.dispose();
|
|
3282
|
-
}
|
|
3283
|
-
setButton(button) {
|
|
3284
|
-
this.clear();
|
|
3285
|
-
if (!button) {
|
|
3286
|
-
return;
|
|
3287
|
-
}
|
|
3288
|
-
if (button.secondaryCommands?.length) {
|
|
3289
|
-
const actions = [];
|
|
3290
|
-
for (let index = 0; index < button.secondaryCommands.length; index++) {
|
|
3291
|
-
const commands = button.secondaryCommands[index];
|
|
3292
|
-
for (const command of commands) {
|
|
3293
|
-
actions.push(( new Action(
|
|
3294
|
-
command.id,
|
|
3295
|
-
command.title,
|
|
3296
|
-
undefined,
|
|
3297
|
-
true,
|
|
3298
|
-
async () => await this.executeCommand(command.id, ...(command.arguments || []))
|
|
3299
|
-
)));
|
|
3300
|
-
}
|
|
3301
|
-
if (commands.length) {
|
|
3302
|
-
actions.push(( new Separator()));
|
|
3303
|
-
}
|
|
3304
|
-
}
|
|
3305
|
-
actions.pop();
|
|
3306
|
-
this.button = ( new ButtonWithDropdown(this.container, {
|
|
3307
|
-
actions: actions,
|
|
3308
|
-
addPrimaryActionToDropdown: false,
|
|
3309
|
-
contextMenuProvider: this.contextMenuService,
|
|
3310
|
-
title: button.command.tooltip,
|
|
3311
|
-
supportIcons: true,
|
|
3312
|
-
...defaultButtonStyles
|
|
3313
|
-
}));
|
|
3314
|
-
}
|
|
3315
|
-
else {
|
|
3316
|
-
this.button = ( new Button(
|
|
3317
|
-
this.container,
|
|
3318
|
-
{ supportIcons: true, supportShortLabel: !!button.description, title: button.command.tooltip, ...defaultButtonStyles }
|
|
3319
|
-
));
|
|
3320
|
-
}
|
|
3321
|
-
this.button.enabled = button.enabled;
|
|
3322
|
-
this.button.label = button.command.title;
|
|
3323
|
-
if (this.button instanceof Button && button.description) {
|
|
3324
|
-
this.button.labelShort = button.description;
|
|
3325
|
-
}
|
|
3326
|
-
this.button.onDidClick(async () => await this.executeCommand(button.command.id, ...(button.command.arguments || [])), null, this.disposables.value);
|
|
3327
|
-
this.disposables.value.add(this.button);
|
|
3328
|
-
}
|
|
3329
|
-
focus() {
|
|
3330
|
-
this.button?.focus();
|
|
3331
|
-
}
|
|
3332
|
-
clear() {
|
|
3333
|
-
this.disposables.value = ( new DisposableStore());
|
|
3334
|
-
this.button = undefined;
|
|
3335
|
-
clearNode(this.container);
|
|
3336
|
-
}
|
|
3337
|
-
async executeCommand(commandId, ...args) {
|
|
3338
|
-
try {
|
|
3339
|
-
await this.commandService.executeCommand(commandId, ...args);
|
|
3340
|
-
}
|
|
3341
|
-
catch (ex) {
|
|
3342
|
-
this.notificationService.error(ex);
|
|
3343
|
-
}
|
|
3344
|
-
}
|
|
3345
|
-
}
|
|
3346
|
-
let ScmInputContentProvider = class ScmInputContentProvider extends Disposable {
|
|
3347
|
-
constructor(textModelService, _modelService, _languageService) {
|
|
3348
|
-
super();
|
|
3349
|
-
this._modelService = _modelService;
|
|
3350
|
-
this._languageService = _languageService;
|
|
3351
|
-
this._register(textModelService.registerTextModelContentProvider(Schemas.vscodeSourceControl, this));
|
|
3352
|
-
}
|
|
3353
|
-
async provideTextContent(resource) {
|
|
3354
|
-
const existing = this._modelService.getModel(resource);
|
|
3355
|
-
if (existing) {
|
|
3356
|
-
return existing;
|
|
3357
|
-
}
|
|
3358
|
-
return this._modelService.createModel('', this._languageService.createById('scminput'), resource);
|
|
3359
|
-
}
|
|
3360
|
-
};
|
|
3361
|
-
ScmInputContentProvider = ( __decorate([
|
|
3362
|
-
( __param(0, ITextModelService)),
|
|
3363
|
-
( __param(1, IModelService)),
|
|
3364
|
-
( __param(2, ILanguageService))
|
|
3365
|
-
], ScmInputContentProvider));
|
|
3366
|
-
|
|
3367
|
-
export { ActionButtonRenderer, SCMAccessibilityProvider, SCMActionButton, SCMTreeKeyboardNavigationLabelProvider, SCMTreeSorter, SCMViewPane };
|