@codingame/monaco-vscode-scm-service-override 2.0.3 → 2.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.
@@ -14,11 +14,11 @@ import { IContextMenuService, IContextViewService } from 'vscode/vscode/vs/platf
14
14
  import { RawContextKey, ContextKeyExpr, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
15
15
  import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
16
16
  import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
17
- import { MenuId, MenuRegistry, registerAction2, MenuItemAction, Action2, IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions';
17
+ import { MenuId, MenuRegistry, registerAction2, MenuItemAction, IMenuService, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
18
18
  import { Action, Separator, ActionRunner } from 'vscode/vscode/vs/base/common/actions';
19
19
  import { ActionBar } from 'vscode/vscode/vs/base/browser/ui/actionbar/actionbar';
20
20
  import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
21
- import { connectPrimaryMenuToInlineActionBar, getActionViewItemProvider, isSCMRepository, isSCMResourceGroup, isSCMResourceNode, isSCMHistoryItemChangeNode, isSCMInput, isSCMActionButton, isSCMResource, isSCMHistoryItemGroupTreeElement, isSCMHistoryItemTreeElement, isSCMHistoryItemChangeTreeElement, toDiffEditorArguments, collectContextMenuActions, isSCMViewService, isSCMViewSeparator } from './util.js';
21
+ import { connectPrimaryMenuToInlineActionBar, connectPrimaryMenu, getActionViewItemProvider, isSCMRepository, isSCMResourceGroup, isSCMResourceNode, isSCMHistoryItemChangeNode, isSCMInput, isSCMActionButton, isSCMResource, isSCMHistoryItemGroupTreeElement, isSCMHistoryItemTreeElement, isSCMHistoryItemChangeTreeElement, toDiffEditorArguments, collectContextMenuActions, isSCMViewService, isSCMViewSeparator } from './util.js';
22
22
  import { WorkbenchCompressibleAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
23
23
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
24
24
  import { disposableTimeout, ThrottledDelayer, Sequencer, Throttler } from 'vscode/vscode/vs/base/common/async';
@@ -46,7 +46,7 @@ import { format, compare } from 'vscode/vscode/vs/base/common/strings';
46
46
  import { SuggestController } from 'vscode/vscode/vs/editor/contrib/suggest/browser/suggestController';
47
47
  import { SnippetController2 } from 'vscode/vscode/vs/editor/contrib/snippet/browser/snippetController2';
48
48
  import { ServiceCollection } from 'vscode/vscode/vs/platform/instantiation/common/serviceCollection';
49
- import { ModesHoverController } from 'vscode/vscode/vs/editor/contrib/hover/browser/hover';
49
+ import { HoverController } from 'vscode/vscode/vs/editor/contrib/hover/browser/hover';
50
50
  import { ColorDetector } from 'vscode/vscode/vs/editor/contrib/colorPicker/browser/colorDetector';
51
51
  import { LinkDetector } from 'vscode/vscode/vs/editor/contrib/links/browser/links';
52
52
  import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
@@ -56,11 +56,11 @@ import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
56
56
  import { DEFAULT_FONT_FAMILY } from 'vscode/vscode/vs/workbench/browser/style';
57
57
  import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
58
58
  import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
59
- import { RepositoryRenderer } from './scmRepositoryRenderer.js';
59
+ import { RepositoryRenderer, RepositoryActionRunner } from './scmRepositoryRenderer.js';
60
60
  import { ColorScheme } from 'vscode/vscode/vs/platform/theme/common/theme';
61
61
  import { API_OPEN_EDITOR_COMMAND_ID, API_OPEN_DIFF_EDITOR_COMMAND_ID } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorCommands';
62
62
  import { createActionViewItem, createAndFillInContextMenuActions, createAndFillInActionBarActions } from 'vscode/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
63
- import { MarkdownRenderer, openLinkFromMarkdown } from 'vscode/vscode/vs/editor/contrib/markdownRenderer/browser/markdownRenderer';
63
+ import { MarkdownRenderer, openLinkFromMarkdown } from 'vscode/vscode/vs/editor/browser/widget/markdownRenderer/browser/markdownRenderer';
64
64
  import { ButtonWithDropdown, Button } from 'vscode/vscode/vs/base/browser/ui/button/button';
65
65
  import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
66
66
  import { RepositoryContextKeys } from './scmViewService.js';
@@ -75,6 +75,7 @@ import { Schemas } from 'vscode/vscode/vs/base/common/network';
75
75
  import { fillEditorsDragData } from 'vscode/vscode/vs/workbench/browser/dnd';
76
76
  import { CodeDataTransfers } from 'vscode/vscode/vs/platform/dnd/browser/dnd';
77
77
  import { FormatOnType } from 'vscode/vscode/vs/editor/contrib/format/browser/formatActions';
78
+ import { EditorOptions } from 'vscode/vscode/vs/editor/common/config/editorOptions';
78
79
  import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
79
80
  import { EditOperation } from 'vscode/vscode/vs/editor/common/core/editOperation';
80
81
  import { stripIcons } from 'vscode/vscode/vs/base/common/iconLabels';
@@ -85,7 +86,7 @@ import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellati
85
86
  import { DropdownWithPrimaryActionViewItem } from 'vscode/vscode/vs/platform/actions/browser/dropdownWithPrimaryActionViewItem';
86
87
  import { clamp } from 'vscode/vscode/vs/base/common/numbers';
87
88
 
88
- var ActionButtonRenderer_1, InputRenderer_1, ResourceGroupRenderer_1, ResourceRenderer_1, HistoryItemRenderer_1, HistoryItemChangeRenderer_1, SCMInputWidget_1;
89
+ var ActionButtonRenderer_1, InputRenderer_1, ResourceGroupRenderer_1, ResourceRenderer_1, HistoryItemGroupRenderer_1, HistoryItemRenderer_1, HistoryItemChangeRenderer_1, SCMInputWidget_1;
89
90
  registerColor('scm.historyItemAdditionsForeground', {
90
91
  dark: 'gitDecoration.addedResourceForeground',
91
92
  light: 'gitDecoration.addedResourceForeground',
@@ -221,10 +222,10 @@ class SCMTreeDragAndDrop {
221
222
  }
222
223
  return String(elements.length);
223
224
  }
224
- onDragOver(data, targetElement, targetIndex, originalEvent) {
225
+ onDragOver(data, targetElement, targetIndex, targetSector, originalEvent) {
225
226
  return true;
226
227
  }
227
- drop(data, targetElement, targetIndex, originalEvent) { }
228
+ drop(data, targetElement, targetIndex, targetSector, originalEvent) { }
228
229
  static getResourcesFromDragAndDropData(data) {
229
230
  const uris = [];
230
231
  for (const element of [...(data.context ?? []), ...data.elements]) {
@@ -302,8 +303,7 @@ let InputRenderer = class InputRenderer {
302
303
  templateData.elementDisposables.add(templateData.inputWidget.onDidChangeContentHeight(onDidChangeContentHeight));
303
304
  onDidChangeContentHeight();
304
305
  };
305
- const timeout = disposableTimeout(startListeningContentHeightChange, 0);
306
- templateData.elementDisposables.add(timeout);
306
+ disposableTimeout(startListeningContentHeightChange, 0, templateData.elementDisposables);
307
307
  const layoutEditor = () => templateData.inputWidget.layout();
308
308
  templateData.elementDisposables.add(this.outerLayout.onDidChange(layoutEditor));
309
309
  layoutEditor();
@@ -595,17 +595,46 @@ ResourceRenderer = ResourceRenderer_1 = ( __decorate([
595
595
  ( __param(5, ISCMViewService)),
596
596
  ( __param(6, IThemeService))
597
597
  ], ResourceRenderer));
598
- class HistoryItemGroupRenderer {
598
+ class HistoryItemGroupActionRunner extends ActionRunner {
599
+ runAction(action, context) {
600
+ if (!(action instanceof MenuItemAction)) {
601
+ return super.runAction(action, context);
602
+ }
603
+ return action.run(context.repository.provider, context.id);
604
+ }
605
+ }
606
+ let HistoryItemGroupRenderer = class HistoryItemGroupRenderer {
607
+ static { HistoryItemGroupRenderer_1 = this; }
599
608
  static { this.TEMPLATE_ID = 'history-item-group'; }
600
- get templateId() { return HistoryItemGroupRenderer.TEMPLATE_ID; }
609
+ get templateId() { return HistoryItemGroupRenderer_1.TEMPLATE_ID; }
610
+ constructor(actionRunner, contextKeyService, contextMenuService, keybindingService, menuService, scmViewService, telemetryService) {
611
+ this.actionRunner = actionRunner;
612
+ this.contextKeyService = contextKeyService;
613
+ this.contextMenuService = contextMenuService;
614
+ this.keybindingService = keybindingService;
615
+ this.menuService = menuService;
616
+ this.scmViewService = scmViewService;
617
+ this.telemetryService = telemetryService;
618
+ }
601
619
  renderTemplate(container) {
602
620
  container.parentElement.parentElement.querySelector('.monaco-tl-twistie').classList.add('force-twistie');
603
621
  const element = append(container, $('.history-item-group'));
604
622
  const label = ( new IconLabel(element, { supportIcons: true }));
605
623
  const iconContainer = prepend(label.element, $('.icon-container'));
624
+ const templateDisposables = ( new DisposableStore());
625
+ const toolBar = ( new WorkbenchToolBar(
626
+ append(element, $('.actions')),
627
+ { actionRunner: this.actionRunner, menuOptions: { shouldForwardArgs: true } },
628
+ this.menuService,
629
+ this.contextKeyService,
630
+ this.contextMenuService,
631
+ this.keybindingService,
632
+ this.telemetryService
633
+ ));
634
+ templateDisposables.add(toolBar);
606
635
  const countContainer = append(element, $('.count'));
607
636
  const count = ( new CountBadge(countContainer, {}, defaultCountBadgeStyles));
608
- return { iconContainer, label, count, disposables: ( new DisposableStore()) };
637
+ return { iconContainer, label, toolBar, count, elementDisposables: ( new DisposableStore()), templateDisposables };
609
638
  }
610
639
  renderElement(node, index, templateData, height) {
611
640
  const historyItemGroup = node.element;
@@ -615,19 +644,65 @@ class HistoryItemGroupRenderer {
615
644
  }
616
645
  templateData.label.setLabel(historyItemGroup.label, historyItemGroup.description, { title: historyItemGroup.ariaLabel });
617
646
  templateData.count.setCount(historyItemGroup.count ?? 0);
647
+ const repositoryMenus = this.scmViewService.menus.getRepositoryMenus(historyItemGroup.repository.provider);
648
+ const historyProviderMenu = repositoryMenus.historyProviderMenu;
649
+ if (historyProviderMenu) {
650
+ const menuId = historyItemGroup.direction === 'incoming' ? MenuId.SCMIncomingChanges : MenuId.SCMOutgoingChanges;
651
+ const menu = historyItemGroup.direction === 'incoming' ? historyProviderMenu.incomingHistoryItemGroupMenu : historyProviderMenu.outgoingHistoryItemGroupMenu;
652
+ templateData.elementDisposables.add(connectPrimaryMenu(menu, (primary, secondary) => {
653
+ templateData.toolBar.setActions(primary, secondary, [menuId]);
654
+ }));
655
+ templateData.toolBar.context = historyItemGroup;
656
+ }
657
+ else {
658
+ templateData.toolBar.setActions([], []);
659
+ templateData.toolBar.context = undefined;
660
+ }
618
661
  }
619
662
  renderCompressedElements(node, index, templateData, height) {
620
663
  throw new Error('Should never happen since node is incompressible');
621
664
  }
665
+ disposeElement(node, index, templateData, height) {
666
+ templateData.elementDisposables.clear();
667
+ }
622
668
  disposeTemplate(templateData) {
623
- templateData.disposables.dispose();
669
+ templateData.elementDisposables.dispose();
670
+ templateData.templateDisposables.dispose();
671
+ }
672
+ };
673
+ HistoryItemGroupRenderer = HistoryItemGroupRenderer_1 = ( __decorate([
674
+ ( __param(1, IContextKeyService)),
675
+ ( __param(2, IContextMenuService)),
676
+ ( __param(3, IKeybindingService)),
677
+ ( __param(4, IMenuService)),
678
+ ( __param(5, ISCMViewService)),
679
+ ( __param(6, ITelemetryService))
680
+ ], HistoryItemGroupRenderer));
681
+ class HistoryItemActionRunner extends ActionRunner {
682
+ async runAction(action, context) {
683
+ if (!(action instanceof MenuItemAction)) {
684
+ return super.runAction(action, context);
685
+ }
686
+ const args = [];
687
+ args.push(context.historyItemGroup.repository.provider);
688
+ args.push({
689
+ id: context.id,
690
+ parentIds: context.parentIds,
691
+ label: context.label,
692
+ description: context.description,
693
+ icon: context.icon,
694
+ timestamp: context.timestamp,
695
+ statistics: context.statistics,
696
+ });
697
+ await action.run(...args);
624
698
  }
625
699
  }
626
700
  let HistoryItemRenderer = class HistoryItemRenderer {
627
701
  static { HistoryItemRenderer_1 = this; }
628
702
  static { this.TEMPLATE_ID = 'history-item'; }
629
703
  get templateId() { return HistoryItemRenderer_1.TEMPLATE_ID; }
630
- constructor(actionViewItemProvider, scmViewService) {
704
+ constructor(actionRunner, actionViewItemProvider, scmViewService) {
705
+ this.actionRunner = actionRunner;
631
706
  this.actionViewItemProvider = actionViewItemProvider;
632
707
  this.scmViewService = scmViewService;
633
708
  }
@@ -638,7 +713,10 @@ let HistoryItemRenderer = class HistoryItemRenderer {
638
713
  const iconContainer = prepend(iconLabel.element, $('.icon-container'));
639
714
  const disposables = ( new DisposableStore());
640
715
  const actionsContainer = append(element, $('.actions'));
641
- const actionBar = ( new ActionBar(actionsContainer, { actionViewItemProvider: this.actionViewItemProvider }));
716
+ const actionBar = ( new ActionBar(
717
+ actionsContainer,
718
+ { actionRunner: this.actionRunner, actionViewItemProvider: this.actionViewItemProvider }
719
+ ));
642
720
  disposables.add(actionBar);
643
721
  const statsContainer = append(element, $('.stats-container'));
644
722
  const filesLabel = append(statsContainer, $('.files-label'));
@@ -657,7 +735,8 @@ let HistoryItemRenderer = class HistoryItemRenderer {
657
735
  templateData.actionBar.context = historyItem;
658
736
  const menus = this.scmViewService.menus.getRepositoryMenus(historyItem.historyItemGroup.repository.provider);
659
737
  if (menus.historyProviderMenu) {
660
- templateData.elementDisposables.add(connectPrimaryMenuToInlineActionBar(menus.historyProviderMenu.getHistoryItemMenu(historyItem), templateData.actionBar));
738
+ const historyItemMenu = menus.historyProviderMenu.getHistoryItemMenu(historyItem);
739
+ templateData.elementDisposables.add(connectPrimaryMenuToInlineActionBar(historyItemMenu, templateData.actionBar));
661
740
  }
662
741
  this.renderStatistics(node, index, templateData, height);
663
742
  }
@@ -730,7 +809,7 @@ let HistoryItemRenderer = class HistoryItemRenderer {
730
809
  }
731
810
  };
732
811
  HistoryItemRenderer = HistoryItemRenderer_1 = ( __decorate([
733
- ( __param(1, ISCMViewService))
812
+ ( __param(2, ISCMViewService))
734
813
  ], HistoryItemRenderer));
735
814
  let HistoryItemChangeRenderer = class HistoryItemChangeRenderer {
736
815
  static { HistoryItemChangeRenderer_1 = this; }
@@ -851,15 +930,9 @@ class SCMTreeCompressionDelegate {
851
930
  }
852
931
  class SCMTreeFilter {
853
932
  filter(element) {
854
- if (ResourceTree.isResourceNode(element)) {
855
- return true;
856
- }
857
- else if (isSCMResourceGroup(element)) {
933
+ if (isSCMResourceGroup(element)) {
858
934
  return element.resources.length > 0 || !element.hideWhenEmpty;
859
935
  }
860
- else if (isSCMViewSeparator(element)) {
861
- return true;
862
- }
863
936
  else {
864
937
  return true;
865
938
  }
@@ -889,23 +962,14 @@ class SCMTreeSorter {
889
962
  else if (isSCMActionButton(other)) {
890
963
  return 1;
891
964
  }
892
- if (isSCMViewSeparator(one)) {
893
- if (!isSCMHistoryItemGroupTreeElement(other) && !isSCMResourceGroup(other)) {
894
- throw new Error('Invalid comparison');
895
- }
896
- return 0;
897
- }
898
965
  if (isSCMResourceGroup(one)) {
899
- if (!isSCMResourceGroup(other)) {
900
- throw new Error('Invalid comparison');
901
- }
902
- return 0;
966
+ return isSCMResourceGroup(other) ? 0 : -1;
967
+ }
968
+ if (isSCMViewSeparator(one)) {
969
+ return isSCMResourceGroup(other) ? 1 : -1;
903
970
  }
904
971
  if (isSCMHistoryItemGroupTreeElement(one)) {
905
- if (!isSCMHistoryItemGroupTreeElement(other) && !isSCMResourceGroup(other) && !isSCMViewSeparator(other)) {
906
- throw new Error('Invalid comparison');
907
- }
908
- return 0;
972
+ return isSCMHistoryItemGroupTreeElement(other) ? 0 : 1;
909
973
  }
910
974
  if (isSCMHistoryItemTreeElement(one)) {
911
975
  if (!isSCMHistoryItemTreeElement(other)) {
@@ -1029,7 +1093,7 @@ function getSCMResourceId(element) {
1029
1093
  else if (isSCMHistoryItemTreeElement(element)) {
1030
1094
  const historyItemGroup = element.historyItemGroup;
1031
1095
  const provider = historyItemGroup.repository.provider;
1032
- return `historyItem:${provider.id}/${historyItemGroup.id}/${element.id}`;
1096
+ return `historyItem:${provider.id}/${historyItemGroup.id}/${element.id}/${element.parentIds.join(',')}`;
1033
1097
  }
1034
1098
  else if (isSCMHistoryItemChangeTreeElement(element)) {
1035
1099
  const historyItem = element.historyItem;
@@ -1240,9 +1304,9 @@ RepositoryVisibilityActionController = ( __decorate([
1240
1304
  ( __param(2, ISCMService))
1241
1305
  ], RepositoryVisibilityActionController));
1242
1306
  class SetListViewModeAction extends ViewAction {
1243
- constructor(menu = {}) {
1307
+ constructor(id = 'workbench.scm.action.setListViewMode', menu = {}) {
1244
1308
  super({
1245
- id: 'workbench.scm.action.setListViewMode',
1309
+ id,
1246
1310
  title: ( localizeWithPath(
1247
1311
  'vs/workbench/contrib/scm/browser/scmViewPane',
1248
1312
  'setListViewMode',
@@ -1261,7 +1325,7 @@ class SetListViewModeAction extends ViewAction {
1261
1325
  }
1262
1326
  class SetListViewModeNavigationAction extends SetListViewModeAction {
1263
1327
  constructor() {
1264
- super({
1328
+ super('workbench.scm.action.setListViewModeNavigation', {
1265
1329
  id: MenuId.SCMTitle,
1266
1330
  when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', VIEW_PANE_ID)), ( ContextKeys.RepositoryCount.notEqualsTo(0)), ( ContextKeys.SCMViewMode.isEqualTo("tree" )))),
1267
1331
  group: 'navigation',
@@ -1270,9 +1334,9 @@ class SetListViewModeNavigationAction extends SetListViewModeAction {
1270
1334
  }
1271
1335
  }
1272
1336
  class SetTreeViewModeAction extends ViewAction {
1273
- constructor(menu = {}) {
1337
+ constructor(id = 'workbench.scm.action.setTreeViewMode', menu = {}) {
1274
1338
  super({
1275
- id: 'workbench.scm.action.setTreeViewMode',
1339
+ id,
1276
1340
  title: ( localizeWithPath(
1277
1341
  'vs/workbench/contrib/scm/browser/scmViewPane',
1278
1342
  'setTreeViewMode',
@@ -1291,7 +1355,7 @@ class SetTreeViewModeAction extends ViewAction {
1291
1355
  }
1292
1356
  class SetTreeViewModeNavigationAction extends SetTreeViewModeAction {
1293
1357
  constructor() {
1294
- super({
1358
+ super('workbench.scm.action.setTreeViewModeNavigation', {
1295
1359
  id: MenuId.SCMTitle,
1296
1360
  when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', VIEW_PANE_ID)), ( ContextKeys.RepositoryCount.notEqualsTo(0)), ( ContextKeys.SCMViewMode.isEqualTo("list" )))),
1297
1361
  group: 'navigation',
@@ -1454,74 +1518,22 @@ class ExpandAllRepositoriesAction extends ViewAction {
1454
1518
  }
1455
1519
  registerAction2(CollapseAllRepositoriesAction);
1456
1520
  registerAction2(ExpandAllRepositoriesAction);
1457
- class HistoryItemViewChangesAction extends Action2 {
1458
- constructor() {
1459
- super({
1460
- id: `workbench.scm.action.historyItemViewChanges`,
1461
- title: ( localizeWithPath(
1462
- 'vs/workbench/contrib/scm/browser/scmViewPane',
1463
- 'historyItemViewChanges',
1464
- "View Changes"
1465
- )),
1466
- icon: Codicon.diffMultiple,
1467
- f1: false,
1468
- menu: {
1469
- id: MenuId.SCMHistoryItem,
1470
- group: 'inline',
1471
- when: ( ContextKeyExpr.has('config.multiDiffEditor.experimental.enabled')),
1472
- }
1473
- });
1474
- }
1475
- async run(accessor, historyItem) {
1476
- const commandService = accessor.get(ICommandService);
1477
- const historyProvider = historyItem.historyItemGroup.repository.provider.historyProvider;
1478
- if (!historyProvider) {
1479
- return;
1480
- }
1481
- const historyItemChanges = await historyProvider.provideHistoryItemChanges(historyItem.id);
1482
- if (!historyItemChanges || historyItemChanges.length === 0) {
1483
- return;
1484
- }
1485
- let [originalRef, modifiedRef] = historyItem.id.includes('..')
1486
- ? ( historyItem.id.split('..').map(id => id.substring(0, 8))) : [undefined, historyItem.id.substring(0, 8)];
1487
- if (!originalRef) {
1488
- originalRef = historyItem.parentIds.length > 0 ? historyItem.parentIds[0].substring(0, 8) : `${modifiedRef}^`;
1489
- }
1490
- const title = ( localizeWithPath(
1491
- 'vs/workbench/contrib/scm/browser/scmViewPane',
1492
- 'historyItemChangesTitle',
1493
- "Changes ({0} ↔ {1})",
1494
- originalRef,
1495
- modifiedRef
1496
- ));
1497
- const args = ( historyItemChanges.map(change => [change.uri, change.originalUri, change.modifiedUri]));
1498
- return commandService.executeCommand('_workbench.changes', title, args);
1499
- }
1500
- }
1501
- registerAction2(HistoryItemViewChangesAction);
1502
- const SCMInputContextKeys = {
1503
- ActionCount: ( new RawContextKey('scmInputActionCount', 0)),
1504
- ActionIsEnabled: ( new RawContextKey('scmInputActionIsEnabled', false)),
1505
- ActionIsRunning: ( new RawContextKey('scmInputActionIsRunning', false)),
1506
- };
1507
1521
  let SCMInputWidgetActionRunner = class SCMInputWidgetActionRunner extends ActionRunner {
1508
- constructor(input, contextKeyService, storageService) {
1522
+ get runningActions() { return this._runningActions; }
1523
+ constructor(input, storageService) {
1509
1524
  super();
1510
1525
  this.input = input;
1511
1526
  this.storageService = storageService;
1512
1527
  this._runningActions = ( new Set());
1513
- this._ctxIsActionRunning = SCMInputContextKeys.ActionIsRunning.bindTo(contextKeyService);
1514
1528
  }
1515
1529
  async runAction(action) {
1516
1530
  try {
1517
- if (this._ctxIsActionRunning.get() === true) {
1531
+ if (this.runningActions.size !== 0) {
1518
1532
  this._cts?.cancel();
1519
1533
  if (action.id === "scm.input.cancelAction" ) {
1520
1534
  return;
1521
1535
  }
1522
1536
  }
1523
- this._runningActions.add(action);
1524
- this._ctxIsActionRunning.set(true);
1525
1537
  const context = [];
1526
1538
  for (const group of this.input.repository.provider.groups) {
1527
1539
  context.push({
@@ -1529,34 +1541,39 @@ let SCMInputWidgetActionRunner = class SCMInputWidgetActionRunner extends Action
1529
1541
  resources: [...( group.resources.map(r => r.sourceUri))]
1530
1542
  });
1531
1543
  }
1544
+ this._runningActions.add(action);
1532
1545
  this._cts = ( new CancellationTokenSource());
1533
1546
  await action.run(...[this.input.repository.provider.rootUri, context, this._cts.token]);
1534
1547
  }
1535
1548
  finally {
1536
1549
  this._runningActions.delete(action);
1537
1550
  if (this._runningActions.size === 0) {
1538
- this.storageService.store('scm.input.lastActionId', action.id, 0 , 0 );
1539
- this._ctxIsActionRunning.set(false);
1551
+ this.storageService.store("scm.input.lastActionId" , action.id, 0 , 0 );
1540
1552
  }
1541
1553
  }
1542
1554
  }
1543
1555
  };
1544
1556
  SCMInputWidgetActionRunner = ( __decorate([
1545
- ( __param(1, IContextKeyService)),
1546
- ( __param(2, IStorageService))
1557
+ ( __param(1, IStorageService))
1547
1558
  ], SCMInputWidgetActionRunner));
1548
1559
  let SCMInputWidgetToolbar = class SCMInputWidgetToolbar extends WorkbenchToolBar {
1549
1560
  get dropdownActions() { return this._dropdownActions; }
1550
- constructor(container, input, menuId, options, menuService, contextKeyService, contextMenuService, commandService, keybindingService, storageService, telemetryService) {
1551
- super(container, { resetMenu: menuId, ...options }, menuService, contextKeyService, contextMenuService, keybindingService, telemetryService);
1561
+ get dropdownAction() { return this._dropdownAction; }
1562
+ constructor(container, options, menuService, contextKeyService, contextMenuService, commandService, keybindingService, storageService, telemetryService) {
1563
+ super(container, { resetMenu: MenuId.SCMInputBox, ...options }, menuService, contextKeyService, contextMenuService, keybindingService, telemetryService);
1564
+ this.menuService = menuService;
1565
+ this.contextKeyService = contextKeyService;
1566
+ this.storageService = storageService;
1552
1567
  this._dropdownActions = [];
1553
- const contextKeyServiceWithOverlay = contextKeyService.createOverlay([
1554
- ['scmProvider', input.repository.provider.contextValue],
1555
- ['scmProviderRootUri', input.repository.provider.rootUri?.toString()],
1556
- ['scmProviderHasRootUri', !!input.repository.provider.rootUri]
1557
- ]);
1558
- const menu = this._store.add(menuService.createMenu(menuId, contextKeyServiceWithOverlay, { emitEventsForSubmenuChanges: true }));
1559
- const cancelAction = ( new MenuItemAction({
1568
+ this._onDidChange = ( new Emitter());
1569
+ this.onDidChange = this._onDidChange.event;
1570
+ this.repositoryDisposables = ( new DisposableStore());
1571
+ this._dropdownAction = ( new Action('scmInputMoreActions', ( localizeWithPath(
1572
+ 'vs/workbench/contrib/scm/browser/scmViewPane',
1573
+ 'scmInputMoreActions',
1574
+ "More Actions..."
1575
+ )), 'codicon-chevron-down'));
1576
+ this._cancelAction = ( new MenuItemAction({
1560
1577
  id: "scm.input.cancelAction" ,
1561
1578
  title: ( localizeWithPath(
1562
1579
  'vs/workbench/contrib/scm/browser/scmViewPane',
@@ -1565,48 +1582,145 @@ let SCMInputWidgetToolbar = class SCMInputWidgetToolbar extends WorkbenchToolBar
1565
1582
  )),
1566
1583
  icon: Codicon.debugStop,
1567
1584
  }, undefined, undefined, undefined, contextKeyService, commandService));
1568
- this._ctxActionCount = SCMInputContextKeys.ActionCount.bindTo(contextKeyService);
1585
+ }
1586
+ setInput(input) {
1587
+ this.repositoryDisposables.clear();
1588
+ const contextKeyService = this.contextKeyService.createOverlay([
1589
+ ['scmProvider', input.repository.provider.contextValue],
1590
+ ['scmProviderRootUri', input.repository.provider.rootUri?.toString()],
1591
+ ['scmProviderHasRootUri', !!input.repository.provider.rootUri]
1592
+ ]);
1593
+ const menu = this.repositoryDisposables.add(this.menuService.createMenu(MenuId.SCMInputBox, contextKeyService, { emitEventsForSubmenuChanges: true }));
1594
+ const isEnabled = () => {
1595
+ return ( input.repository.provider.groups.some(g => g.resources.length > 0));
1596
+ };
1569
1597
  const updateToolbar = () => {
1570
1598
  const actions = [];
1571
- createAndFillInActionBarActions(menu, options?.menuOptions, actions);
1572
- let primaryAction = undefined;
1573
- if (contextKeyService.getContextKeyValue(SCMInputContextKeys.ActionIsRunning.key) === true) {
1574
- primaryAction = cancelAction;
1599
+ createAndFillInActionBarActions(menu, { shouldForwardArgs: true }, actions);
1600
+ for (const action of actions) {
1601
+ action.enabled = isEnabled();
1575
1602
  }
1576
- else if (actions.length === 1) {
1603
+ this._dropdownAction.enabled = isEnabled();
1604
+ let primaryAction = undefined;
1605
+ if (actions.length === 1) {
1577
1606
  primaryAction = actions[0];
1578
1607
  }
1579
1608
  else if (actions.length > 1) {
1580
- const lastActionId = storageService.get('scm.input.lastActionId', 0 , '');
1609
+ const lastActionId = this.storageService.get("scm.input.lastActionId" , 0 , '');
1581
1610
  primaryAction = actions.find(a => a.id === lastActionId) ?? actions[0];
1582
1611
  }
1583
- if (primaryAction &&
1584
- primaryAction.id !== "scm.input.cancelAction" &&
1585
- contextKeyService.getContextKeyValue(SCMInputContextKeys.ActionIsEnabled.key) === false) {
1586
- primaryAction.enabled = false;
1587
- }
1588
- this._ctxActionCount.set(actions.length);
1589
1612
  this._dropdownActions = actions.length === 1 ? [] : actions;
1590
- container.classList.toggle('has-no-actions', actions.length === 0);
1591
1613
  super.setActions(primaryAction ? [primaryAction] : [], []);
1614
+ this._onDidChange.fire();
1592
1615
  };
1593
- this._store.add(menu.onDidChange(() => updateToolbar()));
1594
- const ctxKeys = ( new Set(
1595
- [SCMInputContextKeys.ActionIsEnabled.key, SCMInputContextKeys.ActionIsRunning.key]
1596
- ));
1597
- this._store.add(Event.filter(contextKeyService.onDidChangeContext, e => e.affectsSome(ctxKeys))(() => updateToolbar()));
1598
- setTimeout(() => updateToolbar(), 0);
1616
+ this.repositoryDisposables.add(menu.onDidChange(() => updateToolbar()));
1617
+ this.repositoryDisposables.add(input.repository.provider.onDidChangeResources(() => updateToolbar()));
1618
+ this.repositoryDisposables.add(this.storageService.onDidChangeValue(0 , "scm.input.lastActionId" , this.repositoryDisposables)(() => updateToolbar()));
1619
+ this.actionRunner = ( new SCMInputWidgetActionRunner(input, this.storageService));
1620
+ this.repositoryDisposables.add(this.actionRunner.onWillRun(e => {
1621
+ if (this.actionRunner.runningActions.size === 0) {
1622
+ super.setActions([this._cancelAction], []);
1623
+ this._onDidChange.fire();
1624
+ }
1625
+ }));
1626
+ this.repositoryDisposables.add(this.actionRunner.onDidRun(e => {
1627
+ if (this.actionRunner.runningActions.size === 0) {
1628
+ updateToolbar();
1629
+ }
1630
+ }));
1631
+ updateToolbar();
1599
1632
  }
1600
1633
  };
1601
1634
  SCMInputWidgetToolbar = ( __decorate([
1602
- ( __param(4, IMenuService)),
1603
- ( __param(5, IContextKeyService)),
1604
- ( __param(6, IContextMenuService)),
1605
- ( __param(7, ICommandService)),
1606
- ( __param(8, IKeybindingService)),
1607
- ( __param(9, IStorageService)),
1608
- ( __param(10, ITelemetryService))
1635
+ ( __param(2, IMenuService)),
1636
+ ( __param(3, IContextKeyService)),
1637
+ ( __param(4, IContextMenuService)),
1638
+ ( __param(5, ICommandService)),
1639
+ ( __param(6, IKeybindingService)),
1640
+ ( __param(7, IStorageService)),
1641
+ ( __param(8, ITelemetryService))
1609
1642
  ], SCMInputWidgetToolbar));
1643
+ class SCMInputWidgetEditorOptions {
1644
+ constructor(overflowWidgetsDomNode, configurationService) {
1645
+ this.overflowWidgetsDomNode = overflowWidgetsDomNode;
1646
+ this.configurationService = configurationService;
1647
+ this._onDidChange = ( new Emitter());
1648
+ this.onDidChange = this._onDidChange.event;
1649
+ this.defaultInputFontFamily = DEFAULT_FONT_FAMILY;
1650
+ this._disposables = ( new DisposableStore());
1651
+ const onDidChangeConfiguration = Event.filter(this.configurationService.onDidChangeConfiguration, e => {
1652
+ return e.affectsConfiguration('editor.accessibilitySupport') ||
1653
+ e.affectsConfiguration('editor.cursorBlinking') ||
1654
+ e.affectsConfiguration('editor.fontFamily') ||
1655
+ e.affectsConfiguration('editor.rulers') ||
1656
+ e.affectsConfiguration('editor.wordWrap') ||
1657
+ e.affectsConfiguration('scm.inputFontFamily') ||
1658
+ e.affectsConfiguration('scm.inputFontSize');
1659
+ }, this._disposables);
1660
+ this._disposables.add(onDidChangeConfiguration(() => this._onDidChange.fire()));
1661
+ }
1662
+ getEditorConstructionOptions() {
1663
+ const fontFamily = this._getEditorFontFamily();
1664
+ const fontSize = this._getEditorFontSize();
1665
+ const lineHeight = this._getEditorLineHeight(fontSize);
1666
+ return {
1667
+ ...getSimpleEditorOptions(this.configurationService),
1668
+ ...this._getEditorLanguageConfiguration(),
1669
+ cursorWidth: 1,
1670
+ dragAndDrop: true,
1671
+ dropIntoEditor: { enabled: true },
1672
+ fontFamily: fontFamily,
1673
+ fontSize: fontSize,
1674
+ formatOnType: true,
1675
+ lineDecorationsWidth: 6,
1676
+ lineHeight: lineHeight,
1677
+ overflowWidgetsDomNode: this.overflowWidgetsDomNode,
1678
+ padding: { top: 2, bottom: 2 },
1679
+ quickSuggestions: false,
1680
+ renderWhitespace: 'none',
1681
+ scrollbar: {
1682
+ alwaysConsumeMouseWheel: false,
1683
+ vertical: 'hidden'
1684
+ },
1685
+ wrappingIndent: 'none',
1686
+ wrappingStrategy: 'advanced',
1687
+ };
1688
+ }
1689
+ getEditorOptions() {
1690
+ const fontFamily = this._getEditorFontFamily();
1691
+ const fontSize = this._getEditorFontSize();
1692
+ const lineHeight = this._getEditorLineHeight(fontSize);
1693
+ const accessibilitySupport = this.configurationService.getValue('editor.accessibilitySupport');
1694
+ const cursorBlinking = this.configurationService.getValue('editor.cursorBlinking');
1695
+ return { ...this._getEditorLanguageConfiguration(), accessibilitySupport, cursorBlinking, fontFamily, fontSize, lineHeight };
1696
+ }
1697
+ _getEditorFontFamily() {
1698
+ const inputFontFamily = this.configurationService.getValue('scm.inputFontFamily').trim();
1699
+ if (inputFontFamily.toLowerCase() === 'editor') {
1700
+ return this.configurationService.getValue('editor.fontFamily').trim();
1701
+ }
1702
+ if (inputFontFamily.length !== 0 && inputFontFamily.toLowerCase() !== 'default') {
1703
+ return inputFontFamily;
1704
+ }
1705
+ return this.defaultInputFontFamily;
1706
+ }
1707
+ _getEditorFontSize() {
1708
+ return this.configurationService.getValue('scm.inputFontSize');
1709
+ }
1710
+ _getEditorLanguageConfiguration() {
1711
+ const rulersConfig = this.configurationService.inspect('editor.rulers', { overrideIdentifier: 'scminput' });
1712
+ const rulers = rulersConfig.overrideIdentifiers?.includes('scminput') ? EditorOptions.rulers.validate(rulersConfig.value) : [];
1713
+ const wordWrapConfig = this.configurationService.inspect('editor.wordWrap', { overrideIdentifier: 'scminput' });
1714
+ const wordWrap = wordWrapConfig.overrideIdentifiers?.includes('scminput') ? EditorOptions.wordWrap.validate(wordWrapConfig.value) : 'on';
1715
+ return { rulers, wordWrap };
1716
+ }
1717
+ _getEditorLineHeight(fontSize) {
1718
+ return Math.round(fontSize * 1.5);
1719
+ }
1720
+ dispose() {
1721
+ this._disposables.dispose();
1722
+ }
1723
+ }
1610
1724
  let SCMInputWidget = class SCMInputWidget {
1611
1725
  static { SCMInputWidget_1 = this; }
1612
1726
  static { this.ValidationTimeouts = {
@@ -1712,28 +1826,7 @@ let SCMInputWidget = class SCMInputWidget {
1712
1826
  };
1713
1827
  this.repositoryDisposables.add(input.onDidChangeEnablement(enabled => updateEnablement(enabled)));
1714
1828
  updateEnablement(input.enabled);
1715
- const onDidChangeActionButton = () => {
1716
- this.actionBar.clear();
1717
- const actionCount = this.toolbarContextKeyService.getContextKeyValue(SCMInputContextKeys.ActionCount.key) ?? 0;
1718
- if (input.actionButton && actionCount === 0) {
1719
- const action = ( new Action(
1720
- input.actionButton.command.id,
1721
- input.actionButton.command.title,
1722
- ThemeIcon.isThemeIcon(input.actionButton.icon) ? ThemeIcon.asClassName(input.actionButton.icon) : undefined,
1723
- input.actionButton.enabled,
1724
- () => this.commandService.executeCommand(input.actionButton.command.id, ...(input.actionButton.command.arguments || []))
1725
- ));
1726
- this.actionBar.push(action, { icon: true, label: false });
1727
- }
1728
- this.layout();
1729
- };
1730
- const ctxKeys = ( new Set([SCMInputContextKeys.ActionCount.key]));
1731
- this.repositoryDisposables.add(Event.filter(this.toolbarContextKeyService.onDidChangeContext, e => e.affectsSome(ctxKeys))(onDidChangeActionButton, this));
1732
- this.repositoryDisposables.add(input.onDidChangeActionButton(onDidChangeActionButton, this));
1733
- this.repositoryDisposables.add(this.scmService.onDidChangeInputValueProviders(onDidChangeActionButton, this));
1734
- this.repositoryDisposables.add(Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.showInputActionButton'))(onDidChangeActionButton, this));
1735
- onDidChangeActionButton();
1736
- this.createToolbar(input);
1829
+ this.toolbar.setInput(input);
1737
1830
  }
1738
1831
  get selections() {
1739
1832
  return this.inputEditor.getSelections();
@@ -1743,34 +1836,6 @@ let SCMInputWidget = class SCMInputWidget {
1743
1836
  this.inputEditor.setSelections(selections);
1744
1837
  }
1745
1838
  }
1746
- createToolbar(input) {
1747
- const services = ( new ServiceCollection([IContextKeyService, this.toolbarContextKeyService]));
1748
- const instantiationService2 = this.instantiationService.createChild(services);
1749
- const ctxIsActionEnabled = SCMInputContextKeys.ActionIsEnabled.bindTo(this.toolbarContextKeyService);
1750
- this.repositoryDisposables.add(input.repository.provider.onDidChangeResources(() => ctxIsActionEnabled.set(( input.repository.provider.groups.some(r => r.resources.length > 0)))));
1751
- ctxIsActionEnabled.set(( input.repository.provider.groups.some(r => r.resources.length > 0)));
1752
- const actionRunner = instantiationService2.createInstance(SCMInputWidgetActionRunner, input);
1753
- this.repositoryDisposables.add(actionRunner);
1754
- const toolbar = instantiationService2.createInstance(SCMInputWidgetToolbar, this.toolbarContainer, input, MenuId.SCMInputBox, {
1755
- actionRunner,
1756
- actionViewItemProvider: action => {
1757
- if (action instanceof MenuItemAction && toolbar.dropdownActions.length > 1) {
1758
- const scmInputActionIsEnabled = this.toolbarContextKeyService.getContextKeyValue('scmInputActionIsEnabled') === true;
1759
- const dropdownAction = ( new Action('scmInputMoreActions', ( localizeWithPath(
1760
- 'vs/workbench/contrib/scm/browser/scmViewPane',
1761
- 'scmInputMoreActions',
1762
- 'More Actions...'
1763
- )), 'codicon-chevron-down', scmInputActionIsEnabled));
1764
- return instantiationService2.createInstance(DropdownWithPrimaryActionViewItem, action, dropdownAction, toolbar.dropdownActions, '', this.contextMenuService, { actionRunner });
1765
- }
1766
- return createActionViewItem(instantiationService2, action);
1767
- },
1768
- menuOptions: {
1769
- shouldForwardArgs: true
1770
- }
1771
- });
1772
- this.repositoryDisposables.add(toolbar);
1773
- }
1774
1839
  setValidation(validation, options) {
1775
1840
  if (this._validationTimer) {
1776
1841
  clearTimeout(this._validationTimer);
@@ -1785,20 +1850,16 @@ let SCMInputWidget = class SCMInputWidget {
1785
1850
  this._validationTimer = setTimeout(() => this.setValidation(undefined), SCMInputWidget_1.ValidationTimeouts[validation.type]);
1786
1851
  }
1787
1852
  }
1788
- constructor(container, overflowWidgetsDomNode, contextKeyService, modelService, textModelService, keybindingService, configurationService, instantiationService, scmService, scmViewService, contextViewService, openerService, contextMenuService, commandService) {
1789
- this.contextKeyService = contextKeyService;
1853
+ constructor(container, overflowWidgetsDomNode, contextKeyService, modelService, textModelService, keybindingService, configurationService, instantiationService, scmViewService, contextViewService, openerService, contextMenuService) {
1790
1854
  this.modelService = modelService;
1791
1855
  this.textModelService = textModelService;
1792
1856
  this.keybindingService = keybindingService;
1793
1857
  this.configurationService = configurationService;
1794
1858
  this.instantiationService = instantiationService;
1795
- this.scmService = scmService;
1796
1859
  this.scmViewService = scmViewService;
1797
1860
  this.contextViewService = contextViewService;
1798
1861
  this.openerService = openerService;
1799
1862
  this.contextMenuService = contextMenuService;
1800
- this.commandService = commandService;
1801
- this.defaultInputFontFamily = DEFAULT_FONT_FAMILY;
1802
1863
  this.disposables = ( new DisposableStore());
1803
1864
  this.repositoryDisposables = ( new DisposableStore());
1804
1865
  this.validationDisposable = Disposable.None;
@@ -1809,34 +1870,13 @@ let SCMInputWidget = class SCMInputWidget {
1809
1870
  this.editorContainer = append(this.element, $('.scm-editor-container'));
1810
1871
  this.placeholderTextContainer = append(this.editorContainer, $('.scm-editor-placeholder'));
1811
1872
  this.toolbarContainer = append(this.element, $('.scm-editor-toolbar'));
1812
- const fontFamily = this.getInputEditorFontFamily();
1813
- const fontSize = this.getInputEditorFontSize();
1814
- const lineHeight = this.computeLineHeight(fontSize);
1815
- this.setPlaceholderFontStyles(fontFamily, fontSize, lineHeight);
1816
- this.toolbarContextKeyService = this.contextKeyService.createScoped(this.toolbarContainer);
1817
- const contextKeyService2 = contextKeyService.createScoped(this.element);
1818
- this.repositoryIdContextKey = contextKeyService2.createKey('scmRepository', undefined);
1819
- const editorOptions = {
1820
- ...getSimpleEditorOptions(configurationService),
1821
- lineDecorationsWidth: 6,
1822
- dragAndDrop: true,
1823
- cursorWidth: 1,
1824
- fontSize: fontSize,
1825
- lineHeight: lineHeight,
1826
- fontFamily: fontFamily,
1827
- wrappingStrategy: 'advanced',
1828
- wrappingIndent: 'none',
1829
- padding: { top: 2, bottom: 2 },
1830
- quickSuggestions: false,
1831
- scrollbar: {
1832
- alwaysConsumeMouseWheel: false,
1833
- vertical: 'hidden'
1834
- },
1835
- overflowWidgetsDomNode,
1836
- formatOnType: true,
1837
- renderWhitespace: 'none',
1838
- dropIntoEditor: { enabled: true }
1839
- };
1873
+ this.contextKeyService = contextKeyService.createScoped(this.element);
1874
+ this.repositoryIdContextKey = this.contextKeyService.createKey('scmRepository', undefined);
1875
+ this.inputEditorOptions = ( new SCMInputWidgetEditorOptions(overflowWidgetsDomNode, this.configurationService));
1876
+ this.disposables.add(this.inputEditorOptions.onDidChange(this.onDidChangeEditorOptions, this));
1877
+ this.disposables.add(this.inputEditorOptions);
1878
+ const editorConstructionOptions = this.inputEditorOptions.getEditorConstructionOptions();
1879
+ this.setPlaceholderFontStyles(editorConstructionOptions.fontFamily, editorConstructionOptions.fontSize, editorConstructionOptions.lineHeight);
1840
1880
  const codeEditorWidgetOptions = {
1841
1881
  isSimpleWidget: true,
1842
1882
  contributions: EditorExtensionsRegistry.getSomeEditorContributions([
@@ -1847,7 +1887,7 @@ let SCMInputWidget = class SCMInputWidget {
1847
1887
  LinkDetector.ID,
1848
1888
  MenuPreventer.ID,
1849
1889
  MessageController.ID,
1850
- ModesHoverController.ID,
1890
+ HoverController.ID,
1851
1891
  SelectionClipboardContributionID,
1852
1892
  SnippetController2.ID,
1853
1893
  SuggestController.ID,
@@ -1856,9 +1896,9 @@ let SCMInputWidget = class SCMInputWidget {
1856
1896
  FormatOnType.ID
1857
1897
  ])
1858
1898
  };
1859
- const services = ( new ServiceCollection([IContextKeyService, contextKeyService2]));
1899
+ const services = ( new ServiceCollection([IContextKeyService, this.contextKeyService]));
1860
1900
  const instantiationService2 = instantiationService.createChild(services);
1861
- this.inputEditor = instantiationService2.createInstance(CodeEditorWidget, this.editorContainer, editorOptions, codeEditorWidgetOptions);
1901
+ this.inputEditor = instantiationService2.createInstance(CodeEditorWidget, this.editorContainer, editorConstructionOptions, codeEditorWidgetOptions);
1862
1902
  this.disposables.add(this.inputEditor);
1863
1903
  this.disposables.add(this.inputEditor.onDidFocusEditorText(() => {
1864
1904
  if (this.input?.repository) {
@@ -1875,8 +1915,8 @@ let SCMInputWidget = class SCMInputWidget {
1875
1915
  }
1876
1916
  }, 0);
1877
1917
  }));
1878
- const firstLineKey = contextKeyService2.createKey('scmInputIsInFirstPosition', false);
1879
- const lastLineKey = contextKeyService2.createKey('scmInputIsInLastPosition', false);
1918
+ const firstLineKey = this.contextKeyService.createKey('scmInputIsInFirstPosition', false);
1919
+ const lastLineKey = this.contextKeyService.createKey('scmInputIsInLastPosition', false);
1880
1920
  this.disposables.add(this.inputEditor.onDidChangeCursorPosition(({ position }) => {
1881
1921
  const viewModel = this.inputEditor._getViewModel();
1882
1922
  const lastLineNumber = viewModel.getLineCount();
@@ -1888,44 +1928,32 @@ let SCMInputWidget = class SCMInputWidget {
1888
1928
  this.disposables.add(this.inputEditor.onDidScrollChange(e => {
1889
1929
  this.toolbarContainer.classList.toggle('scroll-decoration', e.scrollTop > 0);
1890
1930
  }));
1891
- const relevantSettings = [
1892
- 'scm.inputFontFamily',
1893
- 'editor.fontFamily',
1894
- 'scm.inputFontSize',
1895
- 'editor.accessibilitySupport',
1896
- 'editor.cursorBlinking'
1897
- ];
1898
- const onRelevantSettingChanged = Event.filter(this.configurationService.onDidChangeConfiguration, (e) => {
1899
- for (const setting of relevantSettings) {
1900
- if (e.affectsConfiguration(setting)) {
1901
- return true;
1931
+ Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.showInputActionButton'))(() => this.layout(), this, this.disposables);
1932
+ this.onDidChangeContentHeight = Event.signal(Event.filter(this.inputEditor.onDidContentSizeChange, e => e.contentHeightChanged, this.disposables));
1933
+ this.toolbar = instantiationService2.createInstance(SCMInputWidgetToolbar, this.toolbarContainer, {
1934
+ actionViewItemProvider: action => {
1935
+ if (action instanceof MenuItemAction && this.toolbar.dropdownActions.length > 1) {
1936
+ return instantiationService.createInstance(DropdownWithPrimaryActionViewItem, action, this.toolbar.dropdownAction, this.toolbar.dropdownActions, '', this.contextMenuService, { actionRunner: this.toolbar.actionRunner });
1902
1937
  }
1938
+ return createActionViewItem(instantiationService, action);
1939
+ },
1940
+ menuOptions: {
1941
+ shouldForwardArgs: true
1903
1942
  }
1904
- return false;
1905
- }, this.disposables);
1906
- this.disposables.add(onRelevantSettingChanged(() => {
1907
- const fontFamily = this.getInputEditorFontFamily();
1908
- const fontSize = this.getInputEditorFontSize();
1909
- const lineHeight = this.computeLineHeight(fontSize);
1910
- const accessibilitySupport = this.configurationService.getValue('editor.accessibilitySupport');
1911
- const cursorBlinking = this.configurationService.getValue('editor.cursorBlinking');
1912
- this.inputEditor.updateOptions({
1913
- fontFamily: fontFamily,
1914
- fontSize: fontSize,
1915
- lineHeight: lineHeight,
1916
- accessibilitySupport,
1917
- cursorBlinking
1918
- });
1919
- this.setPlaceholderFontStyles(fontFamily, fontSize, lineHeight);
1920
- }));
1921
- this.onDidChangeContentHeight = Event.signal(Event.filter(this.inputEditor.onDidContentSizeChange, e => e.contentHeightChanged, this.disposables));
1922
- this.actionBar = ( new ActionBar(this.toolbarContainer));
1923
- this.disposables.add(this.actionBar);
1943
+ });
1944
+ this.disposables.add(this.toolbar.onDidChange(() => this.layout()));
1945
+ this.disposables.add(this.toolbar);
1924
1946
  }
1925
1947
  getContentHeight() {
1926
- const editorContentHeight = this.inputEditor.getContentHeight();
1927
- const editorContextHeightMax = this.getInputEditorMaxHeight();
1928
- return Math.min(editorContentHeight, editorContextHeightMax);
1948
+ const lineHeight = this.inputEditor.getOption(66 );
1949
+ const { top, bottom } = this.inputEditor.getOption(83 );
1950
+ const inputMinLinesConfig = this.configurationService.getValue('scm.inputMinLineCount');
1951
+ const inputMinLines = typeof inputMinLinesConfig === 'number' ? clamp(inputMinLinesConfig, 1, 50) : 1;
1952
+ const editorMinHeight = inputMinLines * lineHeight + top + bottom;
1953
+ const inputMaxLinesConfig = this.configurationService.getValue('scm.inputMaxLineCount');
1954
+ const inputMaxLines = typeof inputMaxLinesConfig === 'number' ? clamp(inputMaxLinesConfig, 1, 50) : 10;
1955
+ const editorMaxHeight = inputMaxLines * lineHeight + top + bottom;
1956
+ return clamp(this.inputEditor.getContentHeight(), editorMinHeight, editorMaxHeight);
1929
1957
  }
1930
1958
  layout() {
1931
1959
  const editorHeight = this.getContentHeight();
@@ -1939,8 +1967,8 @@ let SCMInputWidget = class SCMInputWidget {
1939
1967
  this.inputEditor.layout(dimension);
1940
1968
  this.placeholderTextContainer.style.width = `${dimension.width}px`;
1941
1969
  this.renderValidation();
1942
- this.actionBar.domNode.classList.toggle('hidden', this.actionBar.isEmpty());
1943
- this.toolbarContainer.classList.toggle('hidden', this.configurationService.getValue('scm.showInputActionButton') === false);
1970
+ const showInputActionButton = this.configurationService.getValue('scm.showInputActionButton') === true;
1971
+ this.toolbarContainer.classList.toggle('hidden', !showInputActionButton || this.toolbar?.isEmpty() === true);
1944
1972
  if (this.shouldFocusAfterLayout) {
1945
1973
  this.shouldFocusAfterLayout = false;
1946
1974
  this.focus();
@@ -1958,6 +1986,11 @@ let SCMInputWidget = class SCMInputWidget {
1958
1986
  hasFocus() {
1959
1987
  return this.inputEditor.hasTextFocus();
1960
1988
  }
1989
+ onDidChangeEditorOptions() {
1990
+ const editorOptions = this.inputEditorOptions.getEditorOptions();
1991
+ this.inputEditor.updateOptions(editorOptions);
1992
+ this.setPlaceholderFontStyles(editorOptions.fontFamily, editorOptions.fontSize, editorOptions.lineHeight);
1993
+ }
1961
1994
  renderValidation() {
1962
1995
  this.clearValidation();
1963
1996
  this.element.classList.toggle('validation-info', this.validation?.type === 2 );
@@ -2027,40 +2060,14 @@ let SCMInputWidget = class SCMInputWidget {
2027
2060
  anchorAlignment: 0
2028
2061
  });
2029
2062
  }
2030
- getInputEditorFontFamily() {
2031
- const inputFontFamily = this.configurationService.getValue('scm.inputFontFamily').trim();
2032
- if (inputFontFamily.toLowerCase() === 'editor') {
2033
- return this.configurationService.getValue('editor.fontFamily').trim();
2034
- }
2035
- if (inputFontFamily.length !== 0 && inputFontFamily.toLowerCase() !== 'default') {
2036
- return inputFontFamily;
2037
- }
2038
- return this.defaultInputFontFamily;
2039
- }
2040
- getInputEditorFontSize() {
2041
- return this.configurationService.getValue('scm.inputFontSize');
2042
- }
2043
- getInputEditorMaxLines() {
2044
- const inputMaxLines = this.configurationService.getValue('scm.inputMaxLines');
2045
- return typeof inputMaxLines === 'number' ? clamp(inputMaxLines, 1, 50) : 10;
2046
- }
2047
- getInputEditorMaxHeight() {
2048
- const maxLines = this.getInputEditorMaxLines();
2049
- const fontSize = this.getInputEditorFontSize();
2050
- const lineHeight = this.computeLineHeight(fontSize);
2051
- const { top, bottom } = this.inputEditor.getOption(83 );
2052
- return maxLines * lineHeight + top + bottom;
2053
- }
2054
2063
  getToolbarWidth() {
2055
2064
  const showInputActionButton = this.configurationService.getValue('scm.showInputActionButton');
2056
- const actionCount = this.toolbarContextKeyService.getContextKeyValue(SCMInputContextKeys.ActionCount.key) ?? 0;
2057
- if (!showInputActionButton || (this.actionBar.isEmpty() && actionCount === 0)) {
2065
+ if (!this.toolbar || !showInputActionButton || this.toolbar?.isEmpty() === true) {
2058
2066
  return 0;
2059
2067
  }
2060
- return 26;
2061
- }
2062
- computeLineHeight(fontSize) {
2063
- return Math.round(fontSize * 1.5);
2068
+ return this.toolbar.dropdownActions.length === 0 ?
2069
+ 26 :
2070
+ 39 ;
2064
2071
  }
2065
2072
  setPlaceholderFontStyles(fontFamily, fontSize, lineHeight) {
2066
2073
  this.placeholderTextContainer.style.fontFamily = fontFamily;
@@ -2085,12 +2092,10 @@ SCMInputWidget = SCMInputWidget_1 = ( __decorate([
2085
2092
  ( __param(5, IKeybindingService)),
2086
2093
  ( __param(6, IConfigurationService)),
2087
2094
  ( __param(7, IInstantiationService)),
2088
- ( __param(8, ISCMService)),
2089
- ( __param(9, ISCMViewService)),
2090
- ( __param(10, IContextViewService)),
2091
- ( __param(11, IOpenerService)),
2092
- ( __param(12, IContextMenuService)),
2093
- ( __param(13, ICommandService))
2095
+ ( __param(8, ISCMViewService)),
2096
+ ( __param(9, IContextViewService)),
2097
+ ( __param(10, IOpenerService)),
2098
+ ( __param(11, IContextMenuService))
2094
2099
  ], SCMInputWidget));
2095
2100
  let SCMViewPane = class SCMViewPane extends ViewPane {
2096
2101
  get viewMode() { return this._viewMode; }
@@ -2120,10 +2125,6 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2120
2125
  this.storageService.store(`scm.viewSortKey`, sortKey, 1 , 0 );
2121
2126
  }
2122
2127
  }
2123
- get showActionButton() { return this._showActionButton; }
2124
- get alwaysShowRepositories() { return this._alwaysShowRepositories; }
2125
- get showIncomingChanges() { return this._showIncomingChanges ?? 'never'; }
2126
- get showOutgoingChanges() { return this._showOutgoingChanges ?? 'never'; }
2127
2128
  constructor(options, commandService, editorService, menuService, scmService, scmViewService, storageService, uriIdentityService, keybindingService, themeService, contextMenuService, instantiationService, viewDescriptorService, configurationService, contextKeyService, openerService, telemetryService) {
2128
2129
  super({ ...options, titleMenuId: MenuId.SCMTitle }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
2129
2130
  this.commandService = commandService;
@@ -2137,8 +2138,6 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2137
2138
  this.onDidChangeViewMode = this._onDidChangeViewMode.event;
2138
2139
  this._onDidChangeViewSortKey = ( new Emitter());
2139
2140
  this.onDidChangeViewSortKey = this._onDidChangeViewSortKey.event;
2140
- this._showActionButton = false;
2141
- this._alwaysShowRepositories = false;
2142
2141
  this.items = ( new DisposableMap());
2143
2142
  this.visibilityDisposables = ( new DisposableStore());
2144
2143
  this.treeOperationSequencer = ( new Sequencer());
@@ -2211,24 +2210,16 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2211
2210
  this.onDidChangeBodyVisibility(async (visible) => {
2212
2211
  if (visible) {
2213
2212
  await this.tree.setInput(this.scmViewService, viewState);
2214
- const onDidChangeConfiguration = (e) => {
2215
- if (!e ||
2216
- e.affectsConfiguration('scm.showActionButton') ||
2217
- e.affectsConfiguration('scm.alwaysShowRepositories') ||
2218
- e.affectsConfiguration('scm.showIncomingChanges') ||
2219
- e.affectsConfiguration('scm.showOutgoingChanges')) {
2220
- this._showActionButton = this.configurationService.getValue('scm.showActionButton');
2221
- this._alwaysShowRepositories = this.configurationService.getValue('scm.alwaysShowRepositories');
2222
- this._showIncomingChanges = this.configurationService.getValue('scm.showIncomingChanges');
2223
- this._showOutgoingChanges = this.configurationService.getValue('scm.showOutgoingChanges');
2224
- if (e?.affectsConfiguration('scm.alwaysShowRepositories')) {
2225
- this.updateActions();
2226
- }
2227
- this.updateChildren();
2228
- }
2229
- };
2230
- this.configurationService.onDidChangeConfiguration(onDidChangeConfiguration, this, this.visibilityDisposables);
2231
- onDidChangeConfiguration();
2213
+ Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.alwaysShowRepositories'), this.visibilityDisposables)(() => {
2214
+ this.updateActions();
2215
+ this.updateChildren();
2216
+ }, this, this.visibilityDisposables);
2217
+ Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.inputMinLineCount') ||
2218
+ e.affectsConfiguration('scm.inputMaxLineCount') ||
2219
+ e.affectsConfiguration('scm.showActionButton') ||
2220
+ e.affectsConfiguration('scm.showChangesSummary') ||
2221
+ e.affectsConfiguration('scm.showIncomingChanges') ||
2222
+ e.affectsConfiguration('scm.showOutgoingChanges'), this.visibilityDisposables)(() => this.updateChildren(), this, this.visibilityDisposables);
2232
2223
  this.editorService.onDidActiveEditorChange(this.onDidActiveEditorChange, this, this.visibilityDisposables);
2233
2224
  this.scmViewService.onDidChangeVisibleRepositories(this.onDidChangeVisibleRepositories, this, this.visibilityDisposables);
2234
2225
  this.onDidChangeVisibleRepositories({ added: this.scmViewService.visibleRepositories, removed: Iterable.empty() });
@@ -2254,19 +2245,25 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2254
2245
  this.actionButtonRenderer = this.instantiationService.createInstance(ActionButtonRenderer);
2255
2246
  this.listLabels = this.instantiationService.createInstance(ResourceLabels, { onDidChangeVisibility: this.onDidChangeBodyVisibility });
2256
2247
  this.disposables.add(this.listLabels);
2257
- const actionRunner = ( new RepositoryPaneActionRunner(() => this.getSelectedResources()));
2258
- actionRunner.onWillRun(() => this.tree.domFocus(), this, this.disposables);
2259
- this.disposables.add(actionRunner);
2260
- const treeDataSource = this.instantiationService.createInstance(SCMTreeDataSource, () => this.viewMode, () => this.alwaysShowRepositories, () => this.showActionButton, () => this.showIncomingChanges, () => this.showOutgoingChanges);
2248
+ const resourceActionRunner = ( new RepositoryPaneActionRunner(() => this.getSelectedResources()));
2249
+ resourceActionRunner.onWillRun(() => this.tree.domFocus(), this, this.disposables);
2250
+ this.disposables.add(resourceActionRunner);
2251
+ const historyItemGroupActionRunner = ( new HistoryItemGroupActionRunner());
2252
+ historyItemGroupActionRunner.onWillRun(() => this.tree.domFocus(), this, this.disposables);
2253
+ this.disposables.add(historyItemGroupActionRunner);
2254
+ const historyItemActionRunner = ( new HistoryItemActionRunner());
2255
+ historyItemActionRunner.onWillRun(() => this.tree.domFocus(), this, this.disposables);
2256
+ this.disposables.add(historyItemActionRunner);
2257
+ const treeDataSource = this.instantiationService.createInstance(SCMTreeDataSource, () => this.viewMode);
2261
2258
  this.disposables.add(treeDataSource);
2262
2259
  this.tree = this.instantiationService.createInstance(WorkbenchCompressibleAsyncDataTree, 'SCM Tree Repo', container, ( new ListDelegate(this.inputRenderer)), ( new SCMTreeCompressionDelegate()), [
2263
2260
  this.inputRenderer,
2264
2261
  this.actionButtonRenderer,
2265
- this.instantiationService.createInstance(RepositoryRenderer, getActionViewItemProvider(this.instantiationService)),
2262
+ this.instantiationService.createInstance(RepositoryRenderer, MenuId.SCMTitle, getActionViewItemProvider(this.instantiationService)),
2266
2263
  this.instantiationService.createInstance(ResourceGroupRenderer, getActionViewItemProvider(this.instantiationService)),
2267
- this.instantiationService.createInstance(ResourceRenderer, () => this.viewMode, this.listLabels, getActionViewItemProvider(this.instantiationService), actionRunner),
2268
- this.instantiationService.createInstance(HistoryItemGroupRenderer),
2269
- this.instantiationService.createInstance(HistoryItemRenderer, getActionViewItemProvider(this.instantiationService)),
2264
+ this.instantiationService.createInstance(ResourceRenderer, () => this.viewMode, this.listLabels, getActionViewItemProvider(this.instantiationService), resourceActionRunner),
2265
+ this.instantiationService.createInstance(HistoryItemGroupRenderer, historyItemGroupActionRunner),
2266
+ this.instantiationService.createInstance(HistoryItemRenderer, historyItemActionRunner, getActionViewItemProvider(this.instantiationService)),
2270
2267
  this.instantiationService.createInstance(HistoryItemChangeRenderer, () => this.viewMode, this.listLabels),
2271
2268
  this.instantiationService.createInstance(SeparatorRenderer)
2272
2269
  ], treeDataSource, {
@@ -2386,6 +2383,14 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2386
2383
  if (!uri) {
2387
2384
  return;
2388
2385
  }
2386
+ if (( this.tree.getFocus().some(
2387
+ e => isSCMResource(e) && this.uriIdentityService.extUri.isEqual(e.sourceUri, uri)
2388
+ )) &&
2389
+ ( this.tree.getSelection().some(
2390
+ e => isSCMResource(e) && this.uriIdentityService.extUri.isEqual(e.sourceUri, uri)
2391
+ ))) {
2392
+ return;
2393
+ }
2389
2394
  this.revealResourceThrottler.queue(() => this.treeOperationSequencer.queue(async () => {
2390
2395
  for (const repository of this.scmViewService.visibleRepositories) {
2391
2396
  const item = this.items.get(repository);
@@ -2411,7 +2416,6 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2411
2416
  for (const repository of added) {
2412
2417
  const repositoryDisposables = ( new DisposableStore());
2413
2418
  repositoryDisposables.add(repository.provider.onDidChange(() => this.updateChildren(repository)));
2414
- repositoryDisposables.add(repository.input.onDidChangeActionButton(() => this.updateChildren(repository)));
2415
2419
  repositoryDisposables.add(repository.input.onDidChangeVisibility(() => this.updateChildren(repository)));
2416
2420
  repositoryDisposables.add(repository.provider.onDidChangeResourceGroups(() => this.updateChildren(repository)));
2417
2421
  if (repository.provider.historyProvider) {
@@ -2461,7 +2465,7 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2461
2465
  let actions = [];
2462
2466
  if (isSCMRepository(element)) {
2463
2467
  const menus = this.scmViewService.menus.getRepositoryMenus(element.provider);
2464
- const menu = menus.repositoryMenu;
2468
+ const menu = menus.repositoryContextMenu;
2465
2469
  context = element.provider;
2466
2470
  actions = collectContextMenuActions(menu);
2467
2471
  }
@@ -2488,7 +2492,9 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2488
2492
  actions = collectContextMenuActions(menu);
2489
2493
  }
2490
2494
  }
2491
- const actionRunner = ( new RepositoryPaneActionRunner(() => this.getSelectedResources()));
2495
+ const actionRunner = isSCMRepository(element) ?
2496
+ ( new RepositoryActionRunner(() => this.getSelectedRepositories())) :
2497
+ ( new RepositoryPaneActionRunner(() => this.getSelectedResources()));
2492
2498
  actionRunner.onWillRun(() => this.tree.domFocus());
2493
2499
  this.contextMenuService.showContextMenu({
2494
2500
  getAnchor: () => e.anchor,
@@ -2497,6 +2503,11 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2497
2503
  actionRunner
2498
2504
  });
2499
2505
  }
2506
+ getSelectedRepositories() {
2507
+ const focusedRepositories = this.tree.getFocus().filter(r => !!r && isSCMRepository(r));
2508
+ const selectedRepositories = this.tree.getSelection().filter(r => !!r && isSCMRepository(r));
2509
+ return Array.from(( new Set([...focusedRepositories, ...selectedRepositories])));
2510
+ }
2500
2511
  getSelectedResources() {
2501
2512
  return this.tree.getSelection()
2502
2513
  .filter(r => !!r && !isSCMResourceGroup(r));
@@ -2546,7 +2557,9 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2546
2557
  }
2547
2558
  }
2548
2559
  storeTreeViewState() {
2549
- this.storageService.store('scm.viewState2', JSON.stringify(this.tree.getViewState()), 1 , 1 );
2560
+ if (this.tree) {
2561
+ this.storageService.store('scm.viewState2', JSON.stringify(this.tree.getViewState()), 1 , 1 );
2562
+ }
2550
2563
  }
2551
2564
  updateChildren(element) {
2552
2565
  this.updateChildrenThrottler.queue(() => this.treeOperationSequencer.queue(async () => {
@@ -2571,7 +2584,8 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2571
2584
  this.treeContainer.classList.toggle('hide-arrows', this.viewMode === "tree" && theme.hidesExplorerArrows === true);
2572
2585
  }
2573
2586
  updateScmProviderContextKeys() {
2574
- if (!this.alwaysShowRepositories && this.items.size === 1) {
2587
+ const alwaysShowRepositories = this.configurationService.getValue('scm.alwaysShowRepositories');
2588
+ if (!alwaysShowRepositories && this.items.size === 1) {
2575
2589
  const provider = Iterable.first(( this.items.keys())).provider;
2576
2590
  this.scmProviderContextKey.set(provider.contextValue);
2577
2591
  this.scmProviderRootUriContextKey.set(provider.rootUri?.toString());
@@ -2655,17 +2669,16 @@ SCMViewPane = ( __decorate([
2655
2669
  ( __param(16, ITelemetryService))
2656
2670
  ], SCMViewPane));
2657
2671
  let SCMTreeDataSource = class SCMTreeDataSource {
2658
- constructor(viewMode, alwaysShowRepositories, showActionButton, showIncomingChanges, showOutgoingChanges, scmViewService, uriIdentityService) {
2672
+ constructor(viewMode, configurationService, scmViewService, uriIdentityService) {
2659
2673
  this.viewMode = viewMode;
2660
- this.alwaysShowRepositories = alwaysShowRepositories;
2661
- this.showActionButton = showActionButton;
2662
- this.showIncomingChanges = showIncomingChanges;
2663
- this.showOutgoingChanges = showOutgoingChanges;
2674
+ this.configurationService = configurationService;
2664
2675
  this.scmViewService = scmViewService;
2665
2676
  this.uriIdentityService = uriIdentityService;
2666
2677
  this.historyProviderCache = ( new Map());
2667
2678
  this.repositoryDisposables = ( new DisposableMap());
2668
2679
  this.disposables = ( new DisposableStore());
2680
+ const onDidChangeConfiguration = Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.showChangesSummary'), this.disposables);
2681
+ this.disposables.add(onDidChangeConfiguration(() => this.historyProviderCache.clear()));
2669
2682
  this.scmViewService.onDidChangeVisibleRepositories(this.onDidChangeVisibleRepositories, this, this.disposables);
2670
2683
  this.onDidChangeVisibleRepositories({ added: this.scmViewService.visibleRepositories, removed: Iterable.empty() });
2671
2684
  }
@@ -2708,8 +2721,8 @@ let SCMTreeDataSource = class SCMTreeDataSource {
2708
2721
  }
2709
2722
  }
2710
2723
  async getChildren(inputOrElement) {
2724
+ const { alwaysShowRepositories, showActionButton } = this.getConfiguration();
2711
2725
  const repositoryCount = this.scmViewService.visibleRepositories.length;
2712
- const alwaysShowRepositories = this.alwaysShowRepositories();
2713
2726
  if (isSCMViewService(inputOrElement) && (repositoryCount > 1 || alwaysShowRepositories)) {
2714
2727
  return this.scmViewService.visibleRepositories;
2715
2728
  }
@@ -2718,7 +2731,6 @@ let SCMTreeDataSource = class SCMTreeDataSource {
2718
2731
  inputOrElement = isSCMRepository(inputOrElement) ? inputOrElement : this.scmViewService.visibleRepositories[0];
2719
2732
  const actionButton = inputOrElement.provider.actionButton;
2720
2733
  const resourceGroups = inputOrElement.provider.groups;
2721
- const showActionButton = this.showActionButton();
2722
2734
  if (inputOrElement.input.visible) {
2723
2735
  children.push(inputOrElement.input);
2724
2736
  }
@@ -2735,20 +2747,43 @@ let SCMTreeDataSource = class SCMTreeDataSource {
2735
2747
  }
2736
2748
  const historyItemGroups = await this.getHistoryItemGroups(inputOrElement);
2737
2749
  if (historyItemGroups.length > 0) {
2738
- children.push({
2739
- label: ( localizeWithPath(
2750
+ let label = ( localizeWithPath(
2751
+ 'vs/workbench/contrib/scm/browser/scmViewPane',
2752
+ 'syncSeparatorHeader',
2753
+ "Incoming/Outgoing"
2754
+ ));
2755
+ let ariaLabel = ( localizeWithPath(
2756
+ 'vs/workbench/contrib/scm/browser/scmViewPane',
2757
+ 'syncSeparatorHeaderAriaLabel',
2758
+ "Incoming and outgoing changes"
2759
+ ));
2760
+ const incomingHistoryItems = historyItemGroups.find(g => g.direction === 'incoming');
2761
+ const outgoingHistoryItems = historyItemGroups.find(g => g.direction === 'outgoing');
2762
+ if (incomingHistoryItems && !outgoingHistoryItems) {
2763
+ label = ( localizeWithPath(
2740
2764
  'vs/workbench/contrib/scm/browser/scmViewPane',
2741
- 'syncSeparatorHeader',
2742
- "Incoming/Outgoing"
2743
- )),
2744
- ariaLabel: ( localizeWithPath(
2765
+ 'syncIncomingSeparatorHeader',
2766
+ "Incoming"
2767
+ ));
2768
+ ariaLabel = ( localizeWithPath(
2745
2769
  'vs/workbench/contrib/scm/browser/scmViewPane',
2746
- 'syncSeparatorHeaderAriaLabel',
2747
- "Incoming and outgoing changes"
2748
- )),
2749
- repository: inputOrElement,
2750
- type: 'separator'
2751
- });
2770
+ 'syncIncomingSeparatorHeaderAriaLabel',
2771
+ "Incoming changes"
2772
+ ));
2773
+ }
2774
+ else if (!incomingHistoryItems && outgoingHistoryItems) {
2775
+ label = ( localizeWithPath(
2776
+ 'vs/workbench/contrib/scm/browser/scmViewPane',
2777
+ 'syncOutgoingSeparatorHeader',
2778
+ "Outgoing"
2779
+ ));
2780
+ ariaLabel = ( localizeWithPath(
2781
+ 'vs/workbench/contrib/scm/browser/scmViewPane',
2782
+ 'syncOutgoingSeparatorHeaderAriaLabel',
2783
+ "Outgoing changes"
2784
+ ));
2785
+ }
2786
+ children.push({ label, ariaLabel, repository: inputOrElement, type: 'separator' });
2752
2787
  }
2753
2788
  children.push(...historyItemGroups);
2754
2789
  return children;
@@ -2781,52 +2816,70 @@ let SCMTreeDataSource = class SCMTreeDataSource {
2781
2816
  return [];
2782
2817
  }
2783
2818
  async getHistoryItemGroups(element) {
2819
+ const { showIncomingChanges, showOutgoingChanges } = this.getConfiguration();
2784
2820
  const scmProvider = element.provider;
2785
2821
  const historyProvider = scmProvider.historyProvider;
2786
2822
  const currentHistoryItemGroup = historyProvider?.currentHistoryItemGroup;
2787
- if (!historyProvider || !currentHistoryItemGroup || (this.showIncomingChanges() === 'never' && this.showOutgoingChanges() === 'never')) {
2823
+ if (!historyProvider || !currentHistoryItemGroup || (showIncomingChanges === 'never' && showOutgoingChanges === 'never')) {
2788
2824
  return [];
2789
2825
  }
2790
2826
  const children = [];
2791
2827
  const historyProviderCacheEntry = this.getHistoryProviderCacheEntry(element);
2792
- let historyItemGroupDetails = historyProviderCacheEntry?.historyItemGroupDetails;
2793
- if (!historyItemGroupDetails) {
2794
- historyItemGroupDetails = await historyProvider.resolveHistoryItemGroupDetails(currentHistoryItemGroup);
2795
- this.historyProviderCache.set(element, {
2796
- ...historyProviderCacheEntry,
2797
- historyItemGroupDetails
2798
- });
2799
- }
2800
- if (historyItemGroupDetails?.incoming &&
2801
- (this.showIncomingChanges() === 'always' ||
2802
- (this.showIncomingChanges() === 'auto' && (historyItemGroupDetails.incoming.count ?? 0) > 0))) {
2803
- children.push({
2804
- ...historyItemGroupDetails.incoming,
2828
+ let incomingHistoryItemGroup = historyProviderCacheEntry?.incomingHistoryItemGroup;
2829
+ let outgoingHistoryItemGroup = historyProviderCacheEntry?.outgoingHistoryItemGroup;
2830
+ if (!incomingHistoryItemGroup || !outgoingHistoryItemGroup) {
2831
+ const ancestor = await historyProvider.resolveHistoryItemGroupCommonAncestor(currentHistoryItemGroup.id, currentHistoryItemGroup.base?.id);
2832
+ if (!ancestor) {
2833
+ return [];
2834
+ }
2835
+ incomingHistoryItemGroup = currentHistoryItemGroup.base ? {
2836
+ id: currentHistoryItemGroup.base.id,
2837
+ label: currentHistoryItemGroup.base.label,
2805
2838
  ariaLabel: ( localizeWithPath(
2806
2839
  'vs/workbench/contrib/scm/browser/scmViewPane',
2807
2840
  'incomingChangesAriaLabel',
2808
2841
  "Incoming changes from {0}",
2809
- historyItemGroupDetails.incoming.label
2842
+ currentHistoryItemGroup.base.label
2810
2843
  )),
2844
+ icon: Codicon.arrowCircleDown,
2845
+ direction: 'incoming',
2846
+ ancestor: ancestor.id,
2847
+ count: ancestor.behind,
2811
2848
  repository: element,
2812
2849
  type: 'historyItemGroup'
2813
- });
2814
- }
2815
- if (historyItemGroupDetails?.outgoing &&
2816
- (this.showOutgoingChanges() === 'always' ||
2817
- (this.showOutgoingChanges() === 'auto' && (historyItemGroupDetails.outgoing.count ?? 0) > 0))) {
2818
- children.push({
2819
- ...historyItemGroupDetails.outgoing,
2850
+ } : undefined;
2851
+ outgoingHistoryItemGroup = {
2852
+ id: currentHistoryItemGroup.id,
2853
+ label: currentHistoryItemGroup.label,
2820
2854
  ariaLabel: ( localizeWithPath(
2821
2855
  'vs/workbench/contrib/scm/browser/scmViewPane',
2822
2856
  'outgoingChangesAriaLabel',
2823
- "Outgoing changes from {0}",
2824
- historyItemGroupDetails.outgoing.label
2857
+ "Outgoing changes to {0}",
2858
+ currentHistoryItemGroup.label
2825
2859
  )),
2860
+ icon: Codicon.arrowCircleUp,
2861
+ direction: 'outgoing',
2862
+ ancestor: ancestor.id,
2863
+ count: ancestor.ahead,
2826
2864
  repository: element,
2827
2865
  type: 'historyItemGroup'
2866
+ };
2867
+ this.historyProviderCache.set(element, {
2868
+ ...historyProviderCacheEntry,
2869
+ incomingHistoryItemGroup,
2870
+ outgoingHistoryItemGroup
2828
2871
  });
2829
2872
  }
2873
+ if (incomingHistoryItemGroup &&
2874
+ (showIncomingChanges === 'always' ||
2875
+ (showIncomingChanges === 'auto' && (incomingHistoryItemGroup.count ?? 0) > 0))) {
2876
+ children.push(incomingHistoryItemGroup);
2877
+ }
2878
+ if (outgoingHistoryItemGroup &&
2879
+ (showOutgoingChanges === 'always' ||
2880
+ (showOutgoingChanges === 'auto' && (outgoingHistoryItemGroup.count ?? 0) > 0))) {
2881
+ children.push(outgoingHistoryItemGroup);
2882
+ }
2830
2883
  return children;
2831
2884
  }
2832
2885
  async getHistoryItems(element) {
@@ -2837,19 +2890,39 @@ let SCMTreeDataSource = class SCMTreeDataSource {
2837
2890
  }
2838
2891
  const historyProviderCacheEntry = this.getHistoryProviderCacheEntry(repository);
2839
2892
  const historyItemsMap = historyProviderCacheEntry.historyItems;
2840
- let historyItems = historyProviderCacheEntry.historyItems.get(element.id);
2841
- if (!historyItems) {
2842
- historyItems = (await historyProvider.provideHistoryItems(element.id, { limit: { id: element.ancestor } })) ?? [];
2893
+ let historyItemsElement = historyProviderCacheEntry.historyItems.get(element.id);
2894
+ if (!historyItemsElement) {
2895
+ const historyItems = (await historyProvider.provideHistoryItems(element.id, { limit: { id: element.ancestor } })) ?? [];
2896
+ const { showChangesSummary } = this.getConfiguration();
2897
+ const allChanges = showChangesSummary && historyItems.length >= 2 ?
2898
+ await historyProvider.provideHistoryItemSummary(historyItems[0].id, element.ancestor) : undefined;
2899
+ historyItemsElement = [allChanges, historyItems];
2843
2900
  this.historyProviderCache.set(repository, {
2844
2901
  ...historyProviderCacheEntry,
2845
- historyItems: historyItemsMap.set(element.id, historyItems)
2902
+ historyItems: historyItemsMap.set(element.id, historyItemsElement)
2846
2903
  });
2847
2904
  }
2848
- return ( historyItems.map(historyItem => ({
2905
+ const children = [];
2906
+ if (historyItemsElement[0]) {
2907
+ children.push({
2908
+ ...historyItemsElement[0],
2909
+ icon: historyItemsElement[0].icon ?? Codicon.files,
2910
+ label: ( localizeWithPath(
2911
+ 'vs/workbench/contrib/scm/browser/scmViewPane',
2912
+ 'allChanges',
2913
+ "All Changes"
2914
+ )),
2915
+ historyItemGroup: element,
2916
+ type: 'allChanges'
2917
+ });
2918
+ }
2919
+ children.push(...( historyItemsElement[1]
2920
+ .map(historyItem => ({
2849
2921
  ...historyItem,
2850
2922
  historyItemGroup: element,
2851
2923
  type: 'historyItem'
2852
- })));
2924
+ }))));
2925
+ return children;
2853
2926
  }
2854
2927
  async getHistoryItemChanges(element) {
2855
2928
  const repository = element.historyItemGroup.repository;
@@ -2859,12 +2932,14 @@ let SCMTreeDataSource = class SCMTreeDataSource {
2859
2932
  }
2860
2933
  const historyProviderCacheEntry = this.getHistoryProviderCacheEntry(repository);
2861
2934
  const historyItemChangesMap = historyProviderCacheEntry.historyItemChanges;
2862
- let historyItemChanges = historyItemChangesMap.get(element.id);
2935
+ const historyItemParentId = element.parentIds.length > 0 ? element.parentIds[0] : undefined;
2936
+ let historyItemChanges = historyItemChangesMap.get(`${element.id}/${historyItemParentId}`);
2863
2937
  if (!historyItemChanges) {
2864
- historyItemChanges = (await historyProvider.provideHistoryItemChanges(element.id)) ?? [];
2938
+ const historyItemParentId = element.parentIds.length > 0 ? element.parentIds[0] : undefined;
2939
+ historyItemChanges = (await historyProvider.provideHistoryItemChanges(element.id, historyItemParentId)) ?? [];
2865
2940
  this.historyProviderCache.set(repository, {
2866
2941
  ...historyProviderCacheEntry,
2867
- historyItemChanges: historyItemChangesMap.set(element.id, historyItemChanges)
2942
+ historyItemChanges: historyItemChangesMap.set(`${element.id}/${historyItemParentId}`, historyItemChanges)
2868
2943
  });
2869
2944
  }
2870
2945
  if (this.viewMode() === "list" ) {
@@ -2922,6 +2997,15 @@ let SCMTreeDataSource = class SCMTreeDataSource {
2922
2997
  throw new Error('Unexpected call to getParent');
2923
2998
  }
2924
2999
  }
3000
+ getConfiguration() {
3001
+ return {
3002
+ alwaysShowRepositories: this.configurationService.getValue('scm.alwaysShowRepositories'),
3003
+ showActionButton: this.configurationService.getValue('scm.showActionButton'),
3004
+ showChangesSummary: this.configurationService.getValue('scm.showChangesSummary'),
3005
+ showIncomingChanges: this.configurationService.getValue('scm.showIncomingChanges'),
3006
+ showOutgoingChanges: this.configurationService.getValue('scm.showOutgoingChanges')
3007
+ };
3008
+ }
2925
3009
  onDidChangeVisibleRepositories({ added, removed }) {
2926
3010
  for (const repository of added) {
2927
3011
  const repositoryDisposables = ( new DisposableStore());
@@ -2937,7 +3021,8 @@ let SCMTreeDataSource = class SCMTreeDataSource {
2937
3021
  }
2938
3022
  getHistoryProviderCacheEntry(repository) {
2939
3023
  return this.historyProviderCache.get(repository) ?? {
2940
- historyItemGroupDetails: undefined,
3024
+ incomingHistoryItemGroup: undefined,
3025
+ outgoingHistoryItemGroup: undefined,
2941
3026
  historyItems: ( new Map()),
2942
3027
  historyItemChanges: ( new Map())
2943
3028
  };
@@ -2948,8 +3033,9 @@ let SCMTreeDataSource = class SCMTreeDataSource {
2948
3033
  }
2949
3034
  };
2950
3035
  SCMTreeDataSource = ( __decorate([
2951
- ( __param(5, ISCMViewService)),
2952
- ( __param(6, IUriIdentityService))
3036
+ ( __param(1, IConfigurationService)),
3037
+ ( __param(2, ISCMViewService)),
3038
+ ( __param(3, IUriIdentityService))
2953
3039
  ], SCMTreeDataSource));
2954
3040
  class SCMActionButton {
2955
3041
  constructor(container, contextMenuService, commandService, notificationService) {