@codingame/monaco-vscode-scm-service-override 5.3.0 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,8 +4,8 @@ import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
4
4
  import { basename, dirname } from 'vscode/vscode/vs/base/common/resources';
5
5
  import { Disposable, DisposableStore, toDisposable, combinedDisposable, MutableDisposable, dispose, DisposableMap } from 'vscode/vscode/vs/base/common/lifecycle';
6
6
  import { ViewAction, ViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
7
- import { append, $, asCSSUrl, prepend, Dimension, trackFocus, isPointerEvent, clearNode } from 'vscode/vscode/vs/base/browser/dom';
8
- import { VIEW_PANE_ID, SCMInputChangeReason } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm';
7
+ import { append, $, asCSSUrl, prepend, Dimension, trackFocus, isPointerEvent, isActiveElement, clearNode } from 'vscode/vscode/vs/base/browser/dom';
8
+ import { VIEW_PANE_ID, ISCMRepositorySortKey, InputValidationType, SCMInputChangeReason } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm';
9
9
  import { ISCMViewService, ISCMService } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm.service';
10
10
  import { ResourceLabels } from 'vscode/vscode/vs/workbench/browser/labels';
11
11
  import { CountBadge } from 'vscode/vscode/vs/base/browser/ui/countBadge/countBadge';
@@ -23,6 +23,7 @@ import { ActionBar } from 'vscode/vscode/vs/base/browser/ui/actionbar/actionbar'
23
23
  import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService.service';
24
24
  import { isSCMResource, connectPrimaryMenuToInlineActionBar, connectPrimaryMenu, isSCMInput, isSCMActionButton, isSCMRepository, isSCMResourceGroup, isSCMResourceNode, isSCMHistoryItemGroupTreeElement, isSCMHistoryItemTreeElement, isSCMHistoryItemChangeTreeElement, isSCMHistoryItemChangeNode, isSCMViewSeparator, getActionViewItemProvider, toDiffEditorArguments, collectContextMenuActions, isSCMViewService } from './util.js';
25
25
  import { WorkbenchCompressibleAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
26
+ import { ConfigurationTarget } from 'vscode/vscode/vs/platform/configuration/common/configuration';
26
27
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
27
28
  import { disposableTimeout, ThrottledDelayer, Sequencer, Throttler } from 'vscode/vscode/vs/base/common/async';
28
29
  import { ResourceTree } from 'vscode/vscode/vs/base/common/resourceTree';
@@ -31,9 +32,10 @@ import { URI } from 'vscode/vscode/vs/base/common/uri';
31
32
  import { FileKind } from 'vscode/vscode/vs/platform/files/common/files';
32
33
  import { comparePaths, compareFileNames } from 'vscode/vscode/vs/base/common/comparers';
33
34
  import { createMatches } from 'vscode/vscode/vs/base/common/filters';
35
+ import { ViewContainerLocation } from 'vscode/vscode/vs/workbench/common/views';
34
36
  import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views.service';
35
37
  import { localizeWithPath } from 'vscode/vscode/vs/nls';
36
- import { flatten } from 'vscode/vscode/vs/base/common/arrays';
38
+ import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
37
39
  import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
38
40
  import { EditorResourceAccessor, SideBySideEditor } from 'vscode/vscode/vs/workbench/common/editor';
39
41
  import { PANEL_BACKGROUND, SIDE_BAR_BACKGROUND } from 'vscode/vscode/vs/workbench/common/theme';
@@ -54,11 +56,12 @@ import { ColorDetector } from 'vscode/vscode/vs/editor/contrib/colorPicker/brows
54
56
  import { LinkDetector } from 'vscode/vscode/vs/editor/contrib/links/browser/links';
55
57
  import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener.service';
56
58
  import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
57
- import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
58
59
  import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label.service';
60
+ import { KeyCode } from 'vscode/vscode/vs/base/common/keyCodes';
59
61
  import { DEFAULT_FONT_FAMILY } from 'vscode/vscode/vs/base/browser/fonts';
60
62
  import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
61
63
  import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
64
+ import { AnchorAlignment } from 'vscode/vscode/vs/base/browser/ui/contextview/contextview';
62
65
  import { RepositoryRenderer, RepositoryActionRunner } from './scmRepositoryRenderer.js';
63
66
  import { ColorScheme } from 'vscode/vscode/vs/platform/theme/common/theme';
64
67
  import { API_OPEN_EDITOR_COMMAND_ID, API_OPEN_DIFF_EDITOR_COMMAND_ID } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorCommands';
@@ -74,12 +77,11 @@ import { MessageController } from 'vscode/vscode/vs/editor/contrib/message/brows
74
77
  import { defaultCountBadgeStyles, defaultButtonStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
75
78
  import { InlineCompletionsController } from 'vscode/vscode/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsController';
76
79
  import { CodeActionController } from 'vscode/vscode/vs/editor/contrib/codeAction/browser/codeActionController';
77
- import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
78
80
  import { Schemas } from 'vscode/vscode/vs/base/common/network';
79
81
  import { fillEditorsDragData } from 'vscode/vscode/vs/workbench/browser/dnd';
80
82
  import { CodeDataTransfers } from 'vscode/vscode/vs/platform/dnd/browser/dnd';
81
83
  import { FormatOnType } from 'vscode/vscode/vs/editor/contrib/format/browser/formatActions';
82
- import { EditorOptions } from 'vscode/vscode/vs/editor/common/config/editorOptions';
84
+ import { EditorOptions, EditorOption } from 'vscode/vscode/vs/editor/common/config/editorOptions';
83
85
  import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
84
86
  import { EditOperation } from 'vscode/vscode/vs/editor/common/core/editOperation';
85
87
  import { stripIcons } from 'vscode/vscode/vs/base/common/iconLabels';
@@ -98,7 +100,7 @@ import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
98
100
  import { WorkbenchToolBar, MenuWorkbenchToolBar } from 'vscode/vscode/vs/platform/actions/browser/toolbar';
99
101
  import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
100
102
  import { DropdownWithPrimaryActionViewItem } from 'vscode/vscode/vs/platform/actions/browser/dropdownWithPrimaryActionViewItem';
101
- import { clamp } from 'vscode/vscode/vs/base/common/numbers';
103
+ import { clamp, rot } from 'vscode/vscode/vs/base/common/numbers';
102
104
  import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
103
105
  import { getDefaultHoverDelegate } from 'vscode/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
104
106
  import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
@@ -200,30 +202,15 @@ let ActionButtonRenderer = class ActionButtonRenderer {
200
202
  const disposables = ( (new DisposableStore()));
201
203
  const actionButton = node.element;
202
204
  templateData.actionButton.setButton(node.element.button);
203
- const renderedActionButtons = this.actionButtons.get(actionButton) ?? [];
204
- this.actionButtons.set(actionButton, [...renderedActionButtons, templateData.actionButton]);
205
- disposables.add({
206
- dispose: () => {
207
- const renderedActionButtons = this.actionButtons.get(actionButton) ?? [];
208
- const renderedWidgetIndex = renderedActionButtons.findIndex(renderedActionButton => renderedActionButton === templateData.actionButton);
209
- if (renderedWidgetIndex < 0) {
210
- throw ( (new Error('Disposing unknown action button')));
211
- }
212
- if (renderedActionButtons.length === 1) {
213
- this.actionButtons.delete(actionButton);
214
- }
215
- else {
216
- renderedActionButtons.splice(renderedWidgetIndex, 1);
217
- }
218
- }
219
- });
205
+ this.actionButtons.set(actionButton, templateData.actionButton);
206
+ disposables.add({ dispose: () => this.actionButtons.delete(actionButton) });
220
207
  templateData.disposable = disposables;
221
208
  }
222
209
  renderCompressedElements() {
223
210
  throw ( (new Error('Should never happen since node is incompressible')));
224
211
  }
225
212
  focusActionButton(actionButton) {
226
- this.actionButtons.get(actionButton)?.forEach(renderedActionButton => renderedActionButton.focus());
213
+ this.actionButtons.get(actionButton)?.focus();
227
214
  }
228
215
  disposeElement(node, index, template) {
229
216
  template.disposable.dispose();
@@ -309,23 +296,10 @@ let InputRenderer = class InputRenderer {
309
296
  }
310
297
  renderElement(node, index, templateData) {
311
298
  const input = node.element;
312
- templateData.inputWidget.setInput(input);
313
- const renderedWidgets = this.inputWidgets.get(input) ?? [];
314
- this.inputWidgets.set(input, [...renderedWidgets, templateData.inputWidget]);
299
+ templateData.inputWidget.input = input;
300
+ this.inputWidgets.set(input, templateData.inputWidget);
315
301
  templateData.elementDisposables.add({
316
- dispose: () => {
317
- const renderedWidgets = this.inputWidgets.get(input) ?? [];
318
- const renderedWidgetIndex = renderedWidgets.findIndex(renderedWidget => renderedWidget === templateData.inputWidget);
319
- if (renderedWidgetIndex < 0) {
320
- throw ( (new Error('Disposing unknown input widget')));
321
- }
322
- if (renderedWidgets.length === 1) {
323
- this.inputWidgets.delete(input);
324
- }
325
- else {
326
- renderedWidgets.splice(renderedWidgetIndex, 1);
327
- }
328
- }
302
+ dispose: () => this.inputWidgets.delete(input)
329
303
  });
330
304
  const selections = this.editorSelections.get(input);
331
305
  if (selections) {
@@ -372,20 +346,16 @@ let InputRenderer = class InputRenderer {
372
346
  return this.inputWidgets.get(input);
373
347
  }
374
348
  getFocusedInput() {
375
- for (const [input, inputWidgets] of this.inputWidgets) {
376
- for (const inputWidget of inputWidgets) {
377
- if (inputWidget.hasFocus()) {
378
- return input;
379
- }
349
+ for (const [input, inputWidget] of this.inputWidgets) {
350
+ if (inputWidget.hasFocus()) {
351
+ return input;
380
352
  }
381
353
  }
382
354
  return undefined;
383
355
  }
384
356
  clearValidation() {
385
- for (const [, inputWidgets] of this.inputWidgets) {
386
- for (const inputWidget of inputWidgets) {
387
- inputWidget.clearValidation();
388
- }
357
+ for (const [, inputWidget] of this.inputWidgets) {
358
+ inputWidget.clearValidation();
389
359
  }
390
360
  }
391
361
  };
@@ -446,7 +416,7 @@ class RepositoryPaneActionRunner extends ActionRunner {
446
416
  const selection = this.getSelectedResources();
447
417
  const contextIsSelected = ( (selection.some(s => s === context)));
448
418
  const actualContext = contextIsSelected ? selection : [context];
449
- const args = flatten(( (actualContext.map(e => ResourceTree.isResourceNode(e) ? ResourceTree.collect(e) : [e]))));
419
+ const args = ( (actualContext.map(e => ResourceTree.isResourceNode(e) ? ResourceTree.collect(e) : [e]))).flat();
450
420
  await action.run(...args);
451
421
  }
452
422
  }
@@ -486,7 +456,7 @@ let ResourceRenderer = class ResourceRenderer {
486
456
  const uri = ResourceTree.isResourceNode(resourceOrFolder) ? resourceOrFolder.uri : resourceOrFolder.sourceUri;
487
457
  const fileKind = ResourceTree.isResourceNode(resourceOrFolder) ? FileKind.FOLDER : FileKind.FILE;
488
458
  const tooltip = !ResourceTree.isResourceNode(resourceOrFolder) && resourceOrFolder.decorations.tooltip || '';
489
- const hidePath = this.viewMode() === "tree" ;
459
+ const hidePath = this.viewMode() === ViewMode.Tree;
490
460
  let matches;
491
461
  let descriptionMatches;
492
462
  let strikethrough;
@@ -843,7 +813,7 @@ let HistoryItemChangeRenderer = class HistoryItemChangeRenderer {
843
813
  const historyItemChangeOrFolder = node.element;
844
814
  const uri = ResourceTree.isResourceNode(historyItemChangeOrFolder) ? historyItemChangeOrFolder.element?.uri ?? historyItemChangeOrFolder.uri : historyItemChangeOrFolder.uri;
845
815
  const fileKind = ResourceTree.isResourceNode(historyItemChangeOrFolder) ? FileKind.FOLDER : FileKind.FILE;
846
- const hidePath = this.viewMode() === "tree" ;
816
+ const hidePath = this.viewMode() === ViewMode.Tree;
847
817
  let matches;
848
818
  let descriptionMatches;
849
819
  if (ResourceTree.isResourceNode(historyItemChangeOrFolder)) {
@@ -1033,7 +1003,7 @@ class SCMTreeSorter {
1033
1003
  return 0;
1034
1004
  }
1035
1005
  if (isSCMHistoryItemChangeTreeElement(one) || isSCMHistoryItemChangeNode(one)) {
1036
- if (this.viewMode() === "list" ) {
1006
+ if (this.viewMode() === ViewMode.List) {
1037
1007
  if (!isSCMHistoryItemChangeTreeElement(other)) {
1038
1008
  throw ( (new Error('Invalid comparison')));
1039
1009
  }
@@ -1046,13 +1016,13 @@ class SCMTreeSorter {
1046
1016
  const otherName = isSCMHistoryItemChangeNode(other) ? other.name : basename(other.uri);
1047
1017
  return compareFileNames(oneName, otherName);
1048
1018
  }
1049
- if (this.viewMode() === "list" ) {
1050
- if (this.viewSortKey() === "name" ) {
1019
+ if (this.viewMode() === ViewMode.List) {
1020
+ if (this.viewSortKey() === ViewSortKey.Name) {
1051
1021
  const oneName = basename(one.sourceUri);
1052
1022
  const otherName = basename(other.sourceUri);
1053
1023
  return compareFileNames(oneName, otherName);
1054
1024
  }
1055
- if (this.viewSortKey() === "status" ) {
1025
+ if (this.viewSortKey() === ViewSortKey.Status) {
1056
1026
  const oneTooltip = one.decorations.tooltip ?? '';
1057
1027
  const otherTooltip = other.decorations.tooltip ?? '';
1058
1028
  if (oneTooltip !== otherTooltip) {
@@ -1098,7 +1068,7 @@ let SCMTreeKeyboardNavigationLabelProvider = class SCMTreeKeyboardNavigationLabe
1098
1068
  return element.label;
1099
1069
  }
1100
1070
  else {
1101
- if (this.viewMode() === "list" ) {
1071
+ if (this.viewMode() === ViewMode.List) {
1102
1072
  const uri = isSCMResource(element) ? element.sourceUri : element.uri;
1103
1073
  return [basename(uri), this.labelService.getUriLabel(uri, { relative: true })];
1104
1074
  }
@@ -1232,14 +1202,25 @@ let SCMAccessibilityProvider = class SCMAccessibilityProvider {
1232
1202
  SCMAccessibilityProvider = ( (__decorate([
1233
1203
  ( (__param(0, ILabelService)))
1234
1204
  ], SCMAccessibilityProvider)));
1205
+ var ViewMode;
1206
+ ( ((function(ViewMode) {
1207
+ ViewMode["List"] = "list";
1208
+ ViewMode["Tree"] = "tree";
1209
+ })(ViewMode || (ViewMode = {}))));
1210
+ var ViewSortKey;
1211
+ ( ((function(ViewSortKey) {
1212
+ ViewSortKey["Path"] = "path";
1213
+ ViewSortKey["Name"] = "name";
1214
+ ViewSortKey["Status"] = "status";
1215
+ })(ViewSortKey || (ViewSortKey = {}))));
1235
1216
  const Menus = {
1236
1217
  ViewSort: ( (new MenuId('SCMViewSort'))),
1237
1218
  Repositories: ( (new MenuId('SCMRepositories'))),
1238
1219
  ChangesSettings: ( (new MenuId('SCMChangesSettings'))),
1239
1220
  };
1240
1221
  const ContextKeys = {
1241
- SCMViewMode: ( (new RawContextKey('scmViewMode', "list" ))),
1242
- SCMViewSortKey: ( (new RawContextKey('scmViewSortKey', "path" ))),
1222
+ SCMViewMode: ( (new RawContextKey('scmViewMode', ViewMode.List))),
1223
+ SCMViewSortKey: ( (new RawContextKey('scmViewSortKey', ViewSortKey.Path))),
1243
1224
  SCMViewAreAllRepositoriesCollapsed: ( (new RawContextKey('scmViewAreAllRepositoriesCollapsed', false))),
1244
1225
  SCMViewIsAnyRepositoryCollapsible: ( (new RawContextKey('scmViewIsAnyRepositoryCollapsible', false))),
1245
1226
  SCMProvider: ( (new RawContextKey('scmProvider', undefined))),
@@ -1493,12 +1474,12 @@ class SetListViewModeAction extends ViewAction {
1493
1474
  viewId: VIEW_PANE_ID,
1494
1475
  f1: false,
1495
1476
  icon: Codicon.listTree,
1496
- toggled: ( (ContextKeys.SCMViewMode.isEqualTo("list" ))),
1477
+ toggled: ( (ContextKeys.SCMViewMode.isEqualTo(ViewMode.List))),
1497
1478
  menu: { id: Menus.ViewSort, group: '1_viewmode', ...menu }
1498
1479
  });
1499
1480
  }
1500
1481
  async runInView(_, view) {
1501
- view.viewMode = "list" ;
1482
+ view.viewMode = ViewMode.List;
1502
1483
  }
1503
1484
  }
1504
1485
  class SetListViewModeNavigationAction extends SetListViewModeAction {
@@ -1508,7 +1489,7 @@ class SetListViewModeNavigationAction extends SetListViewModeAction {
1508
1489
  when: ( (ContextKeyExpr.and(
1509
1490
  (ContextKeyExpr.equals('view', VIEW_PANE_ID)),
1510
1491
  (ContextKeys.RepositoryCount.notEqualsTo(0)),
1511
- (ContextKeys.SCMViewMode.isEqualTo("tree" ))
1492
+ (ContextKeys.SCMViewMode.isEqualTo(ViewMode.Tree))
1512
1493
  ))),
1513
1494
  group: 'navigation',
1514
1495
  order: -1000
@@ -1523,12 +1504,12 @@ class SetTreeViewModeAction extends ViewAction {
1523
1504
  viewId: VIEW_PANE_ID,
1524
1505
  f1: false,
1525
1506
  icon: Codicon.listFlat,
1526
- toggled: ( (ContextKeys.SCMViewMode.isEqualTo("tree" ))),
1507
+ toggled: ( (ContextKeys.SCMViewMode.isEqualTo(ViewMode.Tree))),
1527
1508
  menu: { id: Menus.ViewSort, group: '1_viewmode', ...menu }
1528
1509
  });
1529
1510
  }
1530
1511
  async runInView(_, view) {
1531
- view.viewMode = "tree" ;
1512
+ view.viewMode = ViewMode.Tree;
1532
1513
  }
1533
1514
  }
1534
1515
  class SetTreeViewModeNavigationAction extends SetTreeViewModeAction {
@@ -1538,7 +1519,7 @@ class SetTreeViewModeNavigationAction extends SetTreeViewModeAction {
1538
1519
  when: ( (ContextKeyExpr.and(
1539
1520
  (ContextKeyExpr.equals('view', VIEW_PANE_ID)),
1540
1521
  (ContextKeys.RepositoryCount.notEqualsTo(0)),
1541
- (ContextKeys.SCMViewMode.isEqualTo("list" ))
1522
+ (ContextKeys.SCMViewMode.isEqualTo(ViewMode.List))
1542
1523
  ))),
1543
1524
  group: 'navigation',
1544
1525
  order: -1000
@@ -1576,17 +1557,17 @@ class RepositorySortAction extends ViewAction {
1576
1557
  }
1577
1558
  class RepositorySortByDiscoveryTimeAction extends RepositorySortAction {
1578
1559
  constructor() {
1579
- super("discoveryTime" , ( localizeWithPath(_moduleId, 23, "Sort by Discovery Time")));
1560
+ super(ISCMRepositorySortKey.DiscoveryTime, ( localizeWithPath(_moduleId, 23, "Sort by Discovery Time")));
1580
1561
  }
1581
1562
  }
1582
1563
  class RepositorySortByNameAction extends RepositorySortAction {
1583
1564
  constructor() {
1584
- super("name" , ( localizeWithPath(_moduleId, 24, "Sort by Name")));
1565
+ super(ISCMRepositorySortKey.Name, ( localizeWithPath(_moduleId, 24, "Sort by Name")));
1585
1566
  }
1586
1567
  }
1587
1568
  class RepositorySortByPathAction extends RepositorySortAction {
1588
1569
  constructor() {
1589
- super("path" , ( localizeWithPath(_moduleId, 25, "Sort by Path")));
1570
+ super(ISCMRepositorySortKey.Path, ( localizeWithPath(_moduleId, 25, "Sort by Path")));
1590
1571
  }
1591
1572
  }
1592
1573
  registerAction2(RepositorySortByDiscoveryTimeAction);
@@ -1600,7 +1581,7 @@ class SetSortKeyAction extends ViewAction {
1600
1581
  viewId: VIEW_PANE_ID,
1601
1582
  f1: false,
1602
1583
  toggled: ( (ContextKeys.SCMViewSortKey.isEqualTo(sortKey))),
1603
- precondition: ( (ContextKeys.SCMViewMode.isEqualTo("list" ))),
1584
+ precondition: ( (ContextKeys.SCMViewMode.isEqualTo(ViewMode.List))),
1604
1585
  menu: { id: Menus.ViewSort, group: '2_sort' }
1605
1586
  });
1606
1587
  this.sortKey = sortKey;
@@ -1611,17 +1592,17 @@ class SetSortKeyAction extends ViewAction {
1611
1592
  }
1612
1593
  class SetSortByNameAction extends SetSortKeyAction {
1613
1594
  constructor() {
1614
- super("name" , ( localizeWithPath(_moduleId, 26, "Sort Changes by Name")));
1595
+ super(ViewSortKey.Name, ( localizeWithPath(_moduleId, 26, "Sort Changes by Name")));
1615
1596
  }
1616
1597
  }
1617
1598
  class SetSortByPathAction extends SetSortKeyAction {
1618
1599
  constructor() {
1619
- super("path" , ( localizeWithPath(_moduleId, 27, "Sort Changes by Path")));
1600
+ super(ViewSortKey.Path, ( localizeWithPath(_moduleId, 27, "Sort Changes by Path")));
1620
1601
  }
1621
1602
  }
1622
1603
  class SetSortByStatusAction extends SetSortKeyAction {
1623
1604
  constructor() {
1624
- super("status" , ( localizeWithPath(_moduleId, 28, "Sort Changes by Status")));
1605
+ super(ViewSortKey.Status, ( localizeWithPath(_moduleId, 28, "Sort Changes by Status")));
1625
1606
  }
1626
1607
  }
1627
1608
  registerAction2(SetSortByNameAction);
@@ -1675,6 +1656,14 @@ class ExpandAllRepositoriesAction extends ViewAction {
1675
1656
  }
1676
1657
  registerAction2(CollapseAllRepositoriesAction);
1677
1658
  registerAction2(ExpandAllRepositoriesAction);
1659
+ var SCMInputWidgetCommandId;
1660
+ ( ((function(SCMInputWidgetCommandId) {
1661
+ SCMInputWidgetCommandId["CancelAction"] = "scm.input.cancelAction";
1662
+ })(SCMInputWidgetCommandId || (SCMInputWidgetCommandId = {}))));
1663
+ var SCMInputWidgetStorageKey;
1664
+ ( ((function(SCMInputWidgetStorageKey) {
1665
+ SCMInputWidgetStorageKey["LastActionId"] = "scm.input.lastActionId";
1666
+ })(SCMInputWidgetStorageKey || (SCMInputWidgetStorageKey = {}))));
1678
1667
  let SCMInputWidgetActionRunner = class SCMInputWidgetActionRunner extends ActionRunner {
1679
1668
  get runningActions() { return this._runningActions; }
1680
1669
  constructor(input, storageService) {
@@ -1687,7 +1676,7 @@ let SCMInputWidgetActionRunner = class SCMInputWidgetActionRunner extends Action
1687
1676
  try {
1688
1677
  if (this.runningActions.size !== 0) {
1689
1678
  this._cts?.cancel();
1690
- if (action.id === "scm.input.cancelAction" ) {
1679
+ if (action.id === SCMInputWidgetCommandId.CancelAction) {
1691
1680
  return;
1692
1681
  }
1693
1682
  }
@@ -1705,7 +1694,7 @@ let SCMInputWidgetActionRunner = class SCMInputWidgetActionRunner extends Action
1705
1694
  finally {
1706
1695
  this._runningActions.delete(action);
1707
1696
  if (this._runningActions.size === 0) {
1708
- this.storageService.store("scm.input.lastActionId" , action.id, 0 , 0 );
1697
+ this.storageService.store(SCMInputWidgetStorageKey.LastActionId, action.id, StorageScope.PROFILE, StorageTarget.USER);
1709
1698
  }
1710
1699
  }
1711
1700
  }
@@ -1727,7 +1716,7 @@ let SCMInputWidgetToolbar = class SCMInputWidgetToolbar extends WorkbenchToolBar
1727
1716
  this.repositoryDisposables = ( (new DisposableStore()));
1728
1717
  this._dropdownAction = ( (new Action('scmInputMoreActions', ( localizeWithPath(_moduleId, 31, "More Actions...")), 'codicon-chevron-down')));
1729
1718
  this._cancelAction = ( (new MenuItemAction({
1730
- id: "scm.input.cancelAction" ,
1719
+ id: SCMInputWidgetCommandId.CancelAction,
1731
1720
  title: ( localizeWithPath(_moduleId, 32, "Cancel")),
1732
1721
  icon: Codicon.debugStop,
1733
1722
  }, undefined, undefined, undefined, undefined, contextKeyService, commandService)));
@@ -1757,7 +1746,7 @@ let SCMInputWidgetToolbar = class SCMInputWidgetToolbar extends WorkbenchToolBar
1757
1746
  primaryAction = actions[0];
1758
1747
  }
1759
1748
  else if (actions.length > 1) {
1760
- const lastActionId = this.storageService.get("scm.input.lastActionId" , 0 , '');
1749
+ const lastActionId = this.storageService.get(SCMInputWidgetStorageKey.LastActionId, StorageScope.PROFILE, '');
1761
1750
  primaryAction = actions.find(a => a.id === lastActionId) ?? actions[0];
1762
1751
  }
1763
1752
  this._dropdownActions = actions.length === 1 ? [] : actions;
@@ -1766,7 +1755,7 @@ let SCMInputWidgetToolbar = class SCMInputWidgetToolbar extends WorkbenchToolBar
1766
1755
  };
1767
1756
  this.repositoryDisposables.add(menu.onDidChange(() => updateToolbar()));
1768
1757
  this.repositoryDisposables.add(input.repository.provider.onDidChangeResources(() => updateToolbar()));
1769
- this.repositoryDisposables.add(this.storageService.onDidChangeValue(0 , "scm.input.lastActionId" , this.repositoryDisposables)(() => updateToolbar()));
1758
+ this.repositoryDisposables.add(this.storageService.onDidChangeValue(StorageScope.PROFILE, SCMInputWidgetStorageKey.LastActionId, this.repositoryDisposables)(() => updateToolbar()));
1770
1759
  this.actionRunner = ( (new SCMInputWidgetActionRunner(input, this.storageService)));
1771
1760
  this.repositoryDisposables.add(this.actionRunner.onWillRun(e => {
1772
1761
  if (this.actionRunner.runningActions.size === 0) {
@@ -1875,14 +1864,14 @@ class SCMInputWidgetEditorOptions {
1875
1864
  let SCMInputWidget = class SCMInputWidget {
1876
1865
  static { SCMInputWidget_1 = this; }
1877
1866
  static { this.ValidationTimeouts = {
1878
- [2 ]: 5000,
1879
- [1 ]: 8000,
1880
- [0 ]: 10000
1867
+ [InputValidationType.Information]: 5000,
1868
+ [InputValidationType.Warning]: 8000,
1869
+ [InputValidationType.Error]: 10000
1881
1870
  }; }
1882
1871
  get input() {
1883
1872
  return this.model?.input;
1884
1873
  }
1885
- async setInput(input) {
1874
+ set input(input) {
1886
1875
  if (input === this.input) {
1887
1876
  return;
1888
1877
  }
@@ -1891,25 +1880,15 @@ let SCMInputWidget = class SCMInputWidget {
1891
1880
  this.repositoryDisposables.clear();
1892
1881
  this.repositoryIdContextKey.set(input?.repository.id);
1893
1882
  if (!input) {
1894
- this.model?.textModelRef?.dispose();
1895
1883
  this.inputEditor.setModel(undefined);
1896
1884
  this.model = undefined;
1897
1885
  return;
1898
1886
  }
1899
- const uri = input.repository.provider.inputBoxDocumentUri;
1900
- if (this.configurationService.getValue('editor.wordBasedSuggestions', { resource: uri }) !== 'off') {
1901
- this.configurationService.updateValue('editor.wordBasedSuggestions', 'off', { resource: uri }, 8 );
1902
- }
1903
- const modelValue = { input, textModelRef: undefined };
1904
- this.model = modelValue;
1905
- const modelRef = await this.textModelService.createModelReference(uri);
1906
- if (this.model !== modelValue) {
1907
- modelRef.dispose();
1908
- return;
1909
- }
1910
- modelValue.textModelRef = modelRef;
1911
- const textModel = modelRef.object.textEditorModel;
1887
+ const textModel = input.repository.provider.inputBoxTextModel;
1912
1888
  this.inputEditor.setModel(textModel);
1889
+ if (this.configurationService.getValue('editor.wordBasedSuggestions', { resource: textModel.uri }) !== 'off') {
1890
+ this.configurationService.updateValue('editor.wordBasedSuggestions', 'off', { resource: textModel.uri }, ConfigurationTarget.MEMORY);
1891
+ }
1913
1892
  const validationDelayer = ( (new ThrottledDelayer(200)));
1914
1893
  const validate = async () => {
1915
1894
  const position = this.inputEditor.getSelection()?.getStartPosition();
@@ -1921,7 +1900,7 @@ let SCMInputWidget = class SCMInputWidget {
1921
1900
  this.repositoryDisposables.add(validationDelayer);
1922
1901
  this.repositoryDisposables.add(this.inputEditor.onDidChangeCursorPosition(triggerValidation));
1923
1902
  const opts = this.modelService.getCreationOptions(textModel.getLanguageId(), textModel.uri, textModel.isForSimpleWidget);
1924
- const onEnter = Event.filter(this.inputEditor.onKeyDown, e => e.keyCode === 3 , this.repositoryDisposables);
1903
+ const onEnter = Event.filter(this.inputEditor.onKeyDown, e => e.keyCode === KeyCode.Enter, this.repositoryDisposables);
1925
1904
  this.repositoryDisposables.add(onEnter(() => textModel.detectIndentation(opts.insertSpaces, opts.tabSize)));
1926
1905
  textModel.setValue(input.value);
1927
1906
  this.repositoryDisposables.add(input.onDidChange(({ value, reason }) => {
@@ -1978,6 +1957,7 @@ let SCMInputWidget = class SCMInputWidget {
1978
1957
  this.repositoryDisposables.add(input.onDidChangeEnablement(enabled => updateEnablement(enabled)));
1979
1958
  updateEnablement(input.enabled);
1980
1959
  this.toolbar.setInput(input);
1960
+ this.model = { input, textModel };
1981
1961
  }
1982
1962
  get selections() {
1983
1963
  return this.inputEditor.getSelections();
@@ -2001,9 +1981,8 @@ let SCMInputWidget = class SCMInputWidget {
2001
1981
  this._validationTimer = setTimeout(() => this.setValidation(undefined), SCMInputWidget_1.ValidationTimeouts[validation.type]);
2002
1982
  }
2003
1983
  }
2004
- constructor(container, overflowWidgetsDomNode, contextKeyService, modelService, textModelService, keybindingService, configurationService, instantiationService, scmViewService, contextViewService, openerService, contextMenuService) {
1984
+ constructor(container, overflowWidgetsDomNode, contextKeyService, modelService, keybindingService, configurationService, instantiationService, scmViewService, contextViewService, openerService, contextMenuService) {
2005
1985
  this.modelService = modelService;
2006
- this.textModelService = textModelService;
2007
1986
  this.keybindingService = keybindingService;
2008
1987
  this.configurationService = configurationService;
2009
1988
  this.instantiationService = instantiationService;
@@ -2049,7 +2028,7 @@ let SCMInputWidget = class SCMInputWidget {
2049
2028
  ])
2050
2029
  };
2051
2030
  const services = ( (new ServiceCollection([IContextKeyService, this.contextKeyService])));
2052
- const instantiationService2 = instantiationService.createChild(services);
2031
+ const instantiationService2 = instantiationService.createChild(services, this.disposables);
2053
2032
  this.inputEditor = instantiationService2.createInstance(CodeEditorWidget, this.editorContainer, editorConstructionOptions, codeEditorWidgetOptions);
2054
2033
  this.disposables.add(this.inputEditor);
2055
2034
  this.disposables.add(this.inputEditor.onDidFocusEditorText(() => {
@@ -2101,8 +2080,8 @@ let SCMInputWidget = class SCMInputWidget {
2101
2080
  this.disposables.add(this.toolbar);
2102
2081
  }
2103
2082
  getContentHeight() {
2104
- const lineHeight = this.inputEditor.getOption(67 );
2105
- const { top, bottom } = this.inputEditor.getOption(84 );
2083
+ const lineHeight = this.inputEditor.getOption(EditorOption.lineHeight);
2084
+ const { top, bottom } = this.inputEditor.getOption(EditorOption.padding);
2106
2085
  const inputMinLinesConfig = this.configurationService.getValue('scm.inputMinLineCount');
2107
2086
  const inputMinLines = typeof inputMinLinesConfig === 'number' ? clamp(inputMinLinesConfig, 1, 50) : 1;
2108
2087
  const editorMinHeight = inputMinLines * lineHeight + top + bottom;
@@ -2149,9 +2128,9 @@ let SCMInputWidget = class SCMInputWidget {
2149
2128
  }
2150
2129
  renderValidation() {
2151
2130
  this.clearValidation();
2152
- this.element.classList.toggle('validation-info', this.validation?.type === 2 );
2153
- this.element.classList.toggle('validation-warning', this.validation?.type === 1 );
2154
- this.element.classList.toggle('validation-error', this.validation?.type === 0 );
2131
+ this.element.classList.toggle('validation-info', this.validation?.type === InputValidationType.Information);
2132
+ this.element.classList.toggle('validation-warning', this.validation?.type === InputValidationType.Warning);
2133
+ this.element.classList.toggle('validation-error', this.validation?.type === InputValidationType.Error);
2155
2134
  if (!this.validation || !this.inputEditor.hasTextFocus()) {
2156
2135
  return;
2157
2136
  }
@@ -2162,9 +2141,9 @@ let SCMInputWidget = class SCMInputWidget {
2162
2141
  this.element.style.borderBottomLeftRadius = '0';
2163
2142
  this.element.style.borderBottomRightRadius = '0';
2164
2143
  const validationContainer = append(container, $('.scm-editor-validation-container'));
2165
- validationContainer.classList.toggle('validation-info', this.validation.type === 2 );
2166
- validationContainer.classList.toggle('validation-warning', this.validation.type === 1 );
2167
- validationContainer.classList.toggle('validation-error', this.validation.type === 0 );
2144
+ validationContainer.classList.toggle('validation-info', this.validation.type === InputValidationType.Information);
2145
+ validationContainer.classList.toggle('validation-warning', this.validation.type === InputValidationType.Warning);
2146
+ validationContainer.classList.toggle('validation-error', this.validation.type === InputValidationType.Error);
2168
2147
  validationContainer.style.width = `${this.element.clientWidth + 2}px`;
2169
2148
  const element = append(validationContainer, $('.scm-editor-validation'));
2170
2149
  const message = this.validation.message;
@@ -2213,7 +2192,7 @@ let SCMInputWidget = class SCMInputWidget {
2213
2192
  this.element.style.borderBottomRightRadius = '2px';
2214
2193
  disposables.dispose();
2215
2194
  },
2216
- anchorAlignment: 0
2195
+ anchorAlignment: AnchorAlignment.LEFT
2217
2196
  });
2218
2197
  }
2219
2198
  getToolbarWidth() {
@@ -2236,7 +2215,7 @@ let SCMInputWidget = class SCMInputWidget {
2236
2215
  this.validationHasFocus = false;
2237
2216
  }
2238
2217
  dispose() {
2239
- this.setInput(undefined);
2218
+ this.input = undefined;
2240
2219
  this.repositoryDisposables.dispose();
2241
2220
  this.clearValidation();
2242
2221
  this.disposables.dispose();
@@ -2245,14 +2224,13 @@ let SCMInputWidget = class SCMInputWidget {
2245
2224
  SCMInputWidget = SCMInputWidget_1 = ( (__decorate([
2246
2225
  ( (__param(2, IContextKeyService))),
2247
2226
  ( (__param(3, IModelService))),
2248
- ( (__param(4, ITextModelService))),
2249
- ( (__param(5, IKeybindingService))),
2250
- ( (__param(6, IConfigurationService))),
2251
- ( (__param(7, IInstantiationService))),
2252
- ( (__param(8, ISCMViewService))),
2253
- ( (__param(9, IContextViewService))),
2254
- ( (__param(10, IOpenerService))),
2255
- ( (__param(11, IContextMenuService)))
2227
+ ( (__param(4, IKeybindingService))),
2228
+ ( (__param(5, IConfigurationService))),
2229
+ ( (__param(6, IInstantiationService))),
2230
+ ( (__param(7, ISCMViewService))),
2231
+ ( (__param(8, IContextViewService))),
2232
+ ( (__param(9, IOpenerService))),
2233
+ ( (__param(10, IContextMenuService)))
2256
2234
  ], SCMInputWidget)));
2257
2235
  let SCMViewPane = class SCMViewPane extends ViewPane {
2258
2236
  get viewMode() { return this._viewMode; }
@@ -2267,7 +2245,7 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2267
2245
  this._onDidChangeViewMode.fire(mode);
2268
2246
  this.viewModeContextKey.set(mode);
2269
2247
  this.updateIndentStyles(this.themeService.getFileIconTheme());
2270
- this.storageService.store(`scm.viewMode`, mode, 1 , 0 );
2248
+ this.storageService.store(`scm.viewMode`, mode, StorageScope.WORKSPACE, StorageTarget.USER);
2271
2249
  }
2272
2250
  get viewSortKey() { return this._viewSortKey; }
2273
2251
  set viewSortKey(sortKey) {
@@ -2278,8 +2256,8 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2278
2256
  this.updateChildren();
2279
2257
  this.viewSortKeyContextKey.set(sortKey);
2280
2258
  this._onDidChangeViewSortKey.fire(sortKey);
2281
- if (this._viewMode === "list" ) {
2282
- this.storageService.store(`scm.viewSortKey`, sortKey, 1 , 0 );
2259
+ if (this._viewMode === ViewMode.List) {
2260
+ this.storageService.store(`scm.viewSortKey`, sortKey, StorageScope.WORKSPACE, StorageTarget.USER);
2283
2261
  }
2284
2262
  }
2285
2263
  constructor(options, commandService, editorService, logService, menuService, scmService, scmViewService, storageService, uriIdentityService, keybindingService, themeService, contextMenuService, instantiationService, viewDescriptorService, configurationService, contextKeyService, openerService, telemetryService, hoverService) {
@@ -2315,7 +2293,7 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2315
2293
  this.scmProviderHasRootUriContextKey = ContextKeys.SCMProviderHasRootUri.bindTo(contextKeyService);
2316
2294
  this._onDidLayout = ( (new Emitter()));
2317
2295
  this.layoutCache = { height: undefined, width: undefined, onDidChange: this._onDidLayout.event };
2318
- this.storageService.onDidChangeValue(1 , undefined, this.disposables)(e => {
2296
+ this.storageService.onDidChangeValue(StorageScope.WORKSPACE, undefined, this.disposables)(e => {
2319
2297
  switch (e.key) {
2320
2298
  case 'scm.viewMode':
2321
2299
  this.viewMode = this.getViewMode();
@@ -2330,7 +2308,6 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2330
2308
  this.viewSortKey = this.getViewSortKey();
2331
2309
  this.storeTreeViewState();
2332
2310
  }, this, this.disposables);
2333
- this.disposables.add(this.instantiationService.createInstance(ScmInputContentProvider));
2334
2311
  Event.any(this.scmService.onDidAddRepository, this.scmService.onDidRemoveRepository)(() => this._onDidChangeViewWelcomeState.fire(), this, this.disposables);
2335
2312
  this.disposables.add(this.revealResourceThrottler);
2336
2313
  this.disposables.add(this.updateChildrenThrottler);
@@ -2367,31 +2344,34 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2367
2344
  this.createTree(this.treeContainer, viewState);
2368
2345
  this.onDidChangeBodyVisibility(async (visible) => {
2369
2346
  if (visible) {
2370
- await this.tree.setInput(this.scmViewService, viewState);
2371
- Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.alwaysShowRepositories'), this.visibilityDisposables)(() => {
2372
- this.updateActions();
2373
- this.updateChildren();
2374
- }, this, this.visibilityDisposables);
2375
- Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.inputMinLineCount') ||
2376
- e.affectsConfiguration('scm.inputMaxLineCount') ||
2377
- e.affectsConfiguration('scm.showActionButton') ||
2378
- e.affectsConfiguration('scm.showChangesSummary') ||
2379
- e.affectsConfiguration('scm.showIncomingChanges') ||
2380
- e.affectsConfiguration('scm.showOutgoingChanges'), this.visibilityDisposables)(() => this.updateChildren(), this, this.visibilityDisposables);
2381
- this.editorService.onDidActiveEditorChange(this.onDidActiveEditorChange, this, this.visibilityDisposables);
2382
- this.scmViewService.onDidChangeVisibleRepositories(this.onDidChangeVisibleRepositories, this, this.visibilityDisposables);
2383
- this.onDidChangeVisibleRepositories({ added: this.scmViewService.visibleRepositories, removed: Iterable.empty() });
2384
- if (typeof this.treeScrollTop === 'number') {
2385
- this.tree.scrollTop = this.treeScrollTop;
2386
- this.treeScrollTop = undefined;
2387
- }
2347
+ this.treeOperationSequencer.queue(async () => {
2348
+ await this.tree.setInput(this.scmViewService, viewState);
2349
+ Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.alwaysShowRepositories'), this.visibilityDisposables)(() => {
2350
+ this.updateActions();
2351
+ this.updateChildren();
2352
+ }, this, this.visibilityDisposables);
2353
+ Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.inputMinLineCount') ||
2354
+ e.affectsConfiguration('scm.inputMaxLineCount') ||
2355
+ e.affectsConfiguration('scm.showActionButton') ||
2356
+ e.affectsConfiguration('scm.showChangesSummary') ||
2357
+ e.affectsConfiguration('scm.showIncomingChanges') ||
2358
+ e.affectsConfiguration('scm.showOutgoingChanges'), this.visibilityDisposables)(() => this.updateChildren(), this, this.visibilityDisposables);
2359
+ this.editorService.onDidActiveEditorChange(this.onDidActiveEditorChange, this, this.visibilityDisposables);
2360
+ this.scmViewService.onDidChangeVisibleRepositories(this.onDidChangeVisibleRepositories, this, this.visibilityDisposables);
2361
+ this.onDidChangeVisibleRepositories({ added: this.scmViewService.visibleRepositories, removed: Iterable.empty() });
2362
+ if (typeof this.treeScrollTop === 'number') {
2363
+ this.tree.scrollTop = this.treeScrollTop;
2364
+ this.treeScrollTop = undefined;
2365
+ }
2366
+ this.updateRepositoryCollapseAllContextKeys();
2367
+ });
2388
2368
  }
2389
2369
  else {
2390
2370
  this.visibilityDisposables.clear();
2391
2371
  this.onDidChangeVisibleRepositories({ added: Iterable.empty(), removed: [...( (this.items.keys()))] });
2392
2372
  this.treeScrollTop = this.tree.scrollTop;
2373
+ this.updateRepositoryCollapseAllContextKeys();
2393
2374
  }
2394
- this.updateRepositoryCollapseAllContextKeys();
2395
2375
  }, this, this.disposables);
2396
2376
  this.disposables.add(this.instantiationService.createInstance(RepositoryVisibilityActionController));
2397
2377
  this.themeService.onDidFileIconThemeChange(this.updateIndentStyles, this, this.disposables);
@@ -2399,7 +2379,12 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2399
2379
  }
2400
2380
  createTree(container, viewState) {
2401
2381
  const overflowWidgetsDomNode = $('.scm-overflow-widgets-container.monaco-editor');
2402
- this.inputRenderer = this.instantiationService.createInstance(InputRenderer, this.layoutCache, overflowWidgetsDomNode, (input, height) => { this.tree.updateElementHeight(input, height); });
2382
+ this.inputRenderer = this.instantiationService.createInstance(InputRenderer, this.layoutCache, overflowWidgetsDomNode, (input, height) => {
2383
+ try {
2384
+ this.tree.updateElementHeight(input, height);
2385
+ }
2386
+ catch { }
2387
+ });
2403
2388
  this.actionButtonRenderer = this.instantiationService.createInstance(ActionButtonRenderer);
2404
2389
  this.listLabels = this.instantiationService.createInstance(ResourceLabels, { onDidChangeVisibility: this.onDidChangeBodyVisibility });
2405
2390
  this.disposables.add(this.listLabels);
@@ -2434,7 +2419,7 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2434
2419
  sorter: ( (new SCMTreeSorter(() => this.viewMode, () => this.viewSortKey))),
2435
2420
  keyboardNavigationLabelProvider: this.instantiationService.createInstance(SCMTreeKeyboardNavigationLabelProvider, () => this.viewMode),
2436
2421
  overrideStyles: {
2437
- listBackground: this.viewDescriptorService.getViewLocationById(this.id) === 1 ? PANEL_BACKGROUND : SIDE_BAR_BACKGROUND
2422
+ listBackground: this.viewDescriptorService.getViewLocationById(this.id) === ViewContainerLocation.Panel ? PANEL_BACKGROUND : SIDE_BAR_BACKGROUND
2438
2423
  },
2439
2424
  collapseByDefault: (e) => {
2440
2425
  if (isSCMRepository(e) || isSCMResourceGroup(e) || isSCMResourceNode(e) || isSCMHistoryItemChangeNode(e)) {
@@ -2461,11 +2446,9 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2461
2446
  }
2462
2447
  else if (isSCMInput(e.element)) {
2463
2448
  this.scmViewService.focus(e.element.repository);
2464
- const widgets = this.inputRenderer.getRenderedInputWidget(e.element);
2465
- if (widgets) {
2466
- for (const widget of widgets) {
2467
- widget.focus();
2468
- }
2449
+ const widget = this.inputRenderer.getRenderedInputWidget(e.element);
2450
+ if (widget) {
2451
+ widget.focus();
2469
2452
  this.tree.setFocus([], e.browserEvent);
2470
2453
  const selection = this.tree.getSelection();
2471
2454
  if (selection.length === 1 && selection[0] === e.element) {
@@ -2575,11 +2558,12 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2575
2558
  }
2576
2559
  for (let j = repository.provider.groups.length - 1; j >= 0; j--) {
2577
2560
  const groupItem = repository.provider.groups[j];
2578
- const resource = this.viewMode === "tree"
2561
+ const resource = this.viewMode === ViewMode.Tree
2579
2562
  ? groupItem.resourceTree.getNode(uri)?.element
2580
2563
  : groupItem.resources.find(r => this.uriIdentityService.extUri.isEqual(r.sourceUri, uri));
2581
2564
  if (resource) {
2582
2565
  await this.tree.expandTo(resource);
2566
+ this.tree.reveal(resource);
2583
2567
  this.tree.setSelection([resource]);
2584
2568
  this.tree.setFocus([resource]);
2585
2569
  return;
@@ -2712,38 +2696,38 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2712
2696
  .filter(r => !!r && !isSCMResourceGroup(r));
2713
2697
  }
2714
2698
  getViewMode() {
2715
- let mode = this.configurationService.getValue('scm.defaultViewMode') === 'list' ? "list" : "tree" ;
2716
- const storageMode = this.storageService.get(`scm.viewMode`, 1 );
2699
+ let mode = this.configurationService.getValue('scm.defaultViewMode') === 'list' ? ViewMode.List : ViewMode.Tree;
2700
+ const storageMode = this.storageService.get(`scm.viewMode`, StorageScope.WORKSPACE);
2717
2701
  if (typeof storageMode === 'string') {
2718
2702
  mode = storageMode;
2719
2703
  }
2720
2704
  return mode;
2721
2705
  }
2722
2706
  getViewSortKey() {
2723
- if (this._viewMode === "tree" ) {
2724
- return "path" ;
2707
+ if (this._viewMode === ViewMode.Tree) {
2708
+ return ViewSortKey.Path;
2725
2709
  }
2726
2710
  let viewSortKey;
2727
2711
  const viewSortKeyString = this.configurationService.getValue('scm.defaultViewSortKey');
2728
2712
  switch (viewSortKeyString) {
2729
2713
  case 'name':
2730
- viewSortKey = "name" ;
2714
+ viewSortKey = ViewSortKey.Name;
2731
2715
  break;
2732
2716
  case 'status':
2733
- viewSortKey = "status" ;
2717
+ viewSortKey = ViewSortKey.Status;
2734
2718
  break;
2735
2719
  default:
2736
- viewSortKey = "path" ;
2720
+ viewSortKey = ViewSortKey.Path;
2737
2721
  break;
2738
2722
  }
2739
- const storageSortKey = this.storageService.get(`scm.viewSortKey`, 1 );
2723
+ const storageSortKey = this.storageService.get(`scm.viewSortKey`, StorageScope.WORKSPACE);
2740
2724
  if (typeof storageSortKey === 'string') {
2741
2725
  viewSortKey = storageSortKey;
2742
2726
  }
2743
2727
  return viewSortKey;
2744
2728
  }
2745
2729
  loadTreeViewState() {
2746
- const storageViewState = this.storageService.get('scm.viewState2', 1 );
2730
+ const storageViewState = this.storageService.get('scm.viewState2', StorageScope.WORKSPACE);
2747
2731
  if (!storageViewState) {
2748
2732
  return undefined;
2749
2733
  }
@@ -2757,7 +2741,7 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2757
2741
  }
2758
2742
  storeTreeViewState() {
2759
2743
  if (this.tree) {
2760
- this.storageService.store('scm.viewState2', JSON.stringify(this.tree.getViewState()), 1 , 1 );
2744
+ this.storageService.store('scm.viewState2', JSON.stringify(this.tree.getViewState()), StorageScope.WORKSPACE, StorageTarget.MACHINE);
2761
2745
  }
2762
2746
  }
2763
2747
  updateChildren(element) {
@@ -2770,17 +2754,17 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2770
2754
  await this.tree.updateChildren(undefined);
2771
2755
  }
2772
2756
  if (focusedInput) {
2773
- this.inputRenderer.getRenderedInputWidget(focusedInput)?.forEach(widget => widget.focus());
2757
+ this.inputRenderer.getRenderedInputWidget(focusedInput)?.focus();
2774
2758
  }
2775
2759
  this.updateScmProviderContextKeys();
2776
2760
  this.updateRepositoryCollapseAllContextKeys();
2777
2761
  }));
2778
2762
  }
2779
2763
  updateIndentStyles(theme) {
2780
- this.treeContainer.classList.toggle('list-view-mode', this.viewMode === "list" );
2781
- this.treeContainer.classList.toggle('tree-view-mode', this.viewMode === "tree" );
2782
- this.treeContainer.classList.toggle('align-icons-and-twisties', (this.viewMode === "list" && theme.hasFileIcons) || (theme.hasFileIcons && !theme.hasFolderIcons));
2783
- this.treeContainer.classList.toggle('hide-arrows', this.viewMode === "tree" && theme.hidesExplorerArrows === true);
2764
+ this.treeContainer.classList.toggle('list-view-mode', this.viewMode === ViewMode.List);
2765
+ this.treeContainer.classList.toggle('tree-view-mode', this.viewMode === ViewMode.Tree);
2766
+ this.treeContainer.classList.toggle('align-icons-and-twisties', (this.viewMode === ViewMode.List && theme.hasFileIcons) || (theme.hasFileIcons && !theme.hasFolderIcons));
2767
+ this.treeContainer.classList.toggle('hide-arrows', this.viewMode === ViewMode.Tree && theme.hidesExplorerArrows === true);
2784
2768
  }
2785
2769
  updateScmProviderContextKeys() {
2786
2770
  const alwaysShowRepositories = this.configurationService.getValue('scm.alwaysShowRepositories');
@@ -2819,6 +2803,73 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2819
2803
  }
2820
2804
  }
2821
2805
  }
2806
+ focusPreviousInput() {
2807
+ this.treeOperationSequencer.queue(() => this.focusInput(-1));
2808
+ }
2809
+ focusNextInput() {
2810
+ this.treeOperationSequencer.queue(() => this.focusInput(1));
2811
+ }
2812
+ async focusInput(delta) {
2813
+ if (!this.scmViewService.focusedRepository ||
2814
+ this.scmViewService.visibleRepositories.length === 0) {
2815
+ return;
2816
+ }
2817
+ let input = this.scmViewService.focusedRepository.input;
2818
+ const repositories = this.scmViewService.visibleRepositories;
2819
+ if (repositories.length === 1 && this.inputRenderer.getRenderedInputWidget(input)?.hasFocus() === true) {
2820
+ return;
2821
+ }
2822
+ if (repositories.length > 1 && this.inputRenderer.getRenderedInputWidget(input)?.hasFocus() === true) {
2823
+ const focusedRepositoryIndex = repositories.indexOf(this.scmViewService.focusedRepository);
2824
+ const newFocusedRepositoryIndex = rot(focusedRepositoryIndex + delta, repositories.length);
2825
+ input = repositories[newFocusedRepositoryIndex].input;
2826
+ }
2827
+ await this.tree.expandTo(input);
2828
+ this.tree.reveal(input);
2829
+ this.inputRenderer.getRenderedInputWidget(input)?.focus();
2830
+ }
2831
+ focusPreviousResourceGroup() {
2832
+ this.treeOperationSequencer.queue(() => this.focusResourceGroup(-1));
2833
+ }
2834
+ focusNextResourceGroup() {
2835
+ this.treeOperationSequencer.queue(() => this.focusResourceGroup(1));
2836
+ }
2837
+ async focusResourceGroup(delta) {
2838
+ if (!this.scmViewService.focusedRepository ||
2839
+ this.scmViewService.visibleRepositories.length === 0) {
2840
+ return;
2841
+ }
2842
+ const treeHasDomFocus = isActiveElement(this.tree.getHTMLElement());
2843
+ const resourceGroups = this.scmViewService.focusedRepository.provider.groups;
2844
+ const focusedResourceGroup = this.tree.getFocus().find(e => isSCMResourceGroup(e));
2845
+ const focusedResourceGroupIndex = treeHasDomFocus && focusedResourceGroup ? resourceGroups.indexOf(focusedResourceGroup) : -1;
2846
+ let resourceGroupNext;
2847
+ if (focusedResourceGroupIndex === -1) {
2848
+ for (const resourceGroup of resourceGroups) {
2849
+ if (this.tree.hasNode(resourceGroup)) {
2850
+ resourceGroupNext = resourceGroup;
2851
+ break;
2852
+ }
2853
+ }
2854
+ }
2855
+ else {
2856
+ let index = rot(focusedResourceGroupIndex + delta, resourceGroups.length);
2857
+ while (index !== focusedResourceGroupIndex) {
2858
+ if (this.tree.hasNode(resourceGroups[index])) {
2859
+ resourceGroupNext = resourceGroups[index];
2860
+ break;
2861
+ }
2862
+ index = rot(index + delta, resourceGroups.length);
2863
+ }
2864
+ }
2865
+ if (resourceGroupNext) {
2866
+ await this.tree.expandTo(resourceGroupNext);
2867
+ this.tree.reveal(resourceGroupNext);
2868
+ this.tree.setSelection([resourceGroupNext]);
2869
+ this.tree.setFocus([resourceGroupNext]);
2870
+ this.tree.domFocus();
2871
+ }
2872
+ }
2822
2873
  shouldShowWelcome() {
2823
2874
  return this.scmService.repositoryCount === 0;
2824
2875
  }
@@ -2827,20 +2878,26 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2827
2878
  }
2828
2879
  focus() {
2829
2880
  super.focus();
2830
- if (this.isExpanded()) {
2831
- if (this.tree.getFocus().length === 0) {
2832
- for (const repository of this.scmViewService.visibleRepositories) {
2833
- const widgets = this.inputRenderer.getRenderedInputWidget(repository.input);
2834
- if (widgets) {
2835
- for (const widget of widgets) {
2836
- widget.focus();
2881
+ this.treeOperationSequencer.queue(() => {
2882
+ return (
2883
+ (new Promise(resolve => {
2884
+ if (this.isExpanded()) {
2885
+ if (this.tree.getFocus().length === 0) {
2886
+ for (const repository of this.scmViewService.visibleRepositories) {
2887
+ const widget = this.inputRenderer.getRenderedInputWidget(repository.input);
2888
+ if (widget) {
2889
+ widget.focus();
2890
+ resolve();
2891
+ return;
2892
+ }
2893
+ }
2837
2894
  }
2838
- return;
2895
+ this.tree.domFocus();
2896
+ resolve();
2839
2897
  }
2840
- }
2841
- }
2842
- this.tree.domFocus();
2843
- }
2898
+ }))
2899
+ );
2900
+ });
2844
2901
  }
2845
2902
  dispose() {
2846
2903
  this.visibilityDisposables.dispose();
@@ -2967,10 +3024,10 @@ let SCMTreeDataSource = class SCMTreeDataSource {
2967
3024
  return children;
2968
3025
  }
2969
3026
  else if (isSCMResourceGroup(inputOrElement)) {
2970
- if (this.viewMode() === "list" ) {
3027
+ if (this.viewMode() === ViewMode.List) {
2971
3028
  return inputOrElement.resources;
2972
3029
  }
2973
- else if (this.viewMode() === "tree" ) {
3030
+ else if (this.viewMode() === ViewMode.Tree) {
2974
3031
  const children = [];
2975
3032
  for (const node of inputOrElement.resourceTree.root.children) {
2976
3033
  children.push(node.element && node.childrenCount === 0 ? node.element : node);
@@ -3111,7 +3168,7 @@ let SCMTreeDataSource = class SCMTreeDataSource {
3111
3168
  historyItemChanges: historyItemChangesMap.set(`${element.id}/${historyItemParentId}`, historyItemChanges)
3112
3169
  });
3113
3170
  }
3114
- if (this.viewMode() === "list" ) {
3171
+ if (this.viewMode() === ViewMode.List) {
3115
3172
  return (
3116
3173
  (historyItemChanges.map(change => ({
3117
3174
  ...change,
@@ -3151,7 +3208,7 @@ let SCMTreeDataSource = class SCMTreeDataSource {
3151
3208
  }
3152
3209
  }
3153
3210
  else if (isSCMResource(element)) {
3154
- if (this.viewMode() === "list" ) {
3211
+ if (this.viewMode() === ViewMode.List) {
3155
3212
  return element.resourceGroup;
3156
3213
  }
3157
3214
  const node = element.resourceGroup.resourceTree.getNode(element.sourceUri);
@@ -3164,6 +3221,16 @@ let SCMTreeDataSource = class SCMTreeDataSource {
3164
3221
  }
3165
3222
  return result;
3166
3223
  }
3224
+ else if (isSCMInput(element)) {
3225
+ return element.repository;
3226
+ }
3227
+ else if (isSCMResourceGroup(element)) {
3228
+ const repository = this.scmViewService.visibleRepositories.find(r => r.provider === element.provider);
3229
+ if (!repository) {
3230
+ throw ( (new Error('Invalid element passed to getParent')));
3231
+ }
3232
+ return repository;
3233
+ }
3167
3234
  else {
3168
3235
  throw ( (new Error('Unexpected call to getParent')));
3169
3236
  }
@@ -3291,25 +3358,5 @@ class SCMActionButton {
3291
3358
  }
3292
3359
  }
3293
3360
  }
3294
- let ScmInputContentProvider = class ScmInputContentProvider extends Disposable {
3295
- constructor(textModelService, _modelService, _languageService) {
3296
- super();
3297
- this._modelService = _modelService;
3298
- this._languageService = _languageService;
3299
- this._register(textModelService.registerTextModelContentProvider(Schemas.vscodeSourceControl, this));
3300
- }
3301
- async provideTextContent(resource) {
3302
- const existing = this._modelService.getModel(resource);
3303
- if (existing) {
3304
- return existing;
3305
- }
3306
- return this._modelService.createModel('', this._languageService.createById('scminput'), resource);
3307
- }
3308
- };
3309
- ScmInputContentProvider = ( (__decorate([
3310
- ( (__param(0, ITextModelService))),
3311
- ( (__param(1, IModelService))),
3312
- ( (__param(2, ILanguageService)))
3313
- ], ScmInputContentProvider)));
3314
3361
 
3315
- export { ActionButtonRenderer, SCMAccessibilityProvider, SCMActionButton, SCMTreeKeyboardNavigationLabelProvider, SCMTreeSorter, SCMViewPane };
3362
+ export { ActionButtonRenderer, ContextKeys, SCMAccessibilityProvider, SCMActionButton, SCMTreeKeyboardNavigationLabelProvider, SCMTreeSorter, SCMViewPane };