@codingame/monaco-vscode-scm-service-override 4.0.0 → 4.1.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/scm.js +4 -4
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/external/tslib/tslib.es6.js +0 -11
- package/vscode/src/vs/workbench/contrib/scm/browser/activity.js +0 -308
- package/vscode/src/vs/workbench/contrib/scm/browser/media/scm.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/scm/browser/menus.js +0 -280
- package/vscode/src/vs/workbench/contrib/scm/browser/scm.contribution.js +0 -702
- package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoriesViewPane.js +0 -174
- package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoryRenderer.js +0 -136
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPane.js +0 -3367
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPaneContainer.js +0 -54
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewService.js +0 -305
- package/vscode/src/vs/workbench/contrib/scm/browser/util.js +0 -121
- package/vscode/src/vs/workbench/contrib/scm/common/quickDiffService.js +0 -76
- package/vscode/src/vs/workbench/contrib/scm/common/scmService.js +0 -312
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
-
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
4
|
-
import { SCMInputChangeReason } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm';
|
|
5
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
6
|
-
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
7
|
-
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
8
|
-
import { HistoryNavigator2 } from 'vscode/vscode/vs/base/common/history';
|
|
9
|
-
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
10
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
11
|
-
import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
|
|
12
|
-
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
13
|
-
|
|
14
|
-
class SCMInput {
|
|
15
|
-
get value() {
|
|
16
|
-
return this._value;
|
|
17
|
-
}
|
|
18
|
-
get placeholder() {
|
|
19
|
-
return this._placeholder;
|
|
20
|
-
}
|
|
21
|
-
set placeholder(placeholder) {
|
|
22
|
-
this._placeholder = placeholder;
|
|
23
|
-
this._onDidChangePlaceholder.fire(placeholder);
|
|
24
|
-
}
|
|
25
|
-
get enabled() {
|
|
26
|
-
return this._enabled;
|
|
27
|
-
}
|
|
28
|
-
set enabled(enabled) {
|
|
29
|
-
this._enabled = enabled;
|
|
30
|
-
this._onDidChangeEnablement.fire(enabled);
|
|
31
|
-
}
|
|
32
|
-
get visible() {
|
|
33
|
-
return this._visible;
|
|
34
|
-
}
|
|
35
|
-
set visible(visible) {
|
|
36
|
-
this._visible = visible;
|
|
37
|
-
this._onDidChangeVisibility.fire(visible);
|
|
38
|
-
}
|
|
39
|
-
get actionButton() {
|
|
40
|
-
return this._actionButton;
|
|
41
|
-
}
|
|
42
|
-
set actionButton(actionButton) {
|
|
43
|
-
this._actionButton = actionButton;
|
|
44
|
-
this._onDidChangeActionButton.fire();
|
|
45
|
-
}
|
|
46
|
-
setFocus() {
|
|
47
|
-
this._onDidChangeFocus.fire();
|
|
48
|
-
}
|
|
49
|
-
showValidationMessage(message, type) {
|
|
50
|
-
this._onDidChangeValidationMessage.fire({ message: message, type: type });
|
|
51
|
-
}
|
|
52
|
-
get validateInput() {
|
|
53
|
-
return this._validateInput;
|
|
54
|
-
}
|
|
55
|
-
set validateInput(validateInput) {
|
|
56
|
-
this._validateInput = validateInput;
|
|
57
|
-
this._onDidChangeValidateInput.fire();
|
|
58
|
-
}
|
|
59
|
-
constructor(repository, history) {
|
|
60
|
-
this.repository = repository;
|
|
61
|
-
this.history = history;
|
|
62
|
-
this._value = '';
|
|
63
|
-
this._onDidChange = ( new Emitter());
|
|
64
|
-
this.onDidChange = this._onDidChange.event;
|
|
65
|
-
this._placeholder = '';
|
|
66
|
-
this._onDidChangePlaceholder = ( new Emitter());
|
|
67
|
-
this.onDidChangePlaceholder = this._onDidChangePlaceholder.event;
|
|
68
|
-
this._enabled = true;
|
|
69
|
-
this._onDidChangeEnablement = ( new Emitter());
|
|
70
|
-
this.onDidChangeEnablement = this._onDidChangeEnablement.event;
|
|
71
|
-
this._visible = true;
|
|
72
|
-
this._onDidChangeVisibility = ( new Emitter());
|
|
73
|
-
this.onDidChangeVisibility = this._onDidChangeVisibility.event;
|
|
74
|
-
this._onDidChangeActionButton = ( new Emitter());
|
|
75
|
-
this.onDidChangeActionButton = this._onDidChangeActionButton.event;
|
|
76
|
-
this._onDidChangeFocus = ( new Emitter());
|
|
77
|
-
this.onDidChangeFocus = this._onDidChangeFocus.event;
|
|
78
|
-
this._onDidChangeValidationMessage = ( new Emitter());
|
|
79
|
-
this.onDidChangeValidationMessage = this._onDidChangeValidationMessage.event;
|
|
80
|
-
this._validateInput = () => Promise.resolve(undefined);
|
|
81
|
-
this._onDidChangeValidateInput = ( new Emitter());
|
|
82
|
-
this.onDidChangeValidateInput = this._onDidChangeValidateInput.event;
|
|
83
|
-
this.didChangeHistory = false;
|
|
84
|
-
if (this.repository.provider.rootUri) {
|
|
85
|
-
this.historyNavigator = history.getHistory(this.repository.provider.label, this.repository.provider.rootUri);
|
|
86
|
-
this.history.onWillSaveHistory(event => {
|
|
87
|
-
if (this.historyNavigator.isAtEnd()) {
|
|
88
|
-
this.saveValue();
|
|
89
|
-
}
|
|
90
|
-
if (this.didChangeHistory) {
|
|
91
|
-
event.historyDidIndeedChange();
|
|
92
|
-
}
|
|
93
|
-
this.didChangeHistory = false;
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
this.historyNavigator = ( new HistoryNavigator2([''], 100));
|
|
98
|
-
}
|
|
99
|
-
this._value = this.historyNavigator.current();
|
|
100
|
-
}
|
|
101
|
-
setValue(value, transient, reason) {
|
|
102
|
-
if (value === this._value) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
if (!transient) {
|
|
106
|
-
this.historyNavigator.add(this._value);
|
|
107
|
-
this.historyNavigator.add(value);
|
|
108
|
-
this.didChangeHistory = true;
|
|
109
|
-
}
|
|
110
|
-
this._value = value;
|
|
111
|
-
this._onDidChange.fire({ value, reason });
|
|
112
|
-
}
|
|
113
|
-
showNextHistoryValue() {
|
|
114
|
-
if (this.historyNavigator.isAtEnd()) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
else if (!( this.historyNavigator.has(this.value))) {
|
|
118
|
-
this.saveValue();
|
|
119
|
-
this.historyNavigator.resetCursor();
|
|
120
|
-
}
|
|
121
|
-
const value = this.historyNavigator.next();
|
|
122
|
-
this.setValue(value, true, SCMInputChangeReason.HistoryNext);
|
|
123
|
-
}
|
|
124
|
-
showPreviousHistoryValue() {
|
|
125
|
-
if (this.historyNavigator.isAtEnd()) {
|
|
126
|
-
this.saveValue();
|
|
127
|
-
}
|
|
128
|
-
else if (!( this.historyNavigator.has(this._value))) {
|
|
129
|
-
this.saveValue();
|
|
130
|
-
this.historyNavigator.resetCursor();
|
|
131
|
-
}
|
|
132
|
-
const value = this.historyNavigator.previous();
|
|
133
|
-
this.setValue(value, true, SCMInputChangeReason.HistoryPrevious);
|
|
134
|
-
}
|
|
135
|
-
saveValue() {
|
|
136
|
-
const oldValue = this.historyNavigator.replaceLast(this._value);
|
|
137
|
-
this.didChangeHistory = this.didChangeHistory || (oldValue !== this._value);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
class SCMRepository {
|
|
141
|
-
get selected() {
|
|
142
|
-
return this._selected;
|
|
143
|
-
}
|
|
144
|
-
constructor(id, provider, disposable, inputHistory) {
|
|
145
|
-
this.id = id;
|
|
146
|
-
this.provider = provider;
|
|
147
|
-
this.disposable = disposable;
|
|
148
|
-
this._selected = false;
|
|
149
|
-
this._onDidChangeSelection = ( new Emitter());
|
|
150
|
-
this.onDidChangeSelection = this._onDidChangeSelection.event;
|
|
151
|
-
this.input = ( new SCMInput(this, inputHistory));
|
|
152
|
-
}
|
|
153
|
-
setSelected(selected) {
|
|
154
|
-
if (this._selected === selected) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
this._selected = selected;
|
|
158
|
-
this._onDidChangeSelection.fire(selected);
|
|
159
|
-
}
|
|
160
|
-
dispose() {
|
|
161
|
-
this.disposable.dispose();
|
|
162
|
-
this.provider.dispose();
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
class WillSaveHistoryEvent {
|
|
166
|
-
constructor() {
|
|
167
|
-
this._didChangeHistory = false;
|
|
168
|
-
}
|
|
169
|
-
get didChangeHistory() { return this._didChangeHistory; }
|
|
170
|
-
historyDidIndeedChange() { this._didChangeHistory = true; }
|
|
171
|
-
}
|
|
172
|
-
let SCMInputHistory = class SCMInputHistory {
|
|
173
|
-
constructor(storageService, workspaceContextService) {
|
|
174
|
-
this.storageService = storageService;
|
|
175
|
-
this.workspaceContextService = workspaceContextService;
|
|
176
|
-
this.disposables = ( new DisposableStore());
|
|
177
|
-
this.histories = ( new Map());
|
|
178
|
-
this._onWillSaveHistory = this.disposables.add(( new Emitter()));
|
|
179
|
-
this.onWillSaveHistory = this._onWillSaveHistory.event;
|
|
180
|
-
this.histories = ( new Map());
|
|
181
|
-
const entries = this.storageService.getObject('scm.history', 1 , []);
|
|
182
|
-
for (const [providerLabel, rootUri, history] of entries) {
|
|
183
|
-
let providerHistories = this.histories.get(providerLabel);
|
|
184
|
-
if (!providerHistories) {
|
|
185
|
-
providerHistories = ( new ResourceMap());
|
|
186
|
-
this.histories.set(providerLabel, providerHistories);
|
|
187
|
-
}
|
|
188
|
-
providerHistories.set(rootUri, ( new HistoryNavigator2(history, 100)));
|
|
189
|
-
}
|
|
190
|
-
if (this.migrateStorage()) {
|
|
191
|
-
this.saveToStorage();
|
|
192
|
-
}
|
|
193
|
-
this.disposables.add(this.storageService.onDidChangeValue(1 , 'scm.history', this.disposables)(e => {
|
|
194
|
-
if (e.external && e.key === 'scm.history') {
|
|
195
|
-
const raw = this.storageService.getObject('scm.history', 1 , []);
|
|
196
|
-
for (const [providerLabel, uri, rawHistory] of raw) {
|
|
197
|
-
const history = this.getHistory(providerLabel, uri);
|
|
198
|
-
for (const value of Iterable.reverse(rawHistory)) {
|
|
199
|
-
history.prepend(value);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}));
|
|
204
|
-
this.disposables.add(this.storageService.onWillSaveState(_ => {
|
|
205
|
-
const event = ( new WillSaveHistoryEvent());
|
|
206
|
-
this._onWillSaveHistory.fire(event);
|
|
207
|
-
if (event.didChangeHistory) {
|
|
208
|
-
this.saveToStorage();
|
|
209
|
-
}
|
|
210
|
-
}));
|
|
211
|
-
}
|
|
212
|
-
saveToStorage() {
|
|
213
|
-
const raw = [];
|
|
214
|
-
for (const [providerLabel, providerHistories] of this.histories) {
|
|
215
|
-
for (const [rootUri, history] of providerHistories) {
|
|
216
|
-
if (!(history.size === 1 && history.current() === '')) {
|
|
217
|
-
raw.push([providerLabel, rootUri, [...history]]);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
this.storageService.store('scm.history', raw, 1 , 0 );
|
|
222
|
-
}
|
|
223
|
-
getHistory(providerLabel, rootUri) {
|
|
224
|
-
let providerHistories = this.histories.get(providerLabel);
|
|
225
|
-
if (!providerHistories) {
|
|
226
|
-
providerHistories = ( new ResourceMap());
|
|
227
|
-
this.histories.set(providerLabel, providerHistories);
|
|
228
|
-
}
|
|
229
|
-
let history = providerHistories.get(rootUri);
|
|
230
|
-
if (!history) {
|
|
231
|
-
history = ( new HistoryNavigator2([''], 100));
|
|
232
|
-
providerHistories.set(rootUri, history);
|
|
233
|
-
}
|
|
234
|
-
return history;
|
|
235
|
-
}
|
|
236
|
-
migrateStorage() {
|
|
237
|
-
let didSomethingChange = false;
|
|
238
|
-
const machineKeys = Iterable.filter(( this.storageService.keys(-1, 1 )), key => key.startsWith('scm/input:'));
|
|
239
|
-
for (const key of machineKeys) {
|
|
240
|
-
try {
|
|
241
|
-
const legacyHistory = JSON.parse(this.storageService.get(key, -1 , ''));
|
|
242
|
-
const match = /^scm\/input:([^:]+):(.+)$/.exec(key);
|
|
243
|
-
if (!match || !Array.isArray(legacyHistory?.history) || !Number.isInteger(legacyHistory?.timestamp)) {
|
|
244
|
-
this.storageService.remove(key, -1 );
|
|
245
|
-
continue;
|
|
246
|
-
}
|
|
247
|
-
const [, providerLabel, rootPath] = match;
|
|
248
|
-
const rootUri = URI.file(rootPath);
|
|
249
|
-
if (this.workspaceContextService.getWorkspaceFolder(rootUri)) {
|
|
250
|
-
const history = this.getHistory(providerLabel, rootUri);
|
|
251
|
-
for (const entry of Iterable.reverse(legacyHistory.history)) {
|
|
252
|
-
history.prepend(entry);
|
|
253
|
-
}
|
|
254
|
-
didSomethingChange = true;
|
|
255
|
-
this.storageService.remove(key, -1 );
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
catch {
|
|
259
|
-
this.storageService.remove(key, -1 );
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
return didSomethingChange;
|
|
263
|
-
}
|
|
264
|
-
dispose() {
|
|
265
|
-
this.disposables.dispose();
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
SCMInputHistory = ( __decorate([
|
|
269
|
-
( __param(0, IStorageService)),
|
|
270
|
-
( __param(1, IWorkspaceContextService))
|
|
271
|
-
], SCMInputHistory));
|
|
272
|
-
let SCMService = class SCMService {
|
|
273
|
-
get repositories() { return ( this._repositories.values()); }
|
|
274
|
-
get repositoryCount() { return this._repositories.size; }
|
|
275
|
-
constructor(logService, workspaceContextService, contextKeyService, storageService) {
|
|
276
|
-
this.logService = logService;
|
|
277
|
-
this._repositories = ( new Map());
|
|
278
|
-
this._onDidAddProvider = ( new Emitter());
|
|
279
|
-
this.onDidAddRepository = this._onDidAddProvider.event;
|
|
280
|
-
this._onDidRemoveProvider = ( new Emitter());
|
|
281
|
-
this.onDidRemoveRepository = this._onDidRemoveProvider.event;
|
|
282
|
-
this.inputHistory = ( new SCMInputHistory(storageService, workspaceContextService));
|
|
283
|
-
this.providerCount = contextKeyService.createKey('scm.providerCount', 0);
|
|
284
|
-
}
|
|
285
|
-
registerSCMProvider(provider) {
|
|
286
|
-
this.logService.trace('SCMService#registerSCMProvider');
|
|
287
|
-
if (( this._repositories.has(provider.id))) {
|
|
288
|
-
throw new Error(`SCM Provider ${provider.id} already exists.`);
|
|
289
|
-
}
|
|
290
|
-
const disposable = toDisposable(() => {
|
|
291
|
-
this._repositories.delete(provider.id);
|
|
292
|
-
this._onDidRemoveProvider.fire(repository);
|
|
293
|
-
this.providerCount.set(this._repositories.size);
|
|
294
|
-
});
|
|
295
|
-
const repository = ( new SCMRepository(provider.id, provider, disposable, this.inputHistory));
|
|
296
|
-
this._repositories.set(provider.id, repository);
|
|
297
|
-
this._onDidAddProvider.fire(repository);
|
|
298
|
-
this.providerCount.set(this._repositories.size);
|
|
299
|
-
return repository;
|
|
300
|
-
}
|
|
301
|
-
getRepository(id) {
|
|
302
|
-
return this._repositories.get(id);
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
SCMService = ( __decorate([
|
|
306
|
-
( __param(0, ILogService)),
|
|
307
|
-
( __param(1, IWorkspaceContextService)),
|
|
308
|
-
( __param(2, IContextKeyService)),
|
|
309
|
-
( __param(3, IStorageService))
|
|
310
|
-
], SCMService));
|
|
311
|
-
|
|
312
|
-
export { SCMService };
|