@codingame/monaco-vscode-scm-service-override 5.2.0 → 6.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 +41 -24
- package/vscode/src/vs/workbench/contrib/scm/browser/menus.js +1 -1
- package/vscode/src/vs/workbench/contrib/scm/browser/scm.contribution.js +74 -24
- package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoriesViewPane.js +3 -2
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPane.js +249 -202
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewService.js +11 -12
- package/vscode/src/vs/workbench/contrib/scm/browser/workingSet.js +12 -6
- package/vscode/src/vs/workbench/contrib/scm/common/scmService.js +10 -18
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
3
|
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
4
|
+
import { ISCMRepositorySortKey } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm';
|
|
4
5
|
import { ISCMService } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm.service';
|
|
5
6
|
import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
|
|
6
7
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
7
8
|
import { SCMMenus } from './menus.js';
|
|
9
|
+
import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
8
10
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
9
11
|
import { debounce } from 'vscode/vscode/vs/base/common/decorators';
|
|
10
12
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
@@ -27,17 +29,14 @@ function getRepositoryName(workspaceContextService, repository) {
|
|
|
27
29
|
return folder?.uri.toString() === ( repository.provider.rootUri.toString()) ? folder.name : basename(repository.provider.rootUri);
|
|
28
30
|
}
|
|
29
31
|
const RepositoryContextKeys = {
|
|
30
|
-
RepositorySortKey: ( new RawContextKey(
|
|
31
|
-
'scmRepositorySortKey',
|
|
32
|
-
"discoveryTime"
|
|
33
|
-
)),
|
|
32
|
+
RepositorySortKey: ( new RawContextKey('scmRepositorySortKey', ISCMRepositorySortKey.DiscoveryTime)),
|
|
34
33
|
};
|
|
35
34
|
let SCMViewService = class SCMViewService {
|
|
36
35
|
get repositories() {
|
|
37
36
|
return ( this._repositories.map(r => r.repository));
|
|
38
37
|
}
|
|
39
38
|
get visibleRepositories() {
|
|
40
|
-
if (this._repositoriesSortKey ===
|
|
39
|
+
if (this._repositoriesSortKey === ISCMRepositorySortKey.DiscoveryTime) {
|
|
41
40
|
return ( this._repositories.filter(r => r.selectionIndex !== -1)
|
|
42
41
|
.sort((r1, r2) => r1.selectionIndex - r2.selectionIndex)
|
|
43
42
|
.map(r => r.repository));
|
|
@@ -112,7 +111,7 @@ let SCMViewService = class SCMViewService {
|
|
|
112
111
|
this.onDidFocusRepository = this._onDidFocusRepository.event;
|
|
113
112
|
this.menus = instantiationService.createInstance(SCMMenus);
|
|
114
113
|
try {
|
|
115
|
-
this.previousState = JSON.parse(storageService.get('scm:view:visibleRepositories',
|
|
114
|
+
this.previousState = JSON.parse(storageService.get('scm:view:visibleRepositories', StorageScope.WORKSPACE, ''));
|
|
116
115
|
}
|
|
117
116
|
catch {
|
|
118
117
|
}
|
|
@@ -236,7 +235,7 @@ let SCMViewService = class SCMViewService {
|
|
|
236
235
|
}
|
|
237
236
|
}
|
|
238
237
|
compareRepositories(op1, op2) {
|
|
239
|
-
if (this._repositoriesSortKey ===
|
|
238
|
+
if (this._repositoriesSortKey === ISCMRepositorySortKey.DiscoveryTime) {
|
|
240
239
|
return op1.discoveryTime - op2.discoveryTime;
|
|
241
240
|
}
|
|
242
241
|
if (this._repositoriesSortKey === 'path' && op1.repository.provider.rootUri && op2.repository.provider.rootUri) {
|
|
@@ -258,13 +257,13 @@ let SCMViewService = class SCMViewService {
|
|
|
258
257
|
const sortOder = this.configurationService.getValue('scm.repositories.sortOrder');
|
|
259
258
|
switch (sortOder) {
|
|
260
259
|
case 'discovery time':
|
|
261
|
-
return
|
|
260
|
+
return ISCMRepositorySortKey.DiscoveryTime;
|
|
262
261
|
case 'name':
|
|
263
|
-
return
|
|
262
|
+
return ISCMRepositorySortKey.Name;
|
|
264
263
|
case 'path':
|
|
265
|
-
return
|
|
264
|
+
return ISCMRepositorySortKey.Path;
|
|
266
265
|
default:
|
|
267
|
-
return
|
|
266
|
+
return ISCMRepositorySortKey.DiscoveryTime;
|
|
268
267
|
}
|
|
269
268
|
}
|
|
270
269
|
insertRepositoryView(repositories, repositoryView) {
|
|
@@ -278,7 +277,7 @@ let SCMViewService = class SCMViewService {
|
|
|
278
277
|
const all = ( this.repositories.map(r => getProviderStorageKey(r.provider)));
|
|
279
278
|
const visible = ( this.visibleRepositories.map(r => all.indexOf(getProviderStorageKey(r.provider))));
|
|
280
279
|
this.previousState = { all, sortKey: this._repositoriesSortKey, visible };
|
|
281
|
-
this.storageService.store('scm:view:visibleRepositories', JSON.stringify(this.previousState),
|
|
280
|
+
this.storageService.store('scm:view:visibleRepositories', JSON.stringify(this.previousState), StorageScope.WORKSPACE, StorageTarget.MACHINE);
|
|
282
281
|
}
|
|
283
282
|
eventuallyFinishLoading() {
|
|
284
283
|
this.finishLoading();
|
|
@@ -2,18 +2,22 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
|
2
2
|
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
3
3
|
import { DisposableMap, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
4
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
5
|
+
import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
5
6
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
6
7
|
import { getProviderKey } from './util.js';
|
|
7
8
|
import { ISCMService } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm.service';
|
|
8
9
|
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
10
|
+
import { Parts } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
|
|
11
|
+
import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService.service';
|
|
9
12
|
|
|
10
13
|
let SCMWorkingSetController = class SCMWorkingSetController {
|
|
11
14
|
static { this.ID = 'workbench.contrib.scmWorkingSets'; }
|
|
12
|
-
constructor(configurationService, editorGroupsService, scmService, storageService) {
|
|
15
|
+
constructor(configurationService, editorGroupsService, scmService, storageService, layoutService) {
|
|
13
16
|
this.configurationService = configurationService;
|
|
14
17
|
this.editorGroupsService = editorGroupsService;
|
|
15
18
|
this.scmService = scmService;
|
|
16
19
|
this.storageService = storageService;
|
|
20
|
+
this.layoutService = layoutService;
|
|
17
21
|
this._repositoryDisposables = ( new DisposableMap());
|
|
18
22
|
this._scmServiceDisposables = ( new DisposableStore());
|
|
19
23
|
this._disposables = ( new DisposableStore());
|
|
@@ -22,7 +26,7 @@ let SCMWorkingSetController = class SCMWorkingSetController {
|
|
|
22
26
|
}
|
|
23
27
|
_onDidChangeConfiguration() {
|
|
24
28
|
if (!this.configurationService.getValue('scm.workingSets.enabled')) {
|
|
25
|
-
this.storageService.remove('scm.workingSets',
|
|
29
|
+
this.storageService.remove('scm.workingSets', StorageScope.WORKSPACE);
|
|
26
30
|
this._scmServiceDisposables.clear();
|
|
27
31
|
this._repositoryDisposables.clearAndDisposeAll();
|
|
28
32
|
return;
|
|
@@ -66,7 +70,7 @@ let SCMWorkingSetController = class SCMWorkingSetController {
|
|
|
66
70
|
}
|
|
67
71
|
_loadWorkingSets() {
|
|
68
72
|
const workingSets = ( new Map());
|
|
69
|
-
const workingSetsRaw = this.storageService.get('scm.workingSets',
|
|
73
|
+
const workingSetsRaw = this.storageService.get('scm.workingSets', StorageScope.WORKSPACE);
|
|
70
74
|
if (!workingSetsRaw) {
|
|
71
75
|
return workingSets;
|
|
72
76
|
}
|
|
@@ -87,7 +91,7 @@ let SCMWorkingSetController = class SCMWorkingSetController {
|
|
|
87
91
|
for (const [providerKey, { currentHistoryItemGroupId, editorWorkingSets }] of this._workingSets) {
|
|
88
92
|
workingSets.push({ providerKey, currentHistoryItemGroupId, editorWorkingSets: [...editorWorkingSets] });
|
|
89
93
|
}
|
|
90
|
-
this.storageService.store('scm.workingSets', JSON.stringify(workingSets),
|
|
94
|
+
this.storageService.store('scm.workingSets', JSON.stringify(workingSets), StorageScope.WORKSPACE, StorageTarget.MACHINE);
|
|
91
95
|
}
|
|
92
96
|
async _restoreWorkingSet(providerKey, currentHistoryItemGroupId) {
|
|
93
97
|
const workingSets = this._workingSets.get(providerKey);
|
|
@@ -99,7 +103,8 @@ let SCMWorkingSetController = class SCMWorkingSetController {
|
|
|
99
103
|
editorWorkingSetId = 'empty';
|
|
100
104
|
}
|
|
101
105
|
if (editorWorkingSetId) {
|
|
102
|
-
|
|
106
|
+
const preserveFocus = this.layoutService.hasFocus(Parts.PANEL_PART);
|
|
107
|
+
await this.editorGroupsService.applyWorkingSet(editorWorkingSetId, { preserveFocus });
|
|
103
108
|
}
|
|
104
109
|
}
|
|
105
110
|
dispose() {
|
|
@@ -112,7 +117,8 @@ SCMWorkingSetController = ( __decorate([
|
|
|
112
117
|
( __param(0, IConfigurationService)),
|
|
113
118
|
( __param(1, IEditorGroupsService)),
|
|
114
119
|
( __param(2, ISCMService)),
|
|
115
|
-
( __param(3, IStorageService))
|
|
120
|
+
( __param(3, IStorageService)),
|
|
121
|
+
( __param(4, IWorkbenchLayoutService))
|
|
116
122
|
], SCMWorkingSetController));
|
|
117
123
|
|
|
118
124
|
export { SCMWorkingSetController };
|
|
@@ -4,6 +4,7 @@ import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
|
4
4
|
import { SCMInputChangeReason } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm';
|
|
5
5
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
6
6
|
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
7
|
+
import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
7
8
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
8
9
|
import { HistoryNavigator2 } from 'vscode/vscode/vs/base/common/history';
|
|
9
10
|
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
@@ -36,13 +37,6 @@ class SCMInput {
|
|
|
36
37
|
this._visible = visible;
|
|
37
38
|
this._onDidChangeVisibility.fire(visible);
|
|
38
39
|
}
|
|
39
|
-
get actionButton() {
|
|
40
|
-
return this._actionButton;
|
|
41
|
-
}
|
|
42
|
-
set actionButton(actionButton) {
|
|
43
|
-
this._actionButton = actionButton;
|
|
44
|
-
this._onDidChangeActionButton.fire();
|
|
45
|
-
}
|
|
46
40
|
setFocus() {
|
|
47
41
|
this._onDidChangeFocus.fire();
|
|
48
42
|
}
|
|
@@ -71,8 +65,6 @@ class SCMInput {
|
|
|
71
65
|
this._visible = true;
|
|
72
66
|
this._onDidChangeVisibility = ( new Emitter());
|
|
73
67
|
this.onDidChangeVisibility = this._onDidChangeVisibility.event;
|
|
74
|
-
this._onDidChangeActionButton = ( new Emitter());
|
|
75
|
-
this.onDidChangeActionButton = this._onDidChangeActionButton.event;
|
|
76
68
|
this._onDidChangeFocus = ( new Emitter());
|
|
77
69
|
this.onDidChangeFocus = this._onDidChangeFocus.event;
|
|
78
70
|
this._onDidChangeValidationMessage = ( new Emitter());
|
|
@@ -178,7 +170,7 @@ let SCMInputHistory = class SCMInputHistory {
|
|
|
178
170
|
this._onWillSaveHistory = this.disposables.add(( new Emitter()));
|
|
179
171
|
this.onWillSaveHistory = this._onWillSaveHistory.event;
|
|
180
172
|
this.histories = ( new Map());
|
|
181
|
-
const entries = this.storageService.getObject('scm.history',
|
|
173
|
+
const entries = this.storageService.getObject('scm.history', StorageScope.WORKSPACE, []);
|
|
182
174
|
for (const [providerLabel, rootUri, history] of entries) {
|
|
183
175
|
let providerHistories = this.histories.get(providerLabel);
|
|
184
176
|
if (!providerHistories) {
|
|
@@ -190,9 +182,9 @@ let SCMInputHistory = class SCMInputHistory {
|
|
|
190
182
|
if (this.migrateStorage()) {
|
|
191
183
|
this.saveToStorage();
|
|
192
184
|
}
|
|
193
|
-
this.disposables.add(this.storageService.onDidChangeValue(
|
|
185
|
+
this.disposables.add(this.storageService.onDidChangeValue(StorageScope.WORKSPACE, 'scm.history', this.disposables)(e => {
|
|
194
186
|
if (e.external && e.key === 'scm.history') {
|
|
195
|
-
const raw = this.storageService.getObject('scm.history',
|
|
187
|
+
const raw = this.storageService.getObject('scm.history', StorageScope.WORKSPACE, []);
|
|
196
188
|
for (const [providerLabel, uri, rawHistory] of raw) {
|
|
197
189
|
const history = this.getHistory(providerLabel, uri);
|
|
198
190
|
for (const value of Iterable.reverse(rawHistory)) {
|
|
@@ -218,7 +210,7 @@ let SCMInputHistory = class SCMInputHistory {
|
|
|
218
210
|
}
|
|
219
211
|
}
|
|
220
212
|
}
|
|
221
|
-
this.storageService.store('scm.history', raw,
|
|
213
|
+
this.storageService.store('scm.history', raw, StorageScope.WORKSPACE, StorageTarget.USER);
|
|
222
214
|
}
|
|
223
215
|
getHistory(providerLabel, rootUri) {
|
|
224
216
|
let providerHistories = this.histories.get(providerLabel);
|
|
@@ -235,13 +227,13 @@ let SCMInputHistory = class SCMInputHistory {
|
|
|
235
227
|
}
|
|
236
228
|
migrateStorage() {
|
|
237
229
|
let didSomethingChange = false;
|
|
238
|
-
const machineKeys = Iterable.filter(( this.storageService.keys(
|
|
230
|
+
const machineKeys = Iterable.filter(( this.storageService.keys(StorageScope.APPLICATION, StorageTarget.MACHINE)), key => key.startsWith('scm/input:'));
|
|
239
231
|
for (const key of machineKeys) {
|
|
240
232
|
try {
|
|
241
|
-
const legacyHistory = JSON.parse(this.storageService.get(key,
|
|
233
|
+
const legacyHistory = JSON.parse(this.storageService.get(key, StorageScope.APPLICATION, ''));
|
|
242
234
|
const match = /^scm\/input:([^:]+):(.+)$/.exec(key);
|
|
243
235
|
if (!match || !Array.isArray(legacyHistory?.history) || !Number.isInteger(legacyHistory?.timestamp)) {
|
|
244
|
-
this.storageService.remove(key,
|
|
236
|
+
this.storageService.remove(key, StorageScope.APPLICATION);
|
|
245
237
|
continue;
|
|
246
238
|
}
|
|
247
239
|
const [, providerLabel, rootPath] = match;
|
|
@@ -252,11 +244,11 @@ let SCMInputHistory = class SCMInputHistory {
|
|
|
252
244
|
history.prepend(entry);
|
|
253
245
|
}
|
|
254
246
|
didSomethingChange = true;
|
|
255
|
-
this.storageService.remove(key,
|
|
247
|
+
this.storageService.remove(key, StorageScope.APPLICATION);
|
|
256
248
|
}
|
|
257
249
|
}
|
|
258
250
|
catch {
|
|
259
|
-
this.storageService.remove(key,
|
|
251
|
+
this.storageService.remove(key, StorageScope.APPLICATION);
|
|
260
252
|
}
|
|
261
253
|
}
|
|
262
254
|
return didSomethingChange;
|