@codingame/monaco-vscode-scm-service-override 4.5.1 → 5.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.
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/scm/browser/activity.js +39 -47
- package/vscode/src/vs/workbench/contrib/scm/browser/media/scm.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/scm/browser/menus.js +35 -34
- package/vscode/src/vs/workbench/contrib/scm/browser/scm.contribution.js +189 -288
- package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoriesViewPane.js +28 -29
- package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoryRenderer.js +2 -1
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPane.js +513 -568
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPaneContainer.js +15 -18
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewService.js +14 -9
- package/vscode/src/vs/workbench/contrib/scm/browser/util.js +4 -1
- package/vscode/src/vs/workbench/contrib/scm/browser/workingSet.js +118 -0
- package/vscode/src/vs/workbench/contrib/scm/common/scmService.js +1 -1
|
@@ -15,6 +15,7 @@ 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";
|
|
18
19
|
let SCMViewPaneContainer = class SCMViewPaneContainer extends ViewPaneContainer {
|
|
19
20
|
constructor(scmViewService, layoutService, telemetryService, instantiationService, contextMenuService, themeService, storageService, configurationService, extensionService, contextService, viewDescriptorService) {
|
|
20
21
|
super(VIEWLET_ID, { mergeViewWithContainerWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService, viewDescriptorService);
|
|
@@ -28,28 +29,24 @@ let SCMViewPaneContainer = class SCMViewPaneContainer extends ViewPaneContainer
|
|
|
28
29
|
return 400;
|
|
29
30
|
}
|
|
30
31
|
getTitle() {
|
|
31
|
-
return ( localizeWithPath(
|
|
32
|
-
'vs/workbench/contrib/scm/browser/scmViewPaneContainer',
|
|
33
|
-
'source control',
|
|
34
|
-
"Source Control"
|
|
35
|
-
));
|
|
32
|
+
return ( localizeWithPath(_moduleId, 0, "Source Control"));
|
|
36
33
|
}
|
|
37
34
|
getActionsContext() {
|
|
38
35
|
return this.scmViewService.visibleRepositories.length === 1 ? this.scmViewService.visibleRepositories[0].provider : undefined;
|
|
39
36
|
}
|
|
40
37
|
};
|
|
41
|
-
SCMViewPaneContainer = ( __decorate([
|
|
42
|
-
( __param(0, ISCMViewService)),
|
|
43
|
-
( __param(1, IWorkbenchLayoutService)),
|
|
44
|
-
( __param(2, ITelemetryService)),
|
|
45
|
-
( __param(3, IInstantiationService)),
|
|
46
|
-
( __param(4, IContextMenuService)),
|
|
47
|
-
( __param(5, IThemeService)),
|
|
48
|
-
( __param(6, IStorageService)),
|
|
49
|
-
( __param(7, IConfigurationService)),
|
|
50
|
-
( __param(8, IExtensionService)),
|
|
51
|
-
( __param(9, IWorkspaceContextService)),
|
|
52
|
-
( __param(10, IViewDescriptorService))
|
|
53
|
-
], SCMViewPaneContainer));
|
|
38
|
+
SCMViewPaneContainer = ( (__decorate([
|
|
39
|
+
( (__param(0, ISCMViewService))),
|
|
40
|
+
( (__param(1, IWorkbenchLayoutService))),
|
|
41
|
+
( (__param(2, ITelemetryService))),
|
|
42
|
+
( (__param(3, IInstantiationService))),
|
|
43
|
+
( (__param(4, IContextMenuService))),
|
|
44
|
+
( (__param(5, IThemeService))),
|
|
45
|
+
( (__param(6, IStorageService))),
|
|
46
|
+
( (__param(7, IConfigurationService))),
|
|
47
|
+
( (__param(8, IExtensionService))),
|
|
48
|
+
( (__param(9, IWorkspaceContextService))),
|
|
49
|
+
( (__param(10, IViewDescriptorService)))
|
|
50
|
+
], SCMViewPaneContainer)));
|
|
54
51
|
|
|
55
52
|
export { SCMViewPaneContainer };
|
|
@@ -14,6 +14,7 @@ import { binarySearch } from 'vscode/vscode/vs/base/common/arrays';
|
|
|
14
14
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
15
15
|
import { RawContextKey } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
16
16
|
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
17
|
+
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
17
18
|
|
|
18
19
|
function getProviderStorageKey(provider) {
|
|
19
20
|
return `${provider.contextValue}:${provider.label}${provider.rootUri ? `:${( provider.rootUri.toString())}` : ''}`;
|
|
@@ -72,7 +73,7 @@ let SCMViewService = class SCMViewService {
|
|
|
72
73
|
get focusedRepository() {
|
|
73
74
|
return this._repositories.find(r => r.focused)?.repository;
|
|
74
75
|
}
|
|
75
|
-
constructor(scmService, contextKeyService, instantiationService, configurationService, storageService, workspaceContextService) {
|
|
76
|
+
constructor(scmService, contextKeyService, extensionService, instantiationService, configurationService, storageService, workspaceContextService) {
|
|
76
77
|
this.configurationService = configurationService;
|
|
77
78
|
this.storageService = storageService;
|
|
78
79
|
this.workspaceContextService = workspaceContextService;
|
|
@@ -124,6 +125,10 @@ let SCMViewService = class SCMViewService {
|
|
|
124
125
|
this.onDidAddRepository(repository);
|
|
125
126
|
}
|
|
126
127
|
storageService.onWillSaveState(this.onWillSaveState, this, this.disposables);
|
|
128
|
+
extensionService.onWillStop(() => {
|
|
129
|
+
this.onWillSaveState();
|
|
130
|
+
this.didFinishLoading = false;
|
|
131
|
+
}, this, this.disposables);
|
|
127
132
|
}
|
|
128
133
|
onDidAddRepository(repository) {
|
|
129
134
|
if (!this.didFinishLoading) {
|
|
@@ -133,7 +138,7 @@ let SCMViewService = class SCMViewService {
|
|
|
133
138
|
repository, discoveryTime: Date.now(), focused: false, selectionIndex: -1
|
|
134
139
|
};
|
|
135
140
|
let removed = Iterable.empty();
|
|
136
|
-
if (this.previousState) {
|
|
141
|
+
if (this.previousState && !this.didFinishLoading) {
|
|
137
142
|
const index = this.previousState.all.indexOf(getProviderStorageKey(repository.provider));
|
|
138
143
|
if (index === -1) {
|
|
139
144
|
const added = [];
|
|
@@ -272,8 +277,8 @@ let SCMViewService = class SCMViewService {
|
|
|
272
277
|
}
|
|
273
278
|
const all = ( this.repositories.map(r => getProviderStorageKey(r.provider)));
|
|
274
279
|
const visible = ( this.visibleRepositories.map(r => all.indexOf(getProviderStorageKey(r.provider))));
|
|
275
|
-
|
|
276
|
-
this.storageService.store('scm:view:visibleRepositories',
|
|
280
|
+
this.previousState = { all, sortKey: this._repositoriesSortKey, visible };
|
|
281
|
+
this.storageService.store('scm:view:visibleRepositories', JSON.stringify(this.previousState), 1 , 1 );
|
|
277
282
|
}
|
|
278
283
|
eventuallyFinishLoading() {
|
|
279
284
|
this.finishLoading();
|
|
@@ -283,7 +288,6 @@ let SCMViewService = class SCMViewService {
|
|
|
283
288
|
return;
|
|
284
289
|
}
|
|
285
290
|
this.didFinishLoading = true;
|
|
286
|
-
this.previousState = undefined;
|
|
287
291
|
}
|
|
288
292
|
dispose() {
|
|
289
293
|
this.disposables.dispose();
|
|
@@ -297,10 +301,11 @@ SCMViewService.__decorator = ( __decorate([
|
|
|
297
301
|
SCMViewService = ( __decorate([
|
|
298
302
|
( __param(0, ISCMService)),
|
|
299
303
|
( __param(1, IContextKeyService)),
|
|
300
|
-
( __param(2,
|
|
301
|
-
( __param(3,
|
|
302
|
-
( __param(4,
|
|
303
|
-
( __param(5,
|
|
304
|
+
( __param(2, IExtensionService)),
|
|
305
|
+
( __param(3, IInstantiationService)),
|
|
306
|
+
( __param(4, IConfigurationService)),
|
|
307
|
+
( __param(5, IStorageService)),
|
|
308
|
+
( __param(6, IWorkspaceContextService))
|
|
304
309
|
], SCMViewService));
|
|
305
310
|
|
|
306
311
|
export { RepositoryContextKeys, SCMViewService };
|
|
@@ -117,5 +117,8 @@ function getActionViewItemProvider(instaService) {
|
|
|
117
117
|
return createActionViewItem(instaService, action, options);
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
|
+
function getProviderKey(provider) {
|
|
121
|
+
return `${provider.contextValue}:${provider.label}${provider.rootUri ? `:${( provider.rootUri.toString())}` : ''}`;
|
|
122
|
+
}
|
|
120
123
|
|
|
121
|
-
export { StatusBarAction, collectContextMenuActions, connectPrimaryMenu, connectPrimaryMenuToInlineActionBar, getActionViewItemProvider, isSCMActionButton, isSCMHistoryItemChangeNode, isSCMHistoryItemChangeTreeElement, isSCMHistoryItemGroupTreeElement, isSCMHistoryItemTreeElement, isSCMInput, isSCMRepository, isSCMResource, isSCMResourceGroup, isSCMResourceNode, isSCMViewSeparator, isSCMViewService, toDiffEditorArguments };
|
|
124
|
+
export { StatusBarAction, collectContextMenuActions, connectPrimaryMenu, connectPrimaryMenuToInlineActionBar, getActionViewItemProvider, getProviderKey, isSCMActionButton, isSCMHistoryItemChangeNode, isSCMHistoryItemChangeTreeElement, isSCMHistoryItemGroupTreeElement, isSCMHistoryItemTreeElement, isSCMInput, isSCMRepository, isSCMResource, isSCMResourceGroup, isSCMResourceNode, isSCMViewSeparator, isSCMViewService, toDiffEditorArguments };
|
|
@@ -0,0 +1,118 @@
|
|
|
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';
|
|
4
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
5
|
+
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
6
|
+
import { getProviderKey } from './util.js';
|
|
7
|
+
import { ISCMService } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm.service';
|
|
8
|
+
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
9
|
+
|
|
10
|
+
let SCMWorkingSetController = class SCMWorkingSetController {
|
|
11
|
+
static { this.ID = 'workbench.contrib.scmWorkingSets'; }
|
|
12
|
+
constructor(configurationService, editorGroupsService, scmService, storageService) {
|
|
13
|
+
this.configurationService = configurationService;
|
|
14
|
+
this.editorGroupsService = editorGroupsService;
|
|
15
|
+
this.scmService = scmService;
|
|
16
|
+
this.storageService = storageService;
|
|
17
|
+
this._repositoryDisposables = ( new DisposableMap());
|
|
18
|
+
this._scmServiceDisposables = ( new DisposableStore());
|
|
19
|
+
this._disposables = ( new DisposableStore());
|
|
20
|
+
const onDidChangeConfiguration = Event.filter(configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.workingSets.enabled'), this._disposables);
|
|
21
|
+
this._disposables.add(Event.runAndSubscribe(onDidChangeConfiguration, () => this._onDidChangeConfiguration()));
|
|
22
|
+
}
|
|
23
|
+
_onDidChangeConfiguration() {
|
|
24
|
+
if (!this.configurationService.getValue('scm.workingSets.enabled')) {
|
|
25
|
+
this.storageService.remove('scm.workingSets', 1 );
|
|
26
|
+
this._scmServiceDisposables.clear();
|
|
27
|
+
this._repositoryDisposables.clearAndDisposeAll();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
this._workingSets = this._loadWorkingSets();
|
|
31
|
+
this.scmService.onDidAddRepository(this._onDidAddRepository, this, this._scmServiceDisposables);
|
|
32
|
+
this.scmService.onDidRemoveRepository(this._onDidRemoveRepository, this, this._scmServiceDisposables);
|
|
33
|
+
for (const repository of this.scmService.repositories) {
|
|
34
|
+
this._onDidAddRepository(repository);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
_onDidAddRepository(repository) {
|
|
38
|
+
const disposables = ( new DisposableStore());
|
|
39
|
+
disposables.add(Event.runAndSubscribe(repository.provider.onDidChangeHistoryProvider, () => {
|
|
40
|
+
if (!repository.provider.historyProvider) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
disposables.add(Event.runAndSubscribe(repository.provider.historyProvider.onDidChangeCurrentHistoryItemGroup, async () => {
|
|
44
|
+
if (!repository.provider.historyProvider?.currentHistoryItemGroup?.id) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const providerKey = getProviderKey(repository.provider);
|
|
48
|
+
const currentHistoryItemGroupId = repository.provider.historyProvider.currentHistoryItemGroup.id;
|
|
49
|
+
const repositoryWorkingSets = this._workingSets.get(providerKey);
|
|
50
|
+
if (!repositoryWorkingSets) {
|
|
51
|
+
this._workingSets.set(providerKey, { currentHistoryItemGroupId, editorWorkingSets: ( new Map()) });
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (repositoryWorkingSets.currentHistoryItemGroupId === currentHistoryItemGroupId) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
this._saveWorkingSet(providerKey, currentHistoryItemGroupId, repositoryWorkingSets);
|
|
58
|
+
await this._restoreWorkingSet(providerKey, currentHistoryItemGroupId);
|
|
59
|
+
}));
|
|
60
|
+
}));
|
|
61
|
+
this._repositoryDisposables.set(repository, disposables);
|
|
62
|
+
}
|
|
63
|
+
_onDidRemoveRepository(repository) {
|
|
64
|
+
this._workingSets.delete(getProviderKey(repository.provider));
|
|
65
|
+
this._repositoryDisposables.deleteAndDispose(repository);
|
|
66
|
+
}
|
|
67
|
+
_loadWorkingSets() {
|
|
68
|
+
const workingSets = ( new Map());
|
|
69
|
+
const workingSetsRaw = this.storageService.get('scm.workingSets', 1 );
|
|
70
|
+
if (!workingSetsRaw) {
|
|
71
|
+
return workingSets;
|
|
72
|
+
}
|
|
73
|
+
for (const serializedWorkingSet of JSON.parse(workingSetsRaw)) {
|
|
74
|
+
workingSets.set(serializedWorkingSet.providerKey, {
|
|
75
|
+
currentHistoryItemGroupId: serializedWorkingSet.currentHistoryItemGroupId,
|
|
76
|
+
editorWorkingSets: ( new Map(serializedWorkingSet.editorWorkingSets))
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return workingSets;
|
|
80
|
+
}
|
|
81
|
+
_saveWorkingSet(providerKey, currentHistoryItemGroupId, repositoryWorkingSets) {
|
|
82
|
+
const previousHistoryItemGroupId = repositoryWorkingSets.currentHistoryItemGroupId;
|
|
83
|
+
const editorWorkingSets = repositoryWorkingSets.editorWorkingSets;
|
|
84
|
+
const editorWorkingSet = this.editorGroupsService.saveWorkingSet(previousHistoryItemGroupId);
|
|
85
|
+
this._workingSets.set(providerKey, { currentHistoryItemGroupId, editorWorkingSets: editorWorkingSets.set(previousHistoryItemGroupId, editorWorkingSet) });
|
|
86
|
+
const workingSets = [];
|
|
87
|
+
for (const [providerKey, { currentHistoryItemGroupId, editorWorkingSets }] of this._workingSets) {
|
|
88
|
+
workingSets.push({ providerKey, currentHistoryItemGroupId, editorWorkingSets: [...editorWorkingSets] });
|
|
89
|
+
}
|
|
90
|
+
this.storageService.store('scm.workingSets', JSON.stringify(workingSets), 1 , 1 );
|
|
91
|
+
}
|
|
92
|
+
async _restoreWorkingSet(providerKey, currentHistoryItemGroupId) {
|
|
93
|
+
const workingSets = this._workingSets.get(providerKey);
|
|
94
|
+
if (!workingSets) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
let editorWorkingSetId = workingSets.editorWorkingSets.get(currentHistoryItemGroupId);
|
|
98
|
+
if (!editorWorkingSetId && this.configurationService.getValue('scm.workingSets.default') === 'empty') {
|
|
99
|
+
editorWorkingSetId = 'empty';
|
|
100
|
+
}
|
|
101
|
+
if (editorWorkingSetId) {
|
|
102
|
+
await this.editorGroupsService.applyWorkingSet(editorWorkingSetId);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
dispose() {
|
|
106
|
+
this._repositoryDisposables.dispose();
|
|
107
|
+
this._scmServiceDisposables.dispose();
|
|
108
|
+
this._disposables.dispose();
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
SCMWorkingSetController = ( __decorate([
|
|
112
|
+
( __param(0, IConfigurationService)),
|
|
113
|
+
( __param(1, IEditorGroupsService)),
|
|
114
|
+
( __param(2, ISCMService)),
|
|
115
|
+
( __param(3, IStorageService))
|
|
116
|
+
], SCMWorkingSetController));
|
|
117
|
+
|
|
118
|
+
export { SCMWorkingSetController };
|
|
@@ -285,7 +285,7 @@ let SCMService = class SCMService {
|
|
|
285
285
|
registerSCMProvider(provider) {
|
|
286
286
|
this.logService.trace('SCMService#registerSCMProvider');
|
|
287
287
|
if (( this._repositories.has(provider.id))) {
|
|
288
|
-
throw new Error(`SCM Provider ${provider.id} already exists.`);
|
|
288
|
+
throw ( new Error(`SCM Provider ${provider.id} already exists.`));
|
|
289
289
|
}
|
|
290
290
|
const disposable = toDisposable(() => {
|
|
291
291
|
this._repositories.delete(provider.id);
|