@codingame/monaco-vscode-scm-service-override 9.0.3 → 10.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 +24 -37
- package/vscode/src/vs/workbench/contrib/scm/browser/media/scm.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/scm/browser/menus.js +2 -77
- package/vscode/src/vs/workbench/contrib/scm/browser/scm.contribution.js +172 -123
- package/vscode/src/vs/workbench/contrib/scm/browser/scmHistoryViewPane.js +914 -501
- package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoriesViewPane.js +4 -5
- package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoryRenderer.js +4 -3
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPane.js +106 -916
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPaneContainer.js +12 -2
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewService.js +45 -17
- package/vscode/src/vs/workbench/contrib/scm/browser/workingSet.js +19 -16
- package/vscode/src/vs/workbench/contrib/scm/common/scmService.js +9 -10
- package/vscode/src/vs/workbench/contrib/scm/browser/scmHistory.js +0 -222
- package/vscode/src/vs/workbench/contrib/scm/browser/util.js +0 -133
|
@@ -2,7 +2,7 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
|
2
2
|
import './media/scm.css.js';
|
|
3
3
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
4
4
|
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
5
|
-
import { VIEWLET_ID } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm';
|
|
5
|
+
import { VIEWLET_ID, VIEW_PANE_ID, REPOSITORIES_VIEW_PANE_ID, HISTORY_VIEW_PANE_ID } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm';
|
|
6
6
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
7
7
|
import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView.service';
|
|
8
8
|
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService.service';
|
|
@@ -26,7 +26,17 @@ let SCMViewPaneContainer = class SCMViewPaneContainer extends ViewPaneContainer
|
|
|
26
26
|
return 400;
|
|
27
27
|
}
|
|
28
28
|
getTitle() {
|
|
29
|
-
|
|
29
|
+
if (this.panes.length === 1) {
|
|
30
|
+
if (this.panes[0].id === VIEW_PANE_ID ||
|
|
31
|
+
this.panes[0].id === REPOSITORIES_VIEW_PANE_ID ||
|
|
32
|
+
this.panes[0].id === HISTORY_VIEW_PANE_ID) {
|
|
33
|
+
return this.panes[0].title;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return super.getTitle();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return ( localize(6601, "Source Control"));
|
|
30
40
|
}
|
|
31
41
|
};
|
|
32
42
|
SCMViewPaneContainer = ( (__decorate([
|
|
@@ -1,12 +1,10 @@
|
|
|
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';
|
|
5
4
|
import { ISCMService } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm.service';
|
|
6
5
|
import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
|
|
7
6
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
8
7
|
import { SCMMenus } from './menus.js';
|
|
9
|
-
import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
10
8
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
11
9
|
import { debounce } from 'vscode/vscode/vs/base/common/decorators';
|
|
12
10
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
@@ -17,6 +15,12 @@ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/c
|
|
|
17
15
|
import { RawContextKey } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
18
16
|
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
19
17
|
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
18
|
+
import 'vscode/vscode/vs/base/common/observableInternal/autorun';
|
|
19
|
+
import { derivedOpts } from 'vscode/vscode/vs/base/common/observableInternal/derived';
|
|
20
|
+
import 'vscode/vscode/vs/base/common/cancellation';
|
|
21
|
+
import { observableFromEventOpts, derivedObservableWithCache, latestChangedValue } from 'vscode/vscode/vs/base/common/observableInternal/utils';
|
|
22
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
23
|
+
import { EditorResourceAccessor } from 'vscode/vscode/vs/workbench/common/editor';
|
|
20
24
|
|
|
21
25
|
function getProviderStorageKey(provider) {
|
|
22
26
|
return `${provider.contextValue}:${provider.label}${provider.rootUri ? `:${( provider.rootUri.toString())}` : ''}`;
|
|
@@ -29,14 +33,17 @@ function getRepositoryName(workspaceContextService, repository) {
|
|
|
29
33
|
return folder?.uri.toString() === ( repository.provider.rootUri.toString()) ? folder.name : basename(repository.provider.rootUri);
|
|
30
34
|
}
|
|
31
35
|
const RepositoryContextKeys = {
|
|
32
|
-
RepositorySortKey: ( new RawContextKey(
|
|
36
|
+
RepositorySortKey: ( new RawContextKey(
|
|
37
|
+
'scmRepositorySortKey',
|
|
38
|
+
"discoveryTime"
|
|
39
|
+
)),
|
|
33
40
|
};
|
|
34
41
|
let SCMViewService = class SCMViewService {
|
|
35
42
|
get repositories() {
|
|
36
43
|
return ( this._repositories.map(r => r.repository));
|
|
37
44
|
}
|
|
38
45
|
get visibleRepositories() {
|
|
39
|
-
if (this._repositoriesSortKey ===
|
|
46
|
+
if (this._repositoriesSortKey === "discoveryTime" ) {
|
|
40
47
|
return ( this._repositories.filter(r => r.selectionIndex !== -1)
|
|
41
48
|
.sort((r1, r2) => r1.selectionIndex - r2.selectionIndex)
|
|
42
49
|
.map(r => r.repository));
|
|
@@ -72,7 +79,9 @@ let SCMViewService = class SCMViewService {
|
|
|
72
79
|
get focusedRepository() {
|
|
73
80
|
return this._repositories.find(r => r.focused)?.repository;
|
|
74
81
|
}
|
|
75
|
-
constructor(scmService, contextKeyService, extensionService, instantiationService, configurationService, storageService, workspaceContextService) {
|
|
82
|
+
constructor(scmService, contextKeyService, editorService, extensionService, instantiationService, configurationService, storageService, workspaceContextService) {
|
|
83
|
+
this.scmService = scmService;
|
|
84
|
+
this.editorService = editorService;
|
|
76
85
|
this.configurationService = configurationService;
|
|
77
86
|
this.storageService = storageService;
|
|
78
87
|
this.workspaceContextService = workspaceContextService;
|
|
@@ -109,9 +118,27 @@ let SCMViewService = class SCMViewService {
|
|
|
109
118
|
}, 0, undefined, undefined, undefined, this.disposables));
|
|
110
119
|
this._onDidFocusRepository = ( new Emitter());
|
|
111
120
|
this.onDidFocusRepository = this._onDidFocusRepository.event;
|
|
121
|
+
this._focusedRepository = observableFromEventOpts({ owner: this, equalsFn: () => false }, this.onDidFocusRepository, () => this.focusedRepository);
|
|
122
|
+
this._activeEditor = observableFromEventOpts({ owner: this, equalsFn: () => false }, this.editorService.onDidActiveEditorChange, () => this.editorService.activeEditor);
|
|
123
|
+
this._activeEditorRepository = derivedObservableWithCache(this, (reader, lastValue) => {
|
|
124
|
+
const activeResource = EditorResourceAccessor.getOriginalUri(this._activeEditor.read(reader));
|
|
125
|
+
if (!activeResource) {
|
|
126
|
+
return lastValue;
|
|
127
|
+
}
|
|
128
|
+
const repository = this.scmService.getRepository(activeResource);
|
|
129
|
+
if (!repository) {
|
|
130
|
+
return lastValue;
|
|
131
|
+
}
|
|
132
|
+
return Object.create(repository);
|
|
133
|
+
});
|
|
134
|
+
this._activeRepository = latestChangedValue(this, [this._activeEditorRepository, this._focusedRepository]);
|
|
135
|
+
this.activeRepository = derivedOpts({
|
|
136
|
+
owner: this,
|
|
137
|
+
equalsFn: (r1, r2) => r1?.id === r2?.id
|
|
138
|
+
}, reader => this._activeRepository.read(reader));
|
|
112
139
|
this.menus = instantiationService.createInstance(SCMMenus);
|
|
113
140
|
try {
|
|
114
|
-
this.previousState = JSON.parse(storageService.get('scm:view:visibleRepositories',
|
|
141
|
+
this.previousState = JSON.parse(storageService.get('scm:view:visibleRepositories', 1 , ''));
|
|
115
142
|
}
|
|
116
143
|
catch {
|
|
117
144
|
}
|
|
@@ -235,7 +262,7 @@ let SCMViewService = class SCMViewService {
|
|
|
235
262
|
}
|
|
236
263
|
}
|
|
237
264
|
compareRepositories(op1, op2) {
|
|
238
|
-
if (this._repositoriesSortKey ===
|
|
265
|
+
if (this._repositoriesSortKey === "discoveryTime" ) {
|
|
239
266
|
return op1.discoveryTime - op2.discoveryTime;
|
|
240
267
|
}
|
|
241
268
|
if (this._repositoriesSortKey === 'path' && op1.repository.provider.rootUri && op2.repository.provider.rootUri) {
|
|
@@ -257,13 +284,13 @@ let SCMViewService = class SCMViewService {
|
|
|
257
284
|
const sortOder = this.configurationService.getValue('scm.repositories.sortOrder');
|
|
258
285
|
switch (sortOder) {
|
|
259
286
|
case 'discovery time':
|
|
260
|
-
return
|
|
287
|
+
return "discoveryTime" ;
|
|
261
288
|
case 'name':
|
|
262
|
-
return
|
|
289
|
+
return "name" ;
|
|
263
290
|
case 'path':
|
|
264
|
-
return
|
|
291
|
+
return "path" ;
|
|
265
292
|
default:
|
|
266
|
-
return
|
|
293
|
+
return "discoveryTime" ;
|
|
267
294
|
}
|
|
268
295
|
}
|
|
269
296
|
insertRepositoryView(repositories, repositoryView) {
|
|
@@ -277,7 +304,7 @@ let SCMViewService = class SCMViewService {
|
|
|
277
304
|
const all = ( this.repositories.map(r => getProviderStorageKey(r.provider)));
|
|
278
305
|
const visible = ( this.visibleRepositories.map(r => all.indexOf(getProviderStorageKey(r.provider))));
|
|
279
306
|
this.previousState = { all, sortKey: this._repositoriesSortKey, visible };
|
|
280
|
-
this.storageService.store('scm:view:visibleRepositories', JSON.stringify(this.previousState),
|
|
307
|
+
this.storageService.store('scm:view:visibleRepositories', JSON.stringify(this.previousState), 1 , 1 );
|
|
281
308
|
}
|
|
282
309
|
eventuallyFinishLoading() {
|
|
283
310
|
this.finishLoading();
|
|
@@ -300,11 +327,12 @@ SCMViewService.__decorator = ( __decorate([
|
|
|
300
327
|
SCMViewService = ( __decorate([
|
|
301
328
|
( __param(0, ISCMService)),
|
|
302
329
|
( __param(1, IContextKeyService)),
|
|
303
|
-
( __param(2,
|
|
304
|
-
( __param(3,
|
|
305
|
-
( __param(4,
|
|
306
|
-
( __param(5,
|
|
307
|
-
( __param(6,
|
|
330
|
+
( __param(2, IEditorService)),
|
|
331
|
+
( __param(3, IExtensionService)),
|
|
332
|
+
( __param(4, IInstantiationService)),
|
|
333
|
+
( __param(5, IConfigurationService)),
|
|
334
|
+
( __param(6, IStorageService)),
|
|
335
|
+
( __param(7, IWorkspaceContextService))
|
|
308
336
|
], SCMViewService));
|
|
309
337
|
|
|
310
338
|
export { RepositoryContextKeys, SCMViewService };
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { Disposable, DisposableMap, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
3
|
import 'vscode/vscode/vs/base/common/arrays';
|
|
4
|
-
import 'vscode/vscode/vs/base/common/
|
|
4
|
+
import 'vscode/vscode/vs/base/common/event';
|
|
5
5
|
import { autorunWithStore, autorun } from 'vscode/vscode/vs/base/common/observableInternal/autorun';
|
|
6
|
-
import 'vscode/vscode/vs/base/common/observableInternal/
|
|
6
|
+
import { derived } from 'vscode/vscode/vs/base/common/observableInternal/derived';
|
|
7
7
|
import 'vscode/vscode/vs/base/common/cancellation';
|
|
8
|
+
import 'vscode/vscode/vs/base/common/observableInternal/utils';
|
|
8
9
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
9
10
|
import { observableConfigValue } from 'vscode/vscode/vs/platform/observable/common/platformObservableUtils';
|
|
10
|
-
import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
11
11
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
12
|
-
import { getProviderKey } from '
|
|
12
|
+
import { getProviderKey } from 'vscode/vscode/vs/workbench/contrib/scm/browser/util';
|
|
13
13
|
import { ISCMService } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm.service';
|
|
14
14
|
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
15
|
-
import { Parts } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
|
|
16
15
|
import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService.service';
|
|
17
16
|
|
|
18
17
|
let SCMWorkingSetController = class SCMWorkingSetController extends Disposable {
|
|
@@ -28,7 +27,7 @@ let SCMWorkingSetController = class SCMWorkingSetController extends Disposable {
|
|
|
28
27
|
this._repositoryDisposables = ( new DisposableMap());
|
|
29
28
|
this._store.add(autorunWithStore((reader, store) => {
|
|
30
29
|
if (!this._enabledConfig.read(reader)) {
|
|
31
|
-
this.storageService.remove('scm.workingSets',
|
|
30
|
+
this.storageService.remove('scm.workingSets', 1 );
|
|
32
31
|
this._repositoryDisposables.clearAndDisposeAll();
|
|
33
32
|
return;
|
|
34
33
|
}
|
|
@@ -42,23 +41,27 @@ let SCMWorkingSetController = class SCMWorkingSetController extends Disposable {
|
|
|
42
41
|
}
|
|
43
42
|
_onDidAddRepository(repository) {
|
|
44
43
|
const disposables = ( new DisposableStore());
|
|
45
|
-
|
|
44
|
+
const historyItemRefId = derived(reader => {
|
|
46
45
|
const historyProvider = repository.provider.historyProvider.read(reader);
|
|
47
|
-
const
|
|
48
|
-
|
|
46
|
+
const historyItemRef = historyProvider?.historyItemRef.read(reader);
|
|
47
|
+
return historyItemRef?.id;
|
|
48
|
+
});
|
|
49
|
+
disposables.add(autorun(async (reader) => {
|
|
50
|
+
const historyItemRefIdValue = historyItemRefId.read(reader);
|
|
51
|
+
if (!historyItemRefIdValue) {
|
|
49
52
|
return;
|
|
50
53
|
}
|
|
51
54
|
const providerKey = getProviderKey(repository.provider);
|
|
52
55
|
const repositoryWorkingSets = this._workingSets.get(providerKey);
|
|
53
56
|
if (!repositoryWorkingSets) {
|
|
54
|
-
this._workingSets.set(providerKey, { currentHistoryItemGroupId, editorWorkingSets: ( new Map()) });
|
|
57
|
+
this._workingSets.set(providerKey, { currentHistoryItemGroupId: historyItemRefIdValue, editorWorkingSets: ( new Map()) });
|
|
55
58
|
return;
|
|
56
59
|
}
|
|
57
|
-
if (repositoryWorkingSets.currentHistoryItemGroupId ===
|
|
60
|
+
if (repositoryWorkingSets.currentHistoryItemGroupId === historyItemRefIdValue) {
|
|
58
61
|
return;
|
|
59
62
|
}
|
|
60
|
-
this._saveWorkingSet(providerKey,
|
|
61
|
-
await this._restoreWorkingSet(providerKey,
|
|
63
|
+
this._saveWorkingSet(providerKey, historyItemRefIdValue, repositoryWorkingSets);
|
|
64
|
+
await this._restoreWorkingSet(providerKey, historyItemRefIdValue);
|
|
62
65
|
}));
|
|
63
66
|
this._repositoryDisposables.set(repository, disposables);
|
|
64
67
|
}
|
|
@@ -67,7 +70,7 @@ let SCMWorkingSetController = class SCMWorkingSetController extends Disposable {
|
|
|
67
70
|
}
|
|
68
71
|
_loadWorkingSets() {
|
|
69
72
|
const workingSets = ( new Map());
|
|
70
|
-
const workingSetsRaw = this.storageService.get('scm.workingSets',
|
|
73
|
+
const workingSetsRaw = this.storageService.get('scm.workingSets', 1 );
|
|
71
74
|
if (!workingSetsRaw) {
|
|
72
75
|
return workingSets;
|
|
73
76
|
}
|
|
@@ -88,7 +91,7 @@ let SCMWorkingSetController = class SCMWorkingSetController extends Disposable {
|
|
|
88
91
|
for (const [providerKey, { currentHistoryItemGroupId, editorWorkingSets }] of this._workingSets) {
|
|
89
92
|
workingSets.push({ providerKey, currentHistoryItemGroupId, editorWorkingSets: [...editorWorkingSets] });
|
|
90
93
|
}
|
|
91
|
-
this.storageService.store('scm.workingSets', JSON.stringify(workingSets),
|
|
94
|
+
this.storageService.store('scm.workingSets', JSON.stringify(workingSets), 1 , 1 );
|
|
92
95
|
}
|
|
93
96
|
async _restoreWorkingSet(providerKey, currentHistoryItemGroupId) {
|
|
94
97
|
const workingSets = this._workingSets.get(providerKey);
|
|
@@ -100,7 +103,7 @@ let SCMWorkingSetController = class SCMWorkingSetController extends Disposable {
|
|
|
100
103
|
editorWorkingSetId = 'empty';
|
|
101
104
|
}
|
|
102
105
|
if (editorWorkingSetId) {
|
|
103
|
-
const preserveFocus = this.layoutService.hasFocus(
|
|
106
|
+
const preserveFocus = this.layoutService.hasFocus("workbench.parts.panel" );
|
|
104
107
|
await this.editorGroupsService.applyWorkingSet(editorWorkingSetId, { preserveFocus });
|
|
105
108
|
}
|
|
106
109
|
}
|
|
@@ -4,7 +4,6 @@ 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';
|
|
8
7
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
9
8
|
import { HistoryNavigator2 } from 'vscode/vscode/vs/base/common/history';
|
|
10
9
|
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
@@ -173,7 +172,7 @@ let SCMInputHistory = class SCMInputHistory {
|
|
|
173
172
|
this._onWillSaveHistory = this.disposables.add(( new Emitter()));
|
|
174
173
|
this.onWillSaveHistory = this._onWillSaveHistory.event;
|
|
175
174
|
this.histories = ( new Map());
|
|
176
|
-
const entries = this.storageService.getObject('scm.history',
|
|
175
|
+
const entries = this.storageService.getObject('scm.history', 1 , []);
|
|
177
176
|
for (const [providerLabel, rootUri, history] of entries) {
|
|
178
177
|
let providerHistories = this.histories.get(providerLabel);
|
|
179
178
|
if (!providerHistories) {
|
|
@@ -185,9 +184,9 @@ let SCMInputHistory = class SCMInputHistory {
|
|
|
185
184
|
if (this.migrateStorage()) {
|
|
186
185
|
this.saveToStorage();
|
|
187
186
|
}
|
|
188
|
-
this.disposables.add(this.storageService.onDidChangeValue(
|
|
187
|
+
this.disposables.add(this.storageService.onDidChangeValue(1 , 'scm.history', this.disposables)(e => {
|
|
189
188
|
if (e.external && e.key === 'scm.history') {
|
|
190
|
-
const raw = this.storageService.getObject('scm.history',
|
|
189
|
+
const raw = this.storageService.getObject('scm.history', 1 , []);
|
|
191
190
|
for (const [providerLabel, uri, rawHistory] of raw) {
|
|
192
191
|
const history = this.getHistory(providerLabel, uri);
|
|
193
192
|
for (const value of Iterable.reverse(rawHistory)) {
|
|
@@ -213,7 +212,7 @@ let SCMInputHistory = class SCMInputHistory {
|
|
|
213
212
|
}
|
|
214
213
|
}
|
|
215
214
|
}
|
|
216
|
-
this.storageService.store('scm.history', raw,
|
|
215
|
+
this.storageService.store('scm.history', raw, 1 , 0 );
|
|
217
216
|
}
|
|
218
217
|
getHistory(providerLabel, rootUri) {
|
|
219
218
|
let providerHistories = this.histories.get(providerLabel);
|
|
@@ -230,13 +229,13 @@ let SCMInputHistory = class SCMInputHistory {
|
|
|
230
229
|
}
|
|
231
230
|
migrateStorage() {
|
|
232
231
|
let didSomethingChange = false;
|
|
233
|
-
const machineKeys = Iterable.filter(( this.storageService.keys(
|
|
232
|
+
const machineKeys = Iterable.filter(( this.storageService.keys(-1, 1 )), key => key.startsWith('scm/input:'));
|
|
234
233
|
for (const key of machineKeys) {
|
|
235
234
|
try {
|
|
236
|
-
const legacyHistory = JSON.parse(this.storageService.get(key,
|
|
235
|
+
const legacyHistory = JSON.parse(this.storageService.get(key, -1 , ''));
|
|
237
236
|
const match = /^scm\/input:([^:]+):(.+)$/.exec(key);
|
|
238
237
|
if (!match || !Array.isArray(legacyHistory?.history) || !Number.isInteger(legacyHistory?.timestamp)) {
|
|
239
|
-
this.storageService.remove(key,
|
|
238
|
+
this.storageService.remove(key, -1 );
|
|
240
239
|
continue;
|
|
241
240
|
}
|
|
242
241
|
const [, providerLabel, rootPath] = match;
|
|
@@ -247,11 +246,11 @@ let SCMInputHistory = class SCMInputHistory {
|
|
|
247
246
|
history.prepend(entry);
|
|
248
247
|
}
|
|
249
248
|
didSomethingChange = true;
|
|
250
|
-
this.storageService.remove(key,
|
|
249
|
+
this.storageService.remove(key, -1 );
|
|
251
250
|
}
|
|
252
251
|
}
|
|
253
252
|
catch {
|
|
254
|
-
this.storageService.remove(key,
|
|
253
|
+
this.storageService.remove(key, -1 );
|
|
255
254
|
}
|
|
256
255
|
}
|
|
257
256
|
return didSomethingChange;
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import { localize } from 'vscode/vscode/vs/nls';
|
|
2
|
-
import { lastOrDefault } from 'vscode/vscode/vs/base/common/arrays';
|
|
3
|
-
import { deepClone } from 'vscode/vscode/vs/base/common/objects';
|
|
4
|
-
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
5
|
-
import { registerColor, asCssVariable } from 'vscode/vscode/vs/platform/theme/common/colorUtils';
|
|
6
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
|
|
7
|
-
import { chartsBlue, chartsPurple, chartsOrange, chartsGreen, chartsRed, chartsYellow } from 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
|
|
8
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
|
|
9
|
-
import { buttonForeground } from 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
|
|
10
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
|
|
11
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
|
|
12
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
|
|
13
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
|
|
14
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
15
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
16
|
-
import { rot } from 'vscode/vscode/vs/base/common/numbers';
|
|
17
|
-
import { svgElem } from 'vscode/vscode/vs/base/browser/dom';
|
|
18
|
-
|
|
19
|
-
const SWIMLANE_HEIGHT = 22;
|
|
20
|
-
const SWIMLANE_WIDTH = 11;
|
|
21
|
-
const CIRCLE_RADIUS = 4;
|
|
22
|
-
const SWIMLANE_CURVE_RADIUS = 5;
|
|
23
|
-
const historyItemGroupLocal = registerColor('scmGraph.historyItemGroupLocal', chartsBlue, ( localize(10471, "Local history item group color.")));
|
|
24
|
-
const historyItemGroupRemote = registerColor('scmGraph.historyItemGroupRemote', chartsPurple, ( localize(10472, "Remote history item group color.")));
|
|
25
|
-
const historyItemGroupBase = registerColor('scmGraph.historyItemGroupBase', chartsOrange, ( localize(10473, "Base history item group color.")));
|
|
26
|
-
const historyItemGroupHoverLabelForeground = registerColor('scmGraph.historyItemHoverLabelForeground', buttonForeground, ( localize(10474, "History item hover label foreground color.")));
|
|
27
|
-
const colorRegistry = [
|
|
28
|
-
registerColor('scmGraph.foreground1', chartsGreen, ( localize(10475, "Source control graph foreground color (1)."))),
|
|
29
|
-
registerColor('scmGraph.foreground2', chartsRed, ( localize(10476, "Source control graph foreground color (2)."))),
|
|
30
|
-
registerColor('scmGraph.foreground3', chartsYellow, ( localize(10477, "Source control graph foreground color (3)."))),
|
|
31
|
-
];
|
|
32
|
-
function getLabelColorIdentifier(historyItem, colorMap) {
|
|
33
|
-
for (const label of historyItem.labels ?? []) {
|
|
34
|
-
const colorIndex = colorMap.get(label.title);
|
|
35
|
-
if (colorIndex !== undefined) {
|
|
36
|
-
return colorIndex;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
function createPath(colorIdentifier) {
|
|
42
|
-
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
43
|
-
path.setAttribute('fill', 'none');
|
|
44
|
-
path.setAttribute('stroke-width', '1px');
|
|
45
|
-
path.setAttribute('stroke-linecap', 'round');
|
|
46
|
-
path.style.stroke = asCssVariable(colorIdentifier);
|
|
47
|
-
return path;
|
|
48
|
-
}
|
|
49
|
-
function drawCircle(index, radius, colorIdentifier) {
|
|
50
|
-
const circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
|
51
|
-
circle.setAttribute('cx', `${SWIMLANE_WIDTH * (index + 1)}`);
|
|
52
|
-
circle.setAttribute('cy', `${SWIMLANE_WIDTH}`);
|
|
53
|
-
circle.setAttribute('r', `${radius}`);
|
|
54
|
-
circle.style.fill = asCssVariable(colorIdentifier);
|
|
55
|
-
return circle;
|
|
56
|
-
}
|
|
57
|
-
function drawVerticalLine(x1, y1, y2, color) {
|
|
58
|
-
const path = createPath(color);
|
|
59
|
-
path.setAttribute('d', `M ${x1} ${y1} V ${y2}`);
|
|
60
|
-
return path;
|
|
61
|
-
}
|
|
62
|
-
function findLastIndex(nodes, id) {
|
|
63
|
-
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
64
|
-
if (nodes[i].id === id) {
|
|
65
|
-
return i;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return -1;
|
|
69
|
-
}
|
|
70
|
-
function renderSCMHistoryItemGraph(historyItemViewModel) {
|
|
71
|
-
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
72
|
-
svg.classList.add('graph');
|
|
73
|
-
const historyItem = historyItemViewModel.historyItem;
|
|
74
|
-
const inputSwimlanes = historyItemViewModel.inputSwimlanes;
|
|
75
|
-
const outputSwimlanes = historyItemViewModel.outputSwimlanes;
|
|
76
|
-
const inputIndex = inputSwimlanes.findIndex(node => node.id === historyItem.id);
|
|
77
|
-
const circleIndex = inputIndex !== -1 ? inputIndex : inputSwimlanes.length;
|
|
78
|
-
const circleColor = circleIndex < outputSwimlanes.length ? outputSwimlanes[circleIndex].color :
|
|
79
|
-
circleIndex < inputSwimlanes.length ? inputSwimlanes[circleIndex].color : historyItemGroupLocal;
|
|
80
|
-
let outputSwimlaneIndex = 0;
|
|
81
|
-
for (let index = 0; index < inputSwimlanes.length; index++) {
|
|
82
|
-
const color = inputSwimlanes[index].color;
|
|
83
|
-
if (inputSwimlanes[index].id === historyItem.id) {
|
|
84
|
-
if (index !== circleIndex) {
|
|
85
|
-
const d = [];
|
|
86
|
-
const path = createPath(color);
|
|
87
|
-
d.push(`M ${SWIMLANE_WIDTH * (index + 1)} 0`);
|
|
88
|
-
d.push(`A ${SWIMLANE_WIDTH} ${SWIMLANE_WIDTH} 0 0 1 ${SWIMLANE_WIDTH * (index)} ${SWIMLANE_WIDTH}`);
|
|
89
|
-
d.push(`H ${SWIMLANE_WIDTH * (circleIndex + 1)}`);
|
|
90
|
-
path.setAttribute('d', d.join(' '));
|
|
91
|
-
svg.append(path);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
outputSwimlaneIndex++;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
if (outputSwimlaneIndex < outputSwimlanes.length &&
|
|
99
|
-
inputSwimlanes[index].id === outputSwimlanes[outputSwimlaneIndex].id) {
|
|
100
|
-
if (index === outputSwimlaneIndex) {
|
|
101
|
-
const path = drawVerticalLine(SWIMLANE_WIDTH * (index + 1), 0, SWIMLANE_HEIGHT, color);
|
|
102
|
-
svg.append(path);
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
const d = [];
|
|
106
|
-
const path = createPath(color);
|
|
107
|
-
d.push(`M ${SWIMLANE_WIDTH * (index + 1)} 0`);
|
|
108
|
-
d.push(`V 6`);
|
|
109
|
-
d.push(`A ${SWIMLANE_CURVE_RADIUS} ${SWIMLANE_CURVE_RADIUS} 0 0 1 ${(SWIMLANE_WIDTH * (index + 1)) - SWIMLANE_CURVE_RADIUS} ${SWIMLANE_HEIGHT / 2}`);
|
|
110
|
-
d.push(`H ${(SWIMLANE_WIDTH * (outputSwimlaneIndex + 1)) + SWIMLANE_CURVE_RADIUS}`);
|
|
111
|
-
d.push(`A ${SWIMLANE_CURVE_RADIUS} ${SWIMLANE_CURVE_RADIUS} 0 0 0 ${SWIMLANE_WIDTH * (outputSwimlaneIndex + 1)} ${(SWIMLANE_HEIGHT / 2) + SWIMLANE_CURVE_RADIUS}`);
|
|
112
|
-
d.push(`V ${SWIMLANE_HEIGHT}`);
|
|
113
|
-
path.setAttribute('d', d.join(' '));
|
|
114
|
-
svg.append(path);
|
|
115
|
-
}
|
|
116
|
-
outputSwimlaneIndex++;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
for (let i = 1; i < historyItem.parentIds.length; i++) {
|
|
121
|
-
const parentOutputIndex = findLastIndex(outputSwimlanes, historyItem.parentIds[i]);
|
|
122
|
-
if (parentOutputIndex === -1) {
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
const d = [];
|
|
126
|
-
const path = createPath(outputSwimlanes[parentOutputIndex].color);
|
|
127
|
-
d.push(`M ${SWIMLANE_WIDTH * parentOutputIndex} ${SWIMLANE_HEIGHT / 2}`);
|
|
128
|
-
d.push(`A ${SWIMLANE_WIDTH} ${SWIMLANE_WIDTH} 0 0 1 ${SWIMLANE_WIDTH * (parentOutputIndex + 1)} ${SWIMLANE_HEIGHT}`);
|
|
129
|
-
d.push(`M ${SWIMLANE_WIDTH * parentOutputIndex} ${SWIMLANE_HEIGHT / 2}`);
|
|
130
|
-
d.push(`H ${SWIMLANE_WIDTH * (circleIndex + 1)} `);
|
|
131
|
-
path.setAttribute('d', d.join(' '));
|
|
132
|
-
svg.append(path);
|
|
133
|
-
}
|
|
134
|
-
if (inputIndex !== -1) {
|
|
135
|
-
const path = drawVerticalLine(SWIMLANE_WIDTH * (circleIndex + 1), 0, SWIMLANE_HEIGHT / 2, inputSwimlanes[inputIndex].color);
|
|
136
|
-
svg.append(path);
|
|
137
|
-
}
|
|
138
|
-
if (historyItem.parentIds.length > 0) {
|
|
139
|
-
const path = drawVerticalLine(SWIMLANE_WIDTH * (circleIndex + 1), SWIMLANE_HEIGHT / 2, SWIMLANE_HEIGHT, circleColor);
|
|
140
|
-
svg.append(path);
|
|
141
|
-
}
|
|
142
|
-
if (historyItem.parentIds.length > 1) {
|
|
143
|
-
const circleOuter = drawCircle(circleIndex, CIRCLE_RADIUS + 1, circleColor);
|
|
144
|
-
svg.append(circleOuter);
|
|
145
|
-
const circleInner = drawCircle(circleIndex, CIRCLE_RADIUS - 1, circleColor);
|
|
146
|
-
svg.append(circleInner);
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
if (historyItem.labels?.some(l => ThemeIcon.isThemeIcon(l.icon) && l.icon.id === 'target')) {
|
|
150
|
-
const outerCircle = drawCircle(circleIndex, CIRCLE_RADIUS + 2, circleColor);
|
|
151
|
-
svg.append(outerCircle);
|
|
152
|
-
}
|
|
153
|
-
const circle = drawCircle(circleIndex, CIRCLE_RADIUS, circleColor);
|
|
154
|
-
svg.append(circle);
|
|
155
|
-
}
|
|
156
|
-
svg.style.height = `${SWIMLANE_HEIGHT}px`;
|
|
157
|
-
svg.style.width = `${SWIMLANE_WIDTH * (Math.max(inputSwimlanes.length, outputSwimlanes.length, 1) + 1)}px`;
|
|
158
|
-
return svg;
|
|
159
|
-
}
|
|
160
|
-
function renderSCMHistoryGraphPlaceholder(columns) {
|
|
161
|
-
const elements = svgElem('svg', {
|
|
162
|
-
style: { height: `${SWIMLANE_HEIGHT}px`, width: `${SWIMLANE_WIDTH * (columns.length + 1)}px`, }
|
|
163
|
-
});
|
|
164
|
-
for (let index = 0; index < columns.length; index++) {
|
|
165
|
-
const path = drawVerticalLine(SWIMLANE_WIDTH * (index + 1), 0, SWIMLANE_HEIGHT, columns[index].color);
|
|
166
|
-
elements.root.append(path);
|
|
167
|
-
}
|
|
168
|
-
return elements.root;
|
|
169
|
-
}
|
|
170
|
-
function toISCMHistoryItemViewModelArray(historyItems, colorMap = ( (new Map()))) {
|
|
171
|
-
let colorIndex = -1;
|
|
172
|
-
const viewModels = [];
|
|
173
|
-
for (let index = 0; index < historyItems.length; index++) {
|
|
174
|
-
const historyItem = historyItems[index];
|
|
175
|
-
const outputSwimlanesFromPreviousItem = lastOrDefault(viewModels)?.outputSwimlanes ?? [];
|
|
176
|
-
const inputSwimlanes = ( (outputSwimlanesFromPreviousItem.map(i => deepClone(i))));
|
|
177
|
-
const outputSwimlanes = [];
|
|
178
|
-
let firstParentAdded = false;
|
|
179
|
-
if (historyItem.parentIds.length > 0) {
|
|
180
|
-
for (const node of inputSwimlanes) {
|
|
181
|
-
if (node.id === historyItem.id) {
|
|
182
|
-
if (!firstParentAdded) {
|
|
183
|
-
outputSwimlanes.push({
|
|
184
|
-
id: historyItem.parentIds[0],
|
|
185
|
-
color: getLabelColorIdentifier(historyItem, colorMap) ?? node.color
|
|
186
|
-
});
|
|
187
|
-
firstParentAdded = true;
|
|
188
|
-
}
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
outputSwimlanes.push(deepClone(node));
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
for (let i = firstParentAdded ? 1 : 0; i < historyItem.parentIds.length; i++) {
|
|
195
|
-
let colorIdentifier;
|
|
196
|
-
if (!firstParentAdded) {
|
|
197
|
-
colorIdentifier = getLabelColorIdentifier(historyItem, colorMap);
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
const historyItemParent = historyItems
|
|
201
|
-
.find(h => h.id === historyItem.parentIds[i]);
|
|
202
|
-
colorIdentifier = historyItemParent ? getLabelColorIdentifier(historyItemParent, colorMap) : undefined;
|
|
203
|
-
}
|
|
204
|
-
if (!colorIdentifier) {
|
|
205
|
-
colorIndex = rot(colorIndex + 1, colorRegistry.length);
|
|
206
|
-
colorIdentifier = colorRegistry[colorIndex];
|
|
207
|
-
}
|
|
208
|
-
outputSwimlanes.push({
|
|
209
|
-
id: historyItem.parentIds[i],
|
|
210
|
-
color: colorIdentifier
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
viewModels.push({
|
|
214
|
-
historyItem,
|
|
215
|
-
inputSwimlanes,
|
|
216
|
-
outputSwimlanes,
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
return viewModels;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
export { SWIMLANE_HEIGHT, SWIMLANE_WIDTH, colorRegistry, historyItemGroupBase, historyItemGroupHoverLabelForeground, historyItemGroupLocal, historyItemGroupRemote, renderSCMHistoryGraphPlaceholder, renderSCMHistoryItemGraph, toISCMHistoryItemViewModelArray };
|