@codingame/monaco-vscode-scm-service-override 7.1.0 → 8.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.
@@ -1,6 +1,6 @@
1
1
  import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
2
  import './media/scm.css.js';
3
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
+ import { localize } from 'vscode/vscode/vs/nls';
4
4
  import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
5
5
  import { VIEWLET_ID } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm';
6
6
  import { ISCMViewService } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm.service';
@@ -15,7 +15,6 @@ import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/co
15
15
  import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views.service';
16
16
  import { ViewPaneContainer } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPaneContainer';
17
17
 
18
- const _moduleId = "vs/workbench/contrib/scm/browser/scmViewPaneContainer";
19
18
  let SCMViewPaneContainer = class SCMViewPaneContainer extends ViewPaneContainer {
20
19
  constructor(scmViewService, layoutService, telemetryService, instantiationService, contextMenuService, themeService, storageService, configurationService, extensionService, contextService, viewDescriptorService) {
21
20
  super(VIEWLET_ID, { mergeViewWithContainerWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService, viewDescriptorService);
@@ -29,7 +28,7 @@ let SCMViewPaneContainer = class SCMViewPaneContainer extends ViewPaneContainer
29
28
  return 400;
30
29
  }
31
30
  getTitle() {
32
- return ( localizeWithPath(_moduleId, 0, "Source Control"));
31
+ return ( localize(6320, "Source Control"));
33
32
  }
34
33
  getActionsContext() {
35
34
  return this.scmViewService.visibleRepositories.length === 1 ? this.scmViewService.visibleRepositories[0].provider : undefined;
@@ -1,7 +1,12 @@
1
1
  import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
- import { Event } from 'vscode/vscode/vs/base/common/event';
3
- import { DisposableMap, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
2
+ import { Disposable, DisposableMap, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
3
+ import 'vscode/vscode/vs/base/common/arrays';
4
+ import 'vscode/vscode/vs/base/common/observableInternal/derived';
5
+ import { autorunWithStore, autorun } from 'vscode/vscode/vs/base/common/observableInternal/autorun';
6
+ import 'vscode/vscode/vs/base/common/observableInternal/utils';
7
+ import 'vscode/vscode/vs/base/common/cancellation';
4
8
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
9
+ import { observableConfigValue } from 'vscode/vscode/vs/platform/observable/common/platformObservableUtils';
5
10
  import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
6
11
  import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
7
12
  import { getProviderKey } from './util.js';
@@ -10,62 +15,54 @@ import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor
10
15
  import { Parts } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
11
16
  import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService.service';
12
17
 
13
- let SCMWorkingSetController = class SCMWorkingSetController {
18
+ let SCMWorkingSetController = class SCMWorkingSetController extends Disposable {
14
19
  static { this.ID = 'workbench.contrib.scmWorkingSets'; }
15
20
  constructor(configurationService, editorGroupsService, scmService, storageService, layoutService) {
21
+ super();
16
22
  this.configurationService = configurationService;
17
23
  this.editorGroupsService = editorGroupsService;
18
24
  this.scmService = scmService;
19
25
  this.storageService = storageService;
20
26
  this.layoutService = layoutService;
27
+ this._enabledConfig = observableConfigValue('scm.workingSets.enabled', false, this.configurationService);
21
28
  this._repositoryDisposables = ( new DisposableMap());
22
- this._scmServiceDisposables = ( new DisposableStore());
23
- this._disposables = ( new DisposableStore());
24
- const onDidChangeConfiguration = Event.filter(configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.workingSets.enabled'), this._disposables);
25
- this._disposables.add(Event.runAndSubscribe(onDidChangeConfiguration, () => this._onDidChangeConfiguration()));
26
- }
27
- _onDidChangeConfiguration() {
28
- if (!this.configurationService.getValue('scm.workingSets.enabled')) {
29
- this.storageService.remove('scm.workingSets', StorageScope.WORKSPACE);
30
- this._scmServiceDisposables.clear();
31
- this._repositoryDisposables.clearAndDisposeAll();
32
- return;
33
- }
34
- this._workingSets = this._loadWorkingSets();
35
- this.scmService.onDidAddRepository(this._onDidAddRepository, this, this._scmServiceDisposables);
36
- this.scmService.onDidRemoveRepository(this._onDidRemoveRepository, this, this._scmServiceDisposables);
37
- for (const repository of this.scmService.repositories) {
38
- this._onDidAddRepository(repository);
39
- }
29
+ this._store.add(autorunWithStore((reader, store) => {
30
+ if (!this._enabledConfig.read(reader)) {
31
+ this.storageService.remove('scm.workingSets', StorageScope.WORKSPACE);
32
+ this._repositoryDisposables.clearAndDisposeAll();
33
+ return;
34
+ }
35
+ this._workingSets = this._loadWorkingSets();
36
+ this.scmService.onDidAddRepository(this._onDidAddRepository, this, store);
37
+ this.scmService.onDidRemoveRepository(this._onDidRemoveRepository, this, store);
38
+ for (const repository of this.scmService.repositories) {
39
+ this._onDidAddRepository(repository);
40
+ }
41
+ }));
40
42
  }
41
43
  _onDidAddRepository(repository) {
42
44
  const disposables = ( new DisposableStore());
43
- disposables.add(Event.runAndSubscribe(repository.provider.onDidChangeHistoryProvider, () => {
44
- if (!repository.provider.historyProvider) {
45
+ disposables.add(autorun(async (reader) => {
46
+ const historyProvider = repository.provider.historyProvider.read(reader);
47
+ const currentHistoryItemGroupId = historyProvider?.currentHistoryItemGroupId.read(reader);
48
+ if (!currentHistoryItemGroupId) {
49
+ return;
50
+ }
51
+ const providerKey = getProviderKey(repository.provider);
52
+ const repositoryWorkingSets = this._workingSets.get(providerKey);
53
+ if (!repositoryWorkingSets) {
54
+ this._workingSets.set(providerKey, { currentHistoryItemGroupId, editorWorkingSets: ( new Map()) });
55
+ return;
56
+ }
57
+ if (repositoryWorkingSets.currentHistoryItemGroupId === currentHistoryItemGroupId) {
45
58
  return;
46
59
  }
47
- disposables.add(Event.runAndSubscribe(repository.provider.historyProvider.onDidChangeCurrentHistoryItemGroup, async () => {
48
- if (!repository.provider.historyProvider?.currentHistoryItemGroup?.id) {
49
- return;
50
- }
51
- const providerKey = getProviderKey(repository.provider);
52
- const currentHistoryItemGroupId = repository.provider.historyProvider.currentHistoryItemGroup.id;
53
- const repositoryWorkingSets = this._workingSets.get(providerKey);
54
- if (!repositoryWorkingSets) {
55
- this._workingSets.set(providerKey, { currentHistoryItemGroupId, editorWorkingSets: ( new Map()) });
56
- return;
57
- }
58
- if (repositoryWorkingSets.currentHistoryItemGroupId === currentHistoryItemGroupId) {
59
- return;
60
- }
61
- this._saveWorkingSet(providerKey, currentHistoryItemGroupId, repositoryWorkingSets);
62
- await this._restoreWorkingSet(providerKey, currentHistoryItemGroupId);
63
- }));
60
+ this._saveWorkingSet(providerKey, currentHistoryItemGroupId, repositoryWorkingSets);
61
+ await this._restoreWorkingSet(providerKey, currentHistoryItemGroupId);
64
62
  }));
65
63
  this._repositoryDisposables.set(repository, disposables);
66
64
  }
67
65
  _onDidRemoveRepository(repository) {
68
- this._workingSets.delete(getProviderKey(repository.provider));
69
66
  this._repositoryDisposables.deleteAndDispose(repository);
70
67
  }
71
68
  _loadWorkingSets() {
@@ -109,8 +106,7 @@ let SCMWorkingSetController = class SCMWorkingSetController {
109
106
  }
110
107
  dispose() {
111
108
  this._repositoryDisposables.dispose();
112
- this._scmServiceDisposables.dispose();
113
- this._disposables.dispose();
109
+ super.dispose();
114
110
  }
115
111
  };
116
112
  SCMWorkingSetController = ( __decorate([