@codingame/monaco-vscode-scm-service-override 19.1.3 → 20.0.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.
Files changed (23) hide show
  1. package/package.json +13 -15
  2. package/vscode/src/vs/workbench/contrib/scm/browser/activity.js +12 -8
  3. package/vscode/src/vs/workbench/contrib/scm/browser/media/scm.css +7 -10
  4. package/vscode/src/vs/workbench/contrib/scm/browser/menus.d.ts +7 -4
  5. package/vscode/src/vs/workbench/contrib/scm/browser/menus.js +57 -12
  6. package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffDecorator.js +4 -4
  7. package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffModel.d.ts +1 -1
  8. package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffModel.js +1 -1
  9. package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffWidget.d.ts +1 -1
  10. package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffWidget.js +14 -14
  11. package/vscode/src/vs/workbench/contrib/scm/browser/scm.contribution.js +85 -90
  12. package/vscode/src/vs/workbench/contrib/scm/browser/scmAccessibilityHelp.js +23 -23
  13. package/vscode/src/vs/workbench/contrib/scm/browser/scmHistoryViewPane.js +101 -32
  14. package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoriesViewPane.d.ts +9 -3
  15. package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoriesViewPane.js +117 -55
  16. package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoryRenderer.d.ts +3 -8
  17. package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoryRenderer.js +34 -28
  18. package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPane.d.ts +1 -1
  19. package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPane.js +34 -31
  20. package/vscode/src/vs/workbench/contrib/scm/browser/scmViewService.js +5 -3
  21. package/vscode/src/vs/workbench/contrib/scm/browser/workingSet.js +1 -1
  22. package/vscode/src/vs/workbench/contrib/scm/browser/scmHistoryChatContext.d.ts +0 -9
  23. package/vscode/src/vs/workbench/contrib/scm/browser/scmHistoryChatContext.js +0 -185
@@ -34,8 +34,8 @@ import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/t
34
34
  import { ViewAction, ViewPane, ViewPaneShowActions } from '@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common/vscode/vs/workbench/browser/parts/views/viewPane';
35
35
  import { ViewContainerLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views';
36
36
  import { IViewDescriptorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service';
37
- import { renderSCMHistoryItemGraph, historyItemHoverDefaultLabelBackground, historyItemHoverLabelForeground, SWIMLANE_WIDTH, renderSCMHistoryGraphPlaceholder, getHistoryItemIndex, toISCMHistoryItemViewModelArray } from '@codingame/monaco-vscode-9ebd6daf-8734-5a28-ad24-b238f5e5819d-common/vscode/vs/workbench/contrib/scm/browser/scmHistory';
38
- import { getHistoryItemEditorTitle, isSCMHistoryItemViewModelTreeElement, isSCMHistoryItemChangeViewModelTreeElement, isSCMHistoryItemChangeNode, isSCMHistoryItemLoadMoreTreeElement, getHistoryItemHoverContent, isSCMRepository, getProviderKey } from '@codingame/monaco-vscode-9ebd6daf-8734-5a28-ad24-b238f5e5819d-common/vscode/vs/workbench/contrib/scm/browser/util';
37
+ import { renderSCMHistoryItemGraph, historyItemHoverDefaultLabelBackground, historyItemHoverLabelForeground, SWIMLANE_WIDTH, renderSCMHistoryGraphPlaceholder, getHistoryItemIndex, toISCMHistoryItemViewModelArray } from '@codingame/monaco-vscode-d0569cfb-4706-5ad6-b0b0-5115ad8685db-common/vscode/vs/workbench/contrib/scm/browser/scmHistory';
38
+ import { getHistoryItemEditorTitle, isSCMHistoryItemViewModelTreeElement, isSCMHistoryItemChangeViewModelTreeElement, isSCMHistoryItemChangeNode, isSCMHistoryItemLoadMoreTreeElement, getHistoryItemHoverContent, isSCMRepository, getProviderKey } from '@codingame/monaco-vscode-d0569cfb-4706-5ad6-b0b0-5115ad8685db-common/vscode/vs/workbench/contrib/scm/browser/util';
39
39
  import { HISTORY_VIEW_PANE_ID, ViewMode } from '@codingame/monaco-vscode-ff9fa663-eae3-5274-8573-c2b918871e4b-common/vscode/vs/workbench/contrib/scm/common/scm';
40
40
  import { ISCMService, ISCMViewService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/scm/common/scm.service';
41
41
  import { stripIcons } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iconLabels';
@@ -65,16 +65,17 @@ import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform
65
65
  import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
66
66
  import { groupBy } from '@codingame/monaco-vscode-api/vscode/vs/base/common/collections';
67
67
  import { getActionBarActions, getFlatContextMenuActions } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
68
- import { ResourceLabels } from '@codingame/monaco-vscode-2726569c-a06b-5f25-b851-14311bef12fa-common/vscode/vs/workbench/browser/labels';
68
+ import { ResourceLabels } from '@codingame/monaco-vscode-d941ac7b-412f-57e3-b1bf-f6b0eb253b21-common/vscode/vs/workbench/browser/labels';
69
69
  import { FileKind } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
70
70
  import { WorkbenchToolBar } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/toolbar';
71
71
  import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
72
72
  import { basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
73
73
  import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
74
- import { ScmHistoryItemResolver } from '@codingame/monaco-vscode-f99b74f5-fcb7-512f-8c6c-35f5a107577d-common/vscode/vs/workbench/contrib/multiDiffEditor/browser/scmMultiDiffSourceResolver';
75
- import { ResourceTree } from '@codingame/monaco-vscode-9ebd6daf-8734-5a28-ad24-b238f5e5819d-common/vscode/vs/base/common/resourceTree';
74
+ import { ScmHistoryItemResolver } from '@codingame/monaco-vscode-d0569cfb-4706-5ad6-b0b0-5115ad8685db-common/vscode/vs/workbench/contrib/multiDiffEditor/browser/scmMultiDiffSourceResolver';
75
+ import { ResourceTree } from '@codingame/monaco-vscode-d0569cfb-4706-5ad6-b0b0-5115ad8685db-common/vscode/vs/base/common/resourceTree';
76
76
  import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
77
77
  import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
78
+ import { CodeDataTransfers } from '@codingame/monaco-vscode-api/vscode/vs/platform/dnd/browser/dnd';
78
79
  import { autorun, autorunWithStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
79
80
  import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
80
81
  import { waitForState } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils/utilsCancellation';
@@ -98,7 +99,10 @@ class SCMRepositoryActionViewItem extends ActionViewItem {
98
99
  if (this.options.label && this.label) {
99
100
  this.label.classList.add('scm-graph-repository-picker');
100
101
  const icon = $('.icon');
101
- icon.classList.add(...ThemeIcon.asClassNameArray(Codicon.repo));
102
+ const iconClassNameArray = ThemeIcon.isThemeIcon(this._repository.provider.iconPath)
103
+ ? ThemeIcon.asClassNameArray(this._repository.provider.iconPath)
104
+ : ThemeIcon.asClassNameArray(Codicon.repo);
105
+ icon.classList.add(...iconClassNameArray);
102
106
  const name = $('.name');
103
107
  name.textContent = this._repository.provider.name;
104
108
  reset(this.label, icon, name);
@@ -121,23 +125,23 @@ class SCMHistoryItemRefsActionViewItem extends ActionViewItem {
121
125
  icon.classList.add(...ThemeIcon.asClassNameArray(Codicon.gitBranch));
122
126
  const name = $('.name');
123
127
  if (this._historyItemsFilter === 'all') {
124
- name.textContent = ( localize(9709, "All"));
128
+ name.textContent = ( localize(9865, "All"));
125
129
  }
126
130
  else if (this._historyItemsFilter === 'auto') {
127
- name.textContent = ( localize(9710, "Auto"));
131
+ name.textContent = ( localize(9866, "Auto"));
128
132
  }
129
133
  else if (this._historyItemsFilter.length === 1) {
130
134
  name.textContent = this._historyItemsFilter[0].name;
131
135
  }
132
136
  else {
133
- name.textContent = ( localize(9711, "{0} Items", this._historyItemsFilter.length));
137
+ name.textContent = ( localize(9867, "{0} Items", this._historyItemsFilter.length));
134
138
  }
135
139
  reset(this.label, icon, name);
136
140
  }
137
141
  }
138
142
  getTooltip() {
139
143
  if (this._historyItemsFilter === 'all') {
140
- return localize(9712, "All history item references");
144
+ return localize(9868, "All history item references");
141
145
  }
142
146
  else if (this._historyItemsFilter === 'auto') {
143
147
  const historyProvider = this._repository.provider.historyProvider.get();
@@ -159,7 +163,7 @@ registerAction2(class extends ViewAction {
159
163
  constructor() {
160
164
  super({
161
165
  id: PICK_REPOSITORY_ACTION_ID,
162
- title: ( localize(9713, "Repository Picker")),
166
+ title: ( localize(9869, "Repository Picker")),
163
167
  viewId: HISTORY_VIEW_PANE_ID,
164
168
  f1: false,
165
169
  menu: {
@@ -178,7 +182,7 @@ registerAction2(class extends ViewAction {
178
182
  constructor() {
179
183
  super({
180
184
  id: PICK_HISTORY_ITEM_REFS_ACTION_ID,
181
- title: ( localize(9714, "History Item Reference Picker")),
185
+ title: ( localize(9870, "History Item Reference Picker")),
182
186
  icon: Codicon.gitBranch,
183
187
  viewId: HISTORY_VIEW_PANE_ID,
184
188
  precondition: ( ContextKeys.SCMHistoryItemCount.notEqualsTo(0)),
@@ -198,7 +202,7 @@ registerAction2(class extends ViewAction {
198
202
  constructor() {
199
203
  super({
200
204
  id: 'workbench.scm.action.graph.revealCurrentHistoryItem',
201
- title: ( localize(9715, "Go to Current History Item")),
205
+ title: ( localize(9871, "Go to Current History Item")),
202
206
  icon: Codicon.target,
203
207
  viewId: HISTORY_VIEW_PANE_ID,
204
208
  precondition: ( ContextKeyExpr.and(( ContextKeys.SCMHistoryItemCount.notEqualsTo(0)), ( ContextKeys.SCMCurrentHistoryItemRefInFilter.isEqualTo(true)))),
@@ -218,7 +222,7 @@ registerAction2(class extends ViewAction {
218
222
  constructor() {
219
223
  super({
220
224
  id: 'workbench.scm.action.graph.refresh',
221
- title: ( localize(9716, "Refresh")),
225
+ title: ( localize(9872, "Refresh")),
222
226
  viewId: HISTORY_VIEW_PANE_ID,
223
227
  f1: false,
224
228
  icon: Codicon.refresh,
@@ -237,7 +241,7 @@ registerAction2(class extends ViewAction {
237
241
  constructor() {
238
242
  super({
239
243
  id: 'workbench.scm.action.graph.setListViewMode',
240
- title: ( localize(9717, "View as List")),
244
+ title: ( localize(9873, "View as List")),
241
245
  viewId: HISTORY_VIEW_PANE_ID,
242
246
  toggled: ( ContextKeys.SCMHistoryViewMode.isEqualTo(ViewMode.List)),
243
247
  menu: { id: MenuId.SCMHistoryTitle, group: '9_viewmode', order: 1 },
@@ -252,7 +256,7 @@ registerAction2(class extends ViewAction {
252
256
  constructor() {
253
257
  super({
254
258
  id: 'workbench.scm.action.graph.setTreeViewMode',
255
- title: ( localize(9718, "View as Tree")),
259
+ title: ( localize(9874, "View as Tree")),
256
260
  viewId: HISTORY_VIEW_PANE_ID,
257
261
  toggled: ( ContextKeys.SCMHistoryViewMode.isEqualTo(ViewMode.Tree)),
258
262
  menu: { id: MenuId.SCMHistoryTitle, group: '9_viewmode', order: 2 },
@@ -267,7 +271,7 @@ registerAction2(class extends Action2 {
267
271
  constructor() {
268
272
  super({
269
273
  id: 'workbench.scm.action.graph.viewChanges',
270
- title: ( localize(9719, "Open Changes")),
274
+ title: ( localize(9875, "Open Changes")),
271
275
  icon: Codicon.diffMultiple,
272
276
  f1: false,
273
277
  menu: [
@@ -303,7 +307,7 @@ registerAction2(class extends Action2 {
303
307
  const title = historyItems.length === 1 ?
304
308
  getHistoryItemEditorTitle(historyItem) :
305
309
  ( localize(
306
- 9720,
310
+ 9876,
307
311
  "All Changes ({0} ↔ {1})",
308
312
  historyItemLast.displayId ?? historyItemLast.id,
309
313
  historyItem.displayId ?? historyItem.id
@@ -316,7 +320,7 @@ registerAction2(class extends Action2 {
316
320
  constructor() {
317
321
  super({
318
322
  id: 'workbench.scm.action.graph.openFile',
319
- title: ( localize(9721, "Open File")),
323
+ title: ( localize(9877, "Open File")),
320
324
  icon: Codicon.goToFile,
321
325
  f1: false,
322
326
  menu: [
@@ -510,6 +514,7 @@ let HistoryItemRenderer = class HistoryItemRenderer {
510
514
  templateData.elementDisposables.clear();
511
515
  }
512
516
  disposeTemplate(templateData) {
517
+ templateData.elementDisposables.dispose();
513
518
  templateData.disposables.dispose();
514
519
  }
515
520
  };
@@ -649,7 +654,7 @@ let HistoryItemLoadMoreRenderer = class HistoryItemLoadMoreRenderer {
649
654
  templateData.elementDisposables.add(autorun(reader => {
650
655
  const isLoadingMore = this._isLoadingMore.read(reader);
651
656
  const icon = `$(${isLoadingMore ? 'loading~spin' : 'fold-down'})`;
652
- templateData.historyItemPlaceholderLabel.setLabel(( localize(9722, "{0} Load More...", icon)));
657
+ templateData.historyItemPlaceholderLabel.setLabel(( localize(9878, "{0} Load More...", icon)));
653
658
  }));
654
659
  }
655
660
  }
@@ -660,6 +665,7 @@ let HistoryItemLoadMoreRenderer = class HistoryItemLoadMoreRenderer {
660
665
  templateData.elementDisposables.clear();
661
666
  }
662
667
  disposeTemplate(templateData) {
668
+ templateData.elementDisposables.dispose();
663
669
  templateData.disposables.dispose();
664
670
  }
665
671
  };
@@ -708,7 +714,7 @@ SCMHistoryViewPaneActionRunner = ( __decorate([
708
714
  ], SCMHistoryViewPaneActionRunner));
709
715
  class SCMHistoryTreeAccessibilityProvider {
710
716
  getWidgetAriaLabel() {
711
- return localize(9723, "Source Control History");
717
+ return localize(9879, "Source Control History");
712
718
  }
713
719
  getAriaLabel(element) {
714
720
  if (isSCMRepository(element)) {
@@ -845,6 +851,66 @@ class SCMHistoryTreeDataSource extends Disposable {
845
851
  (isSCMHistoryItemChangeNode(inputOrElement) && inputOrElement.childrenCount > 0);
846
852
  }
847
853
  }
854
+ class SCMHistoryTreeDragAndDrop {
855
+ getDragURI(element) {
856
+ const uri = this._getTreeElementUri(element);
857
+ return uri ? ( uri.toString()) : null;
858
+ }
859
+ onDragStart(data, originalEvent) {
860
+ if (!originalEvent.dataTransfer) {
861
+ return;
862
+ }
863
+ const historyItems = this._getDragAndDropData(data);
864
+ if (historyItems.length === 0) {
865
+ return;
866
+ }
867
+ originalEvent.dataTransfer.setData(CodeDataTransfers.SCM_HISTORY_ITEM, JSON.stringify(historyItems));
868
+ }
869
+ getDragLabel(elements, originalEvent) {
870
+ if (elements.length === 1) {
871
+ const element = elements[0];
872
+ return this._getTreeElementLabel(element);
873
+ }
874
+ return String(elements.length);
875
+ }
876
+ onDragOver(data, targetElement, targetIndex, targetSector, originalEvent) {
877
+ return false;
878
+ }
879
+ drop(data, targetElement, targetIndex, targetSector, originalEvent) { }
880
+ _getDragAndDropData(data) {
881
+ const historyItems = [];
882
+ for (const element of [...(data.context ?? []), ...data.elements]) {
883
+ if (!isSCMHistoryItemViewModelTreeElement(element)) {
884
+ continue;
885
+ }
886
+ const provider = element.repository.provider;
887
+ const historyItem = element.historyItemViewModel.historyItem;
888
+ const attachmentName = `$(${Codicon.repo.id})\u00A0${provider.name}\u00A0$(${Codicon.gitCommit.id})\u00A0${historyItem.displayId ?? historyItem.id}`;
889
+ historyItems.push({
890
+ name: attachmentName,
891
+ resource: ScmHistoryItemResolver.getMultiDiffSourceUri(provider, historyItem),
892
+ historyItem: historyItem
893
+ });
894
+ }
895
+ return historyItems;
896
+ }
897
+ _getTreeElementLabel(element) {
898
+ if (isSCMHistoryItemViewModelTreeElement(element)) {
899
+ const historyItem = element.historyItemViewModel.historyItem;
900
+ return getHistoryItemEditorTitle(historyItem);
901
+ }
902
+ return undefined;
903
+ }
904
+ _getTreeElementUri(element) {
905
+ if (isSCMHistoryItemViewModelTreeElement(element)) {
906
+ const provider = element.repository.provider;
907
+ const historyItem = element.historyItemViewModel.historyItem;
908
+ return ScmHistoryItemResolver.getMultiDiffSourceUri(provider, historyItem);
909
+ }
910
+ return undefined;
911
+ }
912
+ dispose() { }
913
+ }
848
914
  let SCMHistoryViewModel = class SCMHistoryViewModel extends Disposable {
849
915
  constructor(_configurationService, _contextKeyService, _extensionService, _scmService, _scmViewService, _storageService) {
850
916
  super();
@@ -1091,8 +1157,8 @@ let RepositoryPicker = class RepositoryPicker {
1091
1157
  this._quickInputService = _quickInputService;
1092
1158
  this._scmViewService = _scmViewService;
1093
1159
  this._autoQuickPickItem = {
1094
- label: ( localize(9710, "Auto")),
1095
- description: ( localize(9724, "Show the source control graph for the active repository")),
1160
+ label: ( localize(9866, "Auto")),
1161
+ description: ( localize(9880, "Show the source control graph for the active repository")),
1096
1162
  repository: 'auto'
1097
1163
  };
1098
1164
  }
@@ -1104,11 +1170,13 @@ let RepositoryPicker = class RepositoryPicker {
1104
1170
  picks.push(...( this._scmViewService.repositories.map(r => ({
1105
1171
  label: r.provider.name,
1106
1172
  description: r.provider.rootUri?.fsPath,
1107
- iconClass: ThemeIcon.asClassName(Codicon.repo),
1173
+ iconClass: ThemeIcon.isThemeIcon(r.provider.iconPath)
1174
+ ? ThemeIcon.asClassName(r.provider.iconPath)
1175
+ : ThemeIcon.asClassName(Codicon.repo),
1108
1176
  repository: r
1109
1177
  }))));
1110
1178
  return this._quickInputService.pick(picks, {
1111
- placeHolder: ( localize(9725, "Select the repository to view, type to filter all repositories"))
1179
+ placeHolder: ( localize(9881, "Select the repository to view, type to filter all repositories"))
1112
1180
  });
1113
1181
  }
1114
1182
  };
@@ -1124,21 +1192,21 @@ let HistoryItemRefPicker = class HistoryItemRefPicker extends Disposable {
1124
1192
  this._quickInputService = _quickInputService;
1125
1193
  this._allQuickPickItem = {
1126
1194
  id: 'all',
1127
- label: ( localize(9709, "All")),
1128
- description: ( localize(9712, "All history item references")),
1195
+ label: ( localize(9865, "All")),
1196
+ description: ( localize(9868, "All history item references")),
1129
1197
  historyItemRef: 'all'
1130
1198
  };
1131
1199
  this._autoQuickPickItem = {
1132
1200
  id: 'auto',
1133
- label: ( localize(9710, "Auto")),
1134
- description: ( localize(9726, "Current history item reference(s)")),
1201
+ label: ( localize(9866, "Auto")),
1202
+ description: ( localize(9882, "Current history item reference(s)")),
1135
1203
  historyItemRef: 'auto'
1136
1204
  };
1137
1205
  }
1138
1206
  async pickHistoryItemRef() {
1139
1207
  const quickPick = this._quickInputService.createQuickPick({ useSeparators: true });
1140
1208
  this._store.add(quickPick);
1141
- quickPick.placeholder = ( localize(9727, "Select one/more history item references to view, type to filter"));
1209
+ quickPick.placeholder = ( localize(9883, "Select one/more history item references to view, type to filter"));
1142
1210
  quickPick.canSelectMany = true;
1143
1211
  quickPick.hideCheckAll = true;
1144
1212
  quickPick.busy = true;
@@ -1268,7 +1336,7 @@ let SCMHistoryViewPane = class SCMHistoryViewPane extends ViewPane {
1268
1336
  container.appendChild(element.root);
1269
1337
  this._register(this.hoverService.setupManagedHover(getDefaultHoverDelegate('mouse'), element.root, {
1270
1338
  markdown: {
1271
- value: ( localize(9728, "Please refresh the graph using the refresh action ($(refresh)).")),
1339
+ value: ( localize(9884, "Please refresh the graph using the refresh action ($(refresh)).")),
1272
1340
  supportThemeIcons: true
1273
1341
  },
1274
1342
  markdownNotSupportedFallback: undefined
@@ -1342,7 +1410,7 @@ let SCMHistoryViewPane = class SCMHistoryViewPane extends ViewPane {
1342
1410
  store.add(runOnChange(this._treeViewModel.viewMode, async () => {
1343
1411
  await this._updateChildren();
1344
1412
  }));
1345
- this._scmProviderCtx.set(repository.provider.contextValue);
1413
+ this._scmProviderCtx.set(repository.provider.providerId);
1346
1414
  this._scmCurrentHistoryItemRefInFilter.set(this._isCurrentHistoryItemInFilter(historyItemRefId.get()));
1347
1415
  if (!isFirstRun) {
1348
1416
  this.refresh();
@@ -1466,6 +1534,7 @@ let SCMHistoryViewPane = class SCMHistoryViewPane extends ViewPane {
1466
1534
  identityProvider: this._treeIdentityProvider,
1467
1535
  collapseByDefault: (e) => !isSCMHistoryItemChangeNode(e),
1468
1536
  compressionEnabled: compressionEnabled.get(),
1537
+ dnd: ( new SCMHistoryTreeDragAndDrop()),
1469
1538
  keyboardNavigationLabelProvider: ( new SCMHistoryTreeKeyboardNavigationLabelProvider()),
1470
1539
  horizontalScrolling: false,
1471
1540
  multipleSelectionSupport: false
@@ -1,5 +1,6 @@
1
1
  import { ViewPane, IViewPaneOptions } from "@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common/vscode/vs/workbench/browser/parts/views/viewPane";
2
2
  import { ISCMViewService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/scm/common/scm.service";
3
+ import { ISCMService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/scm/common/scm.service";
3
4
  import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
4
5
  import { IContextMenuService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service";
5
6
  import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
@@ -10,16 +11,16 @@ import { IViewDescriptorService } from "@codingame/monaco-vscode-api/vscode/vs/w
10
11
  import { IOpenerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service";
11
12
  import { IHoverService } from "@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service";
12
13
  export declare class SCMRepositoriesViewPane extends ViewPane {
13
- protected scmViewService: ISCMViewService;
14
+ private readonly scmService;
15
+ private readonly scmViewService;
14
16
  private tree;
15
- private treeViewModel;
16
17
  private treeDataSource;
17
18
  private treeIdentityProvider;
18
19
  private readonly treeOperationSequencer;
19
20
  private readonly visibleCountObs;
20
21
  private readonly providerCountBadgeObs;
21
22
  private readonly visibilityDisposables;
22
- constructor(options: IViewPaneOptions, scmViewService: ISCMViewService, keybindingService: IKeybindingService, contextMenuService: IContextMenuService, instantiationService: IInstantiationService, viewDescriptorService: IViewDescriptorService, contextKeyService: IContextKeyService, configurationService: IConfigurationService, openerService: IOpenerService, themeService: IThemeService, hoverService: IHoverService);
23
+ constructor(options: IViewPaneOptions, scmService: ISCMService, scmViewService: ISCMViewService, keybindingService: IKeybindingService, contextMenuService: IContextMenuService, instantiationService: IInstantiationService, viewDescriptorService: IViewDescriptorService, contextKeyService: IContextKeyService, configurationService: IConfigurationService, openerService: IOpenerService, themeService: IThemeService, hoverService: IHoverService);
23
24
  protected renderBody(container: HTMLElement): void;
24
25
  protected layoutBody(height: number, width: number): void;
25
26
  focus(): void;
@@ -27,7 +28,12 @@ export declare class SCMRepositoriesViewPane extends ViewPane {
27
28
  private onTreeContextMenu;
28
29
  private onTreeSelectionChange;
29
30
  private onTreeDidChangeFocus;
31
+ private onDidTreeFocus;
32
+ private onTreeContentHeightChange;
30
33
  private updateChildren;
34
+ private expand;
35
+ private updateRepository;
36
+ private updateParentRepository;
31
37
  private updateBodySize;
32
38
  private updateTreeSelection;
33
39
  dispose(): void;
@@ -6,7 +6,7 @@ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
6
6
  import { ViewPane } from '@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common/vscode/vs/workbench/browser/parts/views/viewPane';
7
7
  import { append, $ } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
8
8
  import { WorkbenchCompressibleAsyncDataTree } from '@codingame/monaco-vscode-api/vscode/vs/platform/list/browser/listService';
9
- import { ISCMViewService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/scm/common/scm.service';
9
+ import { ISCMViewService, ISCMService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/scm/common/scm.service';
10
10
  import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
11
11
  import { IContextMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service';
12
12
  import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
@@ -17,7 +17,7 @@ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/pl
17
17
  import { IViewDescriptorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service';
18
18
  import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
19
19
  import { RepositoryRenderer, RepositoryActionRunner } from './scmRepositoryRenderer.js';
20
- import { getActionViewItemProvider, collectContextMenuActions } from '@codingame/monaco-vscode-9ebd6daf-8734-5a28-ad24-b238f5e5819d-common/vscode/vs/workbench/contrib/scm/browser/util';
20
+ import { isSCMRepository, getActionViewItemProvider, collectContextMenuActions } from '@codingame/monaco-vscode-d0569cfb-4706-5ad6-b0b0-5115ad8685db-common/vscode/vs/workbench/contrib/scm/browser/util';
21
21
  import { Orientation } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/sash/sash';
22
22
  import { Iterable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iterator';
23
23
  import { MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
@@ -26,6 +26,7 @@ import { observableConfigValue } from '@codingame/monaco-vscode-api/vscode/vs/pl
26
26
  import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
27
27
  import { Sequencer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
28
28
  import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
29
+ import { observableFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableFromEvent';
29
30
  import { observableSignalFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableSignalFromEvent';
30
31
 
31
32
  registerCss(scm);
@@ -37,39 +38,40 @@ class ListDelegate {
37
38
  return RepositoryRenderer.TEMPLATE_ID;
38
39
  }
39
40
  }
40
- class RepositoryTreeDataSource extends Disposable {
41
- async getChildren(inputOrElement) {
42
- if (inputOrElement instanceof SCMRepositoriesViewModel) {
43
- return inputOrElement.repositories;
44
- }
45
- return [];
41
+ let RepositoryTreeDataSource = class RepositoryTreeDataSource extends Disposable {
42
+ constructor(scmViewService) {
43
+ super();
44
+ this.scmViewService = scmViewService;
45
+ }
46
+ getChildren(inputOrElement) {
47
+ const parentId = isSCMRepository(inputOrElement)
48
+ ? inputOrElement.provider.id
49
+ : undefined;
50
+ const repositories = this.scmViewService.repositories
51
+ .filter(r => r.provider.parentId === parentId);
52
+ return repositories;
46
53
  }
47
54
  hasChildren(inputOrElement) {
48
- return inputOrElement instanceof SCMRepositoriesViewModel;
55
+ const parentId = isSCMRepository(inputOrElement)
56
+ ? inputOrElement.provider.id
57
+ : undefined;
58
+ const repositories = this.scmViewService.repositories
59
+ .filter(r => r.provider.parentId === parentId);
60
+ return repositories.length > 0;
49
61
  }
50
- }
62
+ };
63
+ RepositoryTreeDataSource = ( __decorate([
64
+ ( __param(0, ISCMViewService))
65
+ ], RepositoryTreeDataSource));
51
66
  class RepositoryTreeIdentityProvider {
52
67
  getId(element) {
53
68
  return element.provider.id;
54
69
  }
55
70
  }
56
- let SCMRepositoriesViewModel = class SCMRepositoriesViewModel extends Disposable {
57
- constructor(scmViewService) {
58
- super();
59
- this.scmViewService = scmViewService;
60
- this.onDidChangeRepositoriesSignal = observableSignalFromEvent(this, this.scmViewService.onDidChangeRepositories);
61
- this.onDidChangeVisibleRepositoriesSignal = observableSignalFromEvent(this, this.scmViewService.onDidChangeVisibleRepositories);
62
- }
63
- get repositories() {
64
- return this.scmViewService.repositories;
65
- }
66
- };
67
- SCMRepositoriesViewModel = ( __decorate([
68
- ( __param(0, ISCMViewService))
69
- ], SCMRepositoriesViewModel));
70
71
  let SCMRepositoriesViewPane = class SCMRepositoriesViewPane extends ViewPane {
71
- constructor(options, scmViewService, keybindingService, contextMenuService, instantiationService, viewDescriptorService, contextKeyService, configurationService, openerService, themeService, hoverService) {
72
+ constructor(options, scmService, scmViewService, keybindingService, contextMenuService, instantiationService, viewDescriptorService, contextKeyService, configurationService, openerService, themeService, hoverService) {
72
73
  super({ ...options, titleMenuId: MenuId.SCMSourceControlTitle }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, hoverService);
74
+ this.scmService = scmService;
73
75
  this.scmViewService = scmViewService;
74
76
  this.treeOperationSequencer = ( new Sequencer());
75
77
  this.visibilityDisposables = ( new DisposableStore());
@@ -90,21 +92,32 @@ let SCMRepositoriesViewPane = class SCMRepositoriesViewPane extends ViewPane {
90
92
  this.visibilityDisposables.clear();
91
93
  return;
92
94
  }
93
- this.treeViewModel = this.instantiationService.createInstance(SCMRepositoriesViewModel);
94
- this._register(this.treeViewModel);
95
95
  this.treeOperationSequencer.queue(async () => {
96
- await this.tree.setInput(this.treeViewModel);
96
+ await this.tree.setInput(this.scmViewService);
97
97
  this.visibilityDisposables.add(autorun(reader => {
98
98
  const visibleCount = this.visibleCountObs.read(reader);
99
- this.updateBodySize(visibleCount);
99
+ this.updateBodySize(this.tree.contentHeight, visibleCount);
100
100
  }));
101
+ const addedRepositoryObs = observableFromEvent(this, this.scmService.onDidAddRepository, e => e);
102
+ const removedRepositoryObs = observableFromEvent(this, this.scmService.onDidRemoveRepository, e => e);
101
103
  this.visibilityDisposables.add(autorun(async (reader) => {
102
- this.treeViewModel.onDidChangeRepositoriesSignal.read(reader);
103
- await this.treeOperationSequencer.queue(() => this.updateChildren());
104
+ const addedRepository = addedRepositoryObs.read(reader);
105
+ const removedRepository = removedRepositoryObs.read(reader);
106
+ if (addedRepository === undefined && removedRepository === undefined) {
107
+ await this.updateChildren();
108
+ return;
109
+ }
110
+ if (addedRepository) {
111
+ await this.updateRepository(addedRepository);
112
+ }
113
+ if (removedRepository) {
114
+ await this.updateRepository(removedRepository);
115
+ }
104
116
  }));
117
+ const onDidChangeVisibleRepositoriesSignal = observableSignalFromEvent(this, this.scmViewService.onDidChangeVisibleRepositories);
105
118
  this.visibilityDisposables.add(autorun(async (reader) => {
106
- this.treeViewModel.onDidChangeVisibleRepositoriesSignal.read(reader);
107
- await this.treeOperationSequencer.queue(async () => this.updateTreeSelection());
119
+ onDidChangeVisibleRepositoriesSignal.read(reader);
120
+ await this.treeOperationSequencer.queue(() => this.updateTreeSelection());
108
121
  }));
109
122
  });
110
123
  }, this, this._store);
@@ -129,21 +142,31 @@ let SCMRepositoriesViewPane = class SCMRepositoriesViewPane extends ViewPane {
129
142
  ], this.treeDataSource, {
130
143
  identityProvider: this.treeIdentityProvider,
131
144
  horizontalScrolling: false,
145
+ collapseByDefault: (e) => {
146
+ if (isSCMRepository(e) && e.provider.parentId === undefined) {
147
+ return false;
148
+ }
149
+ return true;
150
+ },
132
151
  compressionEnabled: compressionEnabled.get(),
133
152
  overrideStyles: this.getLocationBasedColors().listOverrideStyles,
153
+ expandOnDoubleClick: false,
154
+ expandOnlyOnTwistieClick: true,
134
155
  accessibilityProvider: {
135
156
  getAriaLabel(r) {
136
157
  return r.provider.label;
137
158
  },
138
159
  getWidgetAriaLabel() {
139
- return localize(9729, "Source Control Repositories");
160
+ return localize(9885, "Source Control Repositories");
140
161
  }
141
162
  }
142
163
  });
143
164
  this._register(this.tree);
144
165
  this._register(this.tree.onDidChangeSelection(this.onTreeSelectionChange, this));
145
166
  this._register(this.tree.onDidChangeFocus(this.onTreeDidChangeFocus, this));
167
+ this._register(this.tree.onDidFocus(this.onDidTreeFocus, this));
146
168
  this._register(this.tree.onContextMenu(this.onTreeContextMenu, this));
169
+ this._register(this.tree.onDidChangeContentHeight(this.onTreeContentHeightChange, this));
147
170
  }
148
171
  onTreeContextMenu(e) {
149
172
  if (!e.element) {
@@ -151,7 +174,7 @@ let SCMRepositoriesViewPane = class SCMRepositoriesViewPane extends ViewPane {
151
174
  }
152
175
  const provider = e.element.provider;
153
176
  const menus = this.scmViewService.menus.getRepositoryMenus(provider);
154
- const menu = menus.repositoryContextMenu;
177
+ const menu = menus.getRepositoryContextMenu(e.element);
155
178
  const actions = collectContextMenuActions(menu);
156
179
  const disposables = ( new DisposableStore());
157
180
  const actionRunner = ( new RepositoryActionRunner(() => {
@@ -179,20 +202,56 @@ let SCMRepositoriesViewPane = class SCMRepositoriesViewPane extends ViewPane {
179
202
  this.scmViewService.focus(e.elements[0]);
180
203
  }
181
204
  }
182
- async updateChildren() {
183
- await this.tree.updateChildren(this.treeViewModel);
184
- this.updateBodySize(this.visibleCountObs.get());
205
+ onDidTreeFocus() {
206
+ const focused = this.tree.getFocus();
207
+ if (focused.length > 0) {
208
+ this.scmViewService.focus(focused[0]);
209
+ }
210
+ }
211
+ onTreeContentHeightChange(height) {
212
+ this.updateBodySize(height);
213
+ this.treeOperationSequencer.queue(() => this.updateTreeSelection());
214
+ }
215
+ async updateChildren(element) {
216
+ await this.treeOperationSequencer.queue(async () => {
217
+ if (element && this.tree.hasNode(element)) {
218
+ await this.tree.updateChildren(element, true);
219
+ }
220
+ else {
221
+ await this.tree.updateChildren(undefined, true);
222
+ }
223
+ });
224
+ }
225
+ async expand(element) {
226
+ await this.treeOperationSequencer.queue(() => this.tree.expand(element, true));
227
+ }
228
+ async updateRepository(repository) {
229
+ if (repository.provider.parentId === undefined) {
230
+ await this.updateChildren();
231
+ return;
232
+ }
233
+ await this.updateParentRepository(repository);
234
+ }
235
+ async updateParentRepository(repository) {
236
+ const parentRepository = this.scmViewService.repositories
237
+ .find(r => r.provider.id === repository.provider.parentId);
238
+ if (!parentRepository) {
239
+ return;
240
+ }
241
+ await this.updateChildren(parentRepository);
242
+ await this.expand(parentRepository);
185
243
  }
186
- updateBodySize(visibleCount) {
244
+ updateBodySize(contentHeight, visibleCount) {
187
245
  if (this.orientation === Orientation.HORIZONTAL) {
188
246
  return;
189
247
  }
248
+ visibleCount = visibleCount ?? this.visibleCountObs.get();
190
249
  const empty = this.scmViewService.repositories.length === 0;
191
- const size = Math.min(this.scmViewService.repositories.length, visibleCount) * 22;
250
+ const size = Math.min(contentHeight / 22, visibleCount) * 22;
192
251
  this.minimumBodySize = visibleCount === 0 ? 22 : size;
193
252
  this.maximumBodySize = visibleCount === 0 ? Number.POSITIVE_INFINITY : empty ? Number.POSITIVE_INFINITY : size;
194
253
  }
195
- updateTreeSelection() {
254
+ async updateTreeSelection() {
196
255
  const oldSelection = this.tree.getSelection();
197
256
  const oldSet = ( new Set(oldSelection));
198
257
  const set = ( new Set(this.scmViewService.visibleRepositories));
@@ -207,10 +266,12 @@ let SCMRepositoriesViewPane = class SCMRepositoriesViewPane extends ViewPane {
207
266
  selection.push(repo);
208
267
  }
209
268
  }
210
- this.tree.setSelection(selection);
211
- if (selection.length > 0 && !this.tree.getFocus().includes(selection[0])) {
212
- this.tree.setAnchor(selection[0]);
213
- this.tree.setFocus([selection[0]]);
269
+ const visibleSelection = selection
270
+ .filter(s => this.tree.hasNode(s));
271
+ this.tree.setSelection(visibleSelection);
272
+ if (visibleSelection.length > 0 && !this.tree.getFocus().includes(visibleSelection[0])) {
273
+ this.tree.setAnchor(visibleSelection[0]);
274
+ this.tree.setFocus([visibleSelection[0]]);
214
275
  }
215
276
  }
216
277
  dispose() {
@@ -219,16 +280,17 @@ let SCMRepositoriesViewPane = class SCMRepositoriesViewPane extends ViewPane {
219
280
  }
220
281
  };
221
282
  SCMRepositoriesViewPane = ( __decorate([
222
- ( __param(1, ISCMViewService)),
223
- ( __param(2, IKeybindingService)),
224
- ( __param(3, IContextMenuService)),
225
- ( __param(4, IInstantiationService)),
226
- ( __param(5, IViewDescriptorService)),
227
- ( __param(6, IContextKeyService)),
228
- ( __param(7, IConfigurationService)),
229
- ( __param(8, IOpenerService)),
230
- ( __param(9, IThemeService)),
231
- ( __param(10, IHoverService))
283
+ ( __param(1, ISCMService)),
284
+ ( __param(2, ISCMViewService)),
285
+ ( __param(3, IKeybindingService)),
286
+ ( __param(4, IContextMenuService)),
287
+ ( __param(5, IInstantiationService)),
288
+ ( __param(6, IViewDescriptorService)),
289
+ ( __param(7, IContextKeyService)),
290
+ ( __param(8, IConfigurationService)),
291
+ ( __param(9, IOpenerService)),
292
+ ( __param(10, IThemeService)),
293
+ ( __param(11, IHoverService))
232
294
  ], SCMRepositoriesViewPane));
233
295
 
234
296
  export { SCMRepositoriesViewPane };