@codingame/monaco-vscode-scm-service-override 2.0.1 → 2.0.3-improve-modularity.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-scm-service-override",
3
- "version": "2.0.1",
3
+ "version": "2.0.3-improve-modularity.1",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -18,7 +18,7 @@
18
18
  "module": "index.js",
19
19
  "types": "index.d.ts",
20
20
  "dependencies": {
21
- "vscode": "npm:@codingame/monaco-vscode-api@2.0.1",
21
+ "vscode": "npm:@codingame/monaco-vscode-api@2.0.3-improve-modularity.1",
22
22
  "vscode-marked": "npm:marked@=3.0.2"
23
23
  }
24
24
  }
@@ -1176,19 +1176,13 @@ class RepositoryVisibilityAction extends Action2 {
1176
1176
  }
1177
1177
  }
1178
1178
  let RepositoryVisibilityActionController = class RepositoryVisibilityActionController {
1179
- constructor(contextKeyService, scmViewService, configurationService, scmService) {
1179
+ constructor(contextKeyService, scmViewService, scmService) {
1180
1180
  this.contextKeyService = contextKeyService;
1181
1181
  this.scmViewService = scmViewService;
1182
- this.alwaysShowRepositories = false;
1183
1182
  this.items = ( new Map());
1184
1183
  this.disposables = ( new DisposableStore());
1185
1184
  this.repositoryCountContextKey = ContextKeys.RepositoryCount.bindTo(contextKeyService);
1186
1185
  this.repositoryVisibilityCountContextKey = ContextKeys.RepositoryVisibilityCount.bindTo(contextKeyService);
1187
- this.scmProviderContextKey = ContextKeys.SCMProvider.bindTo(contextKeyService);
1188
- this.scmProviderRootUriContextKey = ContextKeys.SCMProviderRootUri.bindTo(contextKeyService);
1189
- this.scmProviderHasRootUriContextKey = ContextKeys.SCMProviderHasRootUri.bindTo(contextKeyService);
1190
- configurationService.onDidChangeConfiguration(this.onDidChangeConfiguration, this, this.disposables);
1191
- this.onDidChangeConfiguration();
1192
1186
  scmViewService.onDidChangeVisibleRepositories(this.onDidChangeVisibleRepositories, this, this.disposables);
1193
1187
  scmService.onDidAddRepository(this.onDidAddRepository, this, this.disposables);
1194
1188
  scmService.onDidRemoveRepository(this.onDidRemoveRepository, this, this.disposables);
@@ -1230,26 +1224,9 @@ let RepositoryVisibilityActionController = class RepositoryVisibilityActionContr
1230
1224
  this.repositoryCountContextKey.set(this.items.size);
1231
1225
  this.repositoryVisibilityCountContextKey.set(count);
1232
1226
  }
1233
- onDidChangeConfiguration(e) {
1234
- if (!e || e.affectsConfiguration('scm.alwaysShowRepositories')) {
1235
- this.alwaysShowRepositories = this.contextKeyService.getContextKeyValue('scm.alwaysShowRepositories') === true;
1236
- this.updateRepositoryContextKeys();
1237
- }
1238
- }
1239
1227
  updateRepositoryContextKeys() {
1240
1228
  this.repositoryCountContextKey.set(this.items.size);
1241
1229
  this.repositoryVisibilityCountContextKey.set(Iterable.reduce(( this.items.keys()), (r, repository) => r + (this.scmViewService.isVisible(repository) ? 1 : 0), 0));
1242
- if (!this.alwaysShowRepositories && this.items.size === 1) {
1243
- const provider = Iterable.first(( this.items.keys())).provider;
1244
- this.scmProviderContextKey.set(provider.contextValue);
1245
- this.scmProviderRootUriContextKey.set(provider.rootUri?.toString());
1246
- this.scmProviderHasRootUriContextKey.set(!!provider.rootUri);
1247
- }
1248
- else {
1249
- this.scmProviderContextKey.set(undefined);
1250
- this.scmProviderRootUriContextKey.set(undefined);
1251
- this.scmProviderHasRootUriContextKey.set(false);
1252
- }
1253
1230
  }
1254
1231
  dispose() {
1255
1232
  this.disposables.dispose();
@@ -1260,8 +1237,7 @@ let RepositoryVisibilityActionController = class RepositoryVisibilityActionContr
1260
1237
  RepositoryVisibilityActionController = ( __decorate([
1261
1238
  ( __param(0, IContextKeyService)),
1262
1239
  ( __param(1, ISCMViewService)),
1263
- ( __param(2, IConfigurationService)),
1264
- ( __param(3, ISCMService))
1240
+ ( __param(2, ISCMService))
1265
1241
  ], RepositoryVisibilityActionController));
1266
1242
  class SetListViewModeAction extends ViewAction {
1267
1243
  constructor(menu = {}) {
@@ -1571,10 +1547,15 @@ SCMInputWidgetActionRunner = ( __decorate([
1571
1547
  ], SCMInputWidgetActionRunner));
1572
1548
  let SCMInputWidgetToolbar = class SCMInputWidgetToolbar extends WorkbenchToolBar {
1573
1549
  get dropdownActions() { return this._dropdownActions; }
1574
- constructor(container, menuId, options, menuService, contextKeyService, contextMenuService, commandService, keybindingService, storageService, telemetryService) {
1550
+ constructor(container, input, menuId, options, menuService, contextKeyService, contextMenuService, commandService, keybindingService, storageService, telemetryService) {
1575
1551
  super(container, { resetMenu: menuId, ...options }, menuService, contextKeyService, contextMenuService, keybindingService, telemetryService);
1576
1552
  this._dropdownActions = [];
1577
- const menu = this._store.add(menuService.createMenu(menuId, contextKeyService, { emitEventsForSubmenuChanges: true }));
1553
+ const contextKeyServiceWithOverlay = contextKeyService.createOverlay([
1554
+ ['scmProvider', input.repository.provider.contextValue],
1555
+ ['scmProviderRootUri', input.repository.provider.rootUri?.toString()],
1556
+ ['scmProviderHasRootUri', !!input.repository.provider.rootUri]
1557
+ ]);
1558
+ const menu = this._store.add(menuService.createMenu(menuId, contextKeyServiceWithOverlay, { emitEventsForSubmenuChanges: true }));
1578
1559
  const cancelAction = ( new MenuItemAction({
1579
1560
  id: "scm.input.cancelAction" ,
1580
1561
  title: ( localizeWithPath(
@@ -1618,13 +1599,13 @@ let SCMInputWidgetToolbar = class SCMInputWidgetToolbar extends WorkbenchToolBar
1618
1599
  }
1619
1600
  };
1620
1601
  SCMInputWidgetToolbar = ( __decorate([
1621
- ( __param(3, IMenuService)),
1622
- ( __param(4, IContextKeyService)),
1623
- ( __param(5, IContextMenuService)),
1624
- ( __param(6, ICommandService)),
1625
- ( __param(7, IKeybindingService)),
1626
- ( __param(8, IStorageService)),
1627
- ( __param(9, ITelemetryService))
1602
+ ( __param(4, IMenuService)),
1603
+ ( __param(5, IContextKeyService)),
1604
+ ( __param(6, IContextMenuService)),
1605
+ ( __param(7, ICommandService)),
1606
+ ( __param(8, IKeybindingService)),
1607
+ ( __param(9, IStorageService)),
1608
+ ( __param(10, ITelemetryService))
1628
1609
  ], SCMInputWidgetToolbar));
1629
1610
  let SCMInputWidget = class SCMInputWidget {
1630
1611
  static { SCMInputWidget_1 = this; }
@@ -1770,7 +1751,7 @@ let SCMInputWidget = class SCMInputWidget {
1770
1751
  ctxIsActionEnabled.set(( input.repository.provider.groups.some(r => r.resources.length > 0)));
1771
1752
  const actionRunner = instantiationService2.createInstance(SCMInputWidgetActionRunner, input);
1772
1753
  this.repositoryDisposables.add(actionRunner);
1773
- const toolbar = instantiationService2.createInstance(SCMInputWidgetToolbar, this.toolbarContainer, MenuId.SCMInputBox, {
1754
+ const toolbar = instantiationService2.createInstance(SCMInputWidgetToolbar, this.toolbarContainer, input, MenuId.SCMInputBox, {
1774
1755
  actionRunner,
1775
1756
  actionViewItemProvider: action => {
1776
1757
  if (action instanceof MenuItemAction && toolbar.dropdownActions.length > 1) {
@@ -2172,6 +2153,9 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2172
2153
  this.viewSortKeyContextKey.set(this.viewSortKey);
2173
2154
  this.areAllRepositoriesCollapsedContextKey = ContextKeys.SCMViewAreAllRepositoriesCollapsed.bindTo(contextKeyService);
2174
2155
  this.isAnyRepositoryCollapsibleContextKey = ContextKeys.SCMViewIsAnyRepositoryCollapsible.bindTo(contextKeyService);
2156
+ this.scmProviderContextKey = ContextKeys.SCMProvider.bindTo(contextKeyService);
2157
+ this.scmProviderRootUriContextKey = ContextKeys.SCMProviderRootUri.bindTo(contextKeyService);
2158
+ this.scmProviderHasRootUriContextKey = ContextKeys.SCMProviderHasRootUri.bindTo(contextKeyService);
2175
2159
  this._onDidLayout = ( new Emitter());
2176
2160
  this.layoutCache = { height: undefined, width: undefined, onDidChange: this._onDidLayout.event };
2177
2161
  this.storageService.onDidChangeValue(1 , undefined, this.disposables)(e => {
@@ -2576,6 +2560,7 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2576
2560
  if (focusedInput) {
2577
2561
  this.inputRenderer.getRenderedInputWidget(focusedInput)?.forEach(widget => widget.focus());
2578
2562
  }
2563
+ this.updateScmProviderContextKeys();
2579
2564
  this.updateRepositoryCollapseAllContextKeys();
2580
2565
  }));
2581
2566
  }
@@ -2585,6 +2570,19 @@ let SCMViewPane = class SCMViewPane extends ViewPane {
2585
2570
  this.treeContainer.classList.toggle('align-icons-and-twisties', (this.viewMode === "list" && theme.hasFileIcons) || (theme.hasFileIcons && !theme.hasFolderIcons));
2586
2571
  this.treeContainer.classList.toggle('hide-arrows', this.viewMode === "tree" && theme.hidesExplorerArrows === true);
2587
2572
  }
2573
+ updateScmProviderContextKeys() {
2574
+ if (!this.alwaysShowRepositories && this.items.size === 1) {
2575
+ const provider = Iterable.first(( this.items.keys())).provider;
2576
+ this.scmProviderContextKey.set(provider.contextValue);
2577
+ this.scmProviderRootUriContextKey.set(provider.rootUri?.toString());
2578
+ this.scmProviderHasRootUriContextKey.set(!!provider.rootUri);
2579
+ }
2580
+ else {
2581
+ this.scmProviderContextKey.set(undefined);
2582
+ this.scmProviderRootUriContextKey.set(undefined);
2583
+ this.scmProviderHasRootUriContextKey.set(false);
2584
+ }
2585
+ }
2588
2586
  updateRepositoryCollapseAllContextKeys() {
2589
2587
  if (!this.isBodyVisible() || this.items.size === 1) {
2590
2588
  this.isAnyRepositoryCollapsibleContextKey.set(false);