@codingame/monaco-vscode-scm-service-override 25.1.2 → 26.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 +106 -60
- package/vscode/src/vs/workbench/contrib/scm/browser/media/scm.css +6 -2
- package/vscode/src/vs/workbench/contrib/scm/browser/menus.js +50 -42
- package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffDecorator.js +170 -119
- package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffModel.js +99 -74
- package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffWidget.js +245 -169
- package/vscode/src/vs/workbench/contrib/scm/browser/scm.contribution.js +321 -328
- package/vscode/src/vs/workbench/contrib/scm/browser/scmAccessibilityHelp.js +44 -46
- package/vscode/src/vs/workbench/contrib/scm/browser/scmHistoryViewPane.js +596 -511
- package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoriesViewPane.js +256 -266
- package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoryRenderer.js +72 -67
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPane.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPane.js +947 -671
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPaneContainer.js +18 -16
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewService.js +152 -106
- package/vscode/src/vs/workbench/contrib/scm/browser/workingSet.js +43 -21
- package/vscode/src/vs/workbench/contrib/scm/common/scmService.js +67 -52
|
@@ -28,7 +28,7 @@ import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/in
|
|
|
28
28
|
import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
|
|
29
29
|
|
|
30
30
|
const decoratorQuickDiffModelOptions = {
|
|
31
|
-
algorithm:
|
|
31
|
+
algorithm: "advanced",
|
|
32
32
|
maxComputationTimeMs: 1000
|
|
33
33
|
};
|
|
34
34
|
let QuickDiffModelReferenceCollection = class QuickDiffModelReferenceCollection extends ReferenceCollection {
|
|
@@ -43,9 +43,7 @@ let QuickDiffModelReferenceCollection = class QuickDiffModelReferenceCollection
|
|
|
43
43
|
object.dispose();
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
QuickDiffModelReferenceCollection = ( __decorate([
|
|
47
|
-
( __param(0, IInstantiationService))
|
|
48
|
-
], QuickDiffModelReferenceCollection));
|
|
46
|
+
QuickDiffModelReferenceCollection = ( __decorate([( __param(0, IInstantiationService))], QuickDiffModelReferenceCollection));
|
|
49
47
|
let QuickDiffModelService = class QuickDiffModelService {
|
|
50
48
|
constructor(instantiationService, textFileService, uriIdentityService) {
|
|
51
49
|
this.instantiationService = instantiationService;
|
|
@@ -58,23 +56,37 @@ let QuickDiffModelService = class QuickDiffModelService {
|
|
|
58
56
|
if (!textFileModel?.isResolved()) {
|
|
59
57
|
return undefined;
|
|
60
58
|
}
|
|
61
|
-
resource = this.uriIdentityService.asCanonicalUri(resource).with({
|
|
59
|
+
resource = this.uriIdentityService.asCanonicalUri(resource).with({
|
|
60
|
+
query: JSON.stringify(options)
|
|
61
|
+
});
|
|
62
62
|
return this._references.acquire(( resource.toString()), textFileModel, options);
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
|
-
QuickDiffModelService = ( __decorate([
|
|
66
|
-
( __param(0, IInstantiationService)),
|
|
67
|
-
( __param(1, ITextFileService)),
|
|
68
|
-
( __param(2, IUriIdentityService))
|
|
69
|
-
], QuickDiffModelService));
|
|
65
|
+
QuickDiffModelService = ( __decorate([( __param(0, IInstantiationService)), ( __param(1, ITextFileService)), ( __param(2, IUriIdentityService))], QuickDiffModelService));
|
|
70
66
|
let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
71
67
|
get originalTextModels() {
|
|
72
68
|
return ( Iterable.map(( this._originalEditorModels.values()), editorModel => editorModel.textEditorModel));
|
|
73
69
|
}
|
|
74
|
-
get allChanges() {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
70
|
+
get allChanges() {
|
|
71
|
+
return this._allChanges;
|
|
72
|
+
}
|
|
73
|
+
get changes() {
|
|
74
|
+
return this._changes;
|
|
75
|
+
}
|
|
76
|
+
get quickDiffChanges() {
|
|
77
|
+
return this._quickDiffChanges;
|
|
78
|
+
}
|
|
79
|
+
constructor(
|
|
80
|
+
textFileModel,
|
|
81
|
+
options,
|
|
82
|
+
scmService,
|
|
83
|
+
quickDiffService,
|
|
84
|
+
editorWorkerService,
|
|
85
|
+
configurationService,
|
|
86
|
+
textModelResolverService,
|
|
87
|
+
_chatEditingService,
|
|
88
|
+
progressService
|
|
89
|
+
) {
|
|
78
90
|
super();
|
|
79
91
|
this.options = options;
|
|
80
92
|
this.scmService = scmService;
|
|
@@ -97,7 +109,10 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
97
109
|
this._repositoryDisposables = ( new DisposableMap());
|
|
98
110
|
this._model = textFileModel;
|
|
99
111
|
this._register(textFileModel.textEditorModel.onDidChangeContent(() => this.triggerDiff()));
|
|
100
|
-
this._register(Event.filter(
|
|
112
|
+
this._register(Event.filter(
|
|
113
|
+
configurationService.onDidChangeConfiguration,
|
|
114
|
+
e => e.affectsConfiguration("scm.diffDecorationsIgnoreTrimWhitespace") || e.affectsConfiguration("diffEditor.ignoreTrimWhitespace")
|
|
115
|
+
)(this.triggerDiff, this));
|
|
101
116
|
this._register(scmService.onDidAddRepository(this.onDidAddRepository, this));
|
|
102
117
|
for (const r of scmService.repositories) {
|
|
103
118
|
this.onDidAddRepository(r);
|
|
@@ -110,7 +125,9 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
110
125
|
this.setChanges([], [], ( new Map()));
|
|
111
126
|
this.triggerDiff();
|
|
112
127
|
}));
|
|
113
|
-
this._register(
|
|
128
|
+
this._register(
|
|
129
|
+
this.quickDiffService.onDidChangeQuickDiffProviders(() => this.triggerDiff())
|
|
130
|
+
);
|
|
114
131
|
this._register(autorun(reader => {
|
|
115
132
|
for (const session of this._chatEditingService.editingSessionsObs.read(reader)) {
|
|
116
133
|
reader.store.add(autorun(r => {
|
|
@@ -128,9 +145,10 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
128
145
|
}
|
|
129
146
|
getQuickDiffResults() {
|
|
130
147
|
return ( this._quickDiffs.map(quickDiff => {
|
|
131
|
-
const changes = this.allChanges
|
|
132
|
-
.filter(change => change.providerId === quickDiff.id);
|
|
148
|
+
const changes = this.allChanges.filter(change => change.providerId === quickDiff.id);
|
|
133
149
|
return {
|
|
150
|
+
providerId: quickDiff.id,
|
|
151
|
+
providerKind: quickDiff.kind,
|
|
134
152
|
original: quickDiff.originalResource,
|
|
135
153
|
modified: this._model.resource,
|
|
136
154
|
changes: ( changes.map(change => change.change)),
|
|
@@ -140,17 +158,18 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
140
158
|
}
|
|
141
159
|
getDiffEditorModel(originalUri) {
|
|
142
160
|
const editorModel = this._originalEditorModels.get(originalUri);
|
|
143
|
-
return editorModel ?
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
} : undefined;
|
|
161
|
+
return editorModel ? {
|
|
162
|
+
modified: this._model.textEditorModel,
|
|
163
|
+
original: editorModel.textEditorModel
|
|
164
|
+
} : undefined;
|
|
148
165
|
}
|
|
149
166
|
onDidAddRepository(repository) {
|
|
150
167
|
const disposables = ( new DisposableStore());
|
|
151
168
|
disposables.add(repository.provider.onDidChangeResources(this.triggerDiff, this));
|
|
152
169
|
const onDidRemoveRepository = Event.filter(this.scmService.onDidRemoveRepository, r => r === repository);
|
|
153
|
-
disposables.add(
|
|
170
|
+
disposables.add(
|
|
171
|
+
onDidRemoveRepository(() => this._repositoryDisposables.deleteAndDispose(repository))
|
|
172
|
+
);
|
|
154
173
|
this._repositoryDisposables.set(repository, disposables);
|
|
155
174
|
this.triggerDiff();
|
|
156
175
|
}
|
|
@@ -158,40 +177,51 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
158
177
|
if (!this._diffDelayer) {
|
|
159
178
|
return;
|
|
160
179
|
}
|
|
161
|
-
this._diffDelayer
|
|
162
|
-
.trigger(async () => {
|
|
180
|
+
this._diffDelayer.trigger(async () => {
|
|
163
181
|
const result = await this.diff();
|
|
164
182
|
const editorModels = Array.from(( this._originalEditorModels.values()));
|
|
165
183
|
if (!result || this._disposed || this._model.isDisposed() || ( editorModels.some(editorModel => editorModel.isDisposed()))) {
|
|
166
184
|
return;
|
|
167
185
|
}
|
|
168
186
|
this.setChanges(result.allChanges, result.changes, result.mapChanges);
|
|
169
|
-
})
|
|
170
|
-
.catch(err => onUnexpectedError(err));
|
|
187
|
+
}).catch(err => onUnexpectedError(err));
|
|
171
188
|
}
|
|
172
189
|
setChanges(allChanges, changes, mapChanges) {
|
|
173
190
|
const diff = sortedDiff(this.changes, changes, (a, b) => compareChanges(a.change, b.change));
|
|
174
191
|
this._allChanges = allChanges;
|
|
175
192
|
this._changes = changes;
|
|
176
193
|
this._quickDiffChanges = mapChanges;
|
|
177
|
-
this._onDidChange.fire({
|
|
194
|
+
this._onDidChange.fire({
|
|
195
|
+
changes,
|
|
196
|
+
diff
|
|
197
|
+
});
|
|
178
198
|
}
|
|
179
199
|
diff() {
|
|
180
|
-
return this.progressService.withProgress({
|
|
200
|
+
return this.progressService.withProgress({
|
|
201
|
+
location: ProgressLocation.Scm,
|
|
202
|
+
delay: 250
|
|
203
|
+
}, async () => {
|
|
181
204
|
const originalURIs = await this.getQuickDiffsPromise();
|
|
182
205
|
if (this._disposed || this._model.isDisposed() || (originalURIs.length === 0)) {
|
|
183
|
-
return Promise.resolve({
|
|
206
|
+
return Promise.resolve({
|
|
207
|
+
allChanges: [],
|
|
208
|
+
changes: [],
|
|
209
|
+
mapChanges: ( new Map())
|
|
210
|
+
});
|
|
184
211
|
}
|
|
185
|
-
const quickDiffs = originalURIs
|
|
186
|
-
|
|
212
|
+
const quickDiffs = originalURIs.filter(
|
|
213
|
+
quickDiff => this.editorWorkerService.canComputeDirtyDiff(quickDiff.originalResource, this._model.resource)
|
|
214
|
+
);
|
|
187
215
|
if (quickDiffs.length === 0) {
|
|
188
|
-
return Promise.resolve({
|
|
216
|
+
return Promise.resolve({
|
|
217
|
+
allChanges: [],
|
|
218
|
+
changes: [],
|
|
219
|
+
mapChanges: ( new Map())
|
|
220
|
+
});
|
|
189
221
|
}
|
|
190
|
-
const quickDiffPrimary = quickDiffs.find(quickDiff => quickDiff.kind ===
|
|
191
|
-
const ignoreTrimWhitespaceSetting = this.configurationService.getValue(
|
|
192
|
-
const ignoreTrimWhitespace = ignoreTrimWhitespaceSetting ===
|
|
193
|
-
? this.configurationService.getValue('diffEditor.ignoreTrimWhitespace')
|
|
194
|
-
: ignoreTrimWhitespaceSetting !== 'false';
|
|
222
|
+
const quickDiffPrimary = quickDiffs.find(quickDiff => quickDiff.kind === "primary");
|
|
223
|
+
const ignoreTrimWhitespaceSetting = this.configurationService.getValue("scm.diffDecorationsIgnoreTrimWhitespace");
|
|
224
|
+
const ignoreTrimWhitespace = ignoreTrimWhitespaceSetting === "inherit" ? this.configurationService.getValue("diffEditor.ignoreTrimWhitespace") : ignoreTrimWhitespaceSetting !== "false";
|
|
195
225
|
const diffs = [];
|
|
196
226
|
const secondaryDiffs = [];
|
|
197
227
|
for (const quickDiff of quickDiffs) {
|
|
@@ -199,10 +229,10 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
199
229
|
if (diff.changes && diff.changes2 && diff.changes.length === diff.changes2.length) {
|
|
200
230
|
for (let index = 0; index < diff.changes.length; index++) {
|
|
201
231
|
const change2 = diff.changes2[index];
|
|
202
|
-
if (quickDiffPrimary && quickDiff.kind ===
|
|
203
|
-
const primaryQuickDiffChange = diffs
|
|
204
|
-
|
|
205
|
-
|
|
232
|
+
if (quickDiffPrimary && quickDiff.kind === "secondary") {
|
|
233
|
+
const primaryQuickDiffChange = diffs.find(
|
|
234
|
+
d => d.change2.modified.equals(change2.modified) && d.change2.original.length === change2.original.length
|
|
235
|
+
);
|
|
206
236
|
if (primaryQuickDiffChange) {
|
|
207
237
|
const primaryModel = this._originalEditorModels.get(quickDiffPrimary.originalResource)?.textEditorModel;
|
|
208
238
|
const primaryContent = primaryModel?.getValueInRange(primaryQuickDiffChange.change2.toRangeMapping().originalRange);
|
|
@@ -240,21 +270,30 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
240
270
|
}
|
|
241
271
|
map.get(providerId).push(i);
|
|
242
272
|
}
|
|
243
|
-
return {
|
|
273
|
+
return {
|
|
274
|
+
allChanges: allDiffsSorted,
|
|
275
|
+
changes: diffsSorted,
|
|
276
|
+
mapChanges: map
|
|
277
|
+
};
|
|
244
278
|
});
|
|
245
279
|
}
|
|
246
280
|
async _diff(original, modified, ignoreTrimWhitespace) {
|
|
247
281
|
const maxComputationTimeMs = this.options.maxComputationTimeMs ?? Number.MAX_SAFE_INTEGER;
|
|
248
282
|
const result = await this.editorWorkerService.computeDiff(original, modified, {
|
|
249
|
-
computeMoves: false,
|
|
283
|
+
computeMoves: false,
|
|
284
|
+
ignoreTrimWhitespace,
|
|
285
|
+
maxComputationTimeMs
|
|
250
286
|
}, this.options.algorithm);
|
|
251
|
-
return {
|
|
287
|
+
return {
|
|
288
|
+
changes: result ? toLineChanges(DiffState.fromDiffResult(result)) : null,
|
|
289
|
+
changes2: result?.changes ?? null
|
|
290
|
+
};
|
|
252
291
|
}
|
|
253
292
|
getQuickDiffsPromise() {
|
|
254
293
|
if (this._quickDiffsPromise) {
|
|
255
294
|
return this._quickDiffsPromise;
|
|
256
295
|
}
|
|
257
|
-
this._quickDiffsPromise = this.getOriginalResource().then(async
|
|
296
|
+
this._quickDiffsPromise = this.getOriginalResource().then(async quickDiffs => {
|
|
258
297
|
if (this._disposed) {
|
|
259
298
|
return [];
|
|
260
299
|
}
|
|
@@ -263,15 +302,13 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
263
302
|
this._originalEditorModels.clear();
|
|
264
303
|
return [];
|
|
265
304
|
}
|
|
266
|
-
if (equals(this._quickDiffs, quickDiffs, (a, b) => a.id === b.id &&
|
|
267
|
-
( a.originalResource.toString()) === ( b.originalResource.toString()) &&
|
|
268
|
-
this.quickDiffService.isQuickDiffProviderVisible(a.id) === this.quickDiffService.isQuickDiffProviderVisible(b.id))) {
|
|
305
|
+
if (equals(this._quickDiffs, quickDiffs, (a, b) => a.id === b.id && ( a.originalResource.toString()) === ( b.originalResource.toString()) && this.quickDiffService.isQuickDiffProviderVisible(a.id) === this.quickDiffService.isQuickDiffProviderVisible(b.id))) {
|
|
269
306
|
return quickDiffs;
|
|
270
307
|
}
|
|
271
308
|
this._quickDiffs = quickDiffs;
|
|
272
309
|
this._originalEditorModels.clear();
|
|
273
310
|
this._originalEditorModelsDisposables.clear();
|
|
274
|
-
return (await Promise.all(( quickDiffs.map(async
|
|
311
|
+
return (await Promise.all(( quickDiffs.map(async quickDiff => {
|
|
275
312
|
try {
|
|
276
313
|
const ref = await this.textModelResolverService.createModelReference(quickDiff.originalResource);
|
|
277
314
|
if (this._disposed) {
|
|
@@ -288,8 +325,7 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
288
325
|
this._originalEditorModelsDisposables.add(ref);
|
|
289
326
|
this._originalEditorModelsDisposables.add(ref.object.textEditorModel.onDidChangeContent(() => this.triggerDiff()));
|
|
290
327
|
return quickDiff;
|
|
291
|
-
}
|
|
292
|
-
catch (error) {
|
|
328
|
+
} catch (error) {
|
|
293
329
|
return [];
|
|
294
330
|
}
|
|
295
331
|
})))).flat();
|
|
@@ -303,8 +339,7 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
303
339
|
return Promise.resolve([]);
|
|
304
340
|
}
|
|
305
341
|
const uri = this._model.resource;
|
|
306
|
-
const isBeingModifiedByChatEdits = ( this._chatEditingService.editingSessionsObs.get()
|
|
307
|
-
.some(
|
|
342
|
+
const isBeingModifiedByChatEdits = ( this._chatEditingService.editingSessionsObs.get().some(
|
|
308
343
|
session => session.getEntry(uri)?.state.get() === ModifiedFileEntryState.Modified
|
|
309
344
|
));
|
|
310
345
|
if (isBeingModifiedByChatEdits) {
|
|
@@ -314,9 +349,9 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
314
349
|
return this.quickDiffService.getQuickDiffs(uri, this._model.getLanguageId(), isSynchronized);
|
|
315
350
|
}
|
|
316
351
|
findNextClosestChange(lineNumber, inclusive = true, providerId) {
|
|
317
|
-
const visibleQuickDiffIds = ( new Set(( this.quickDiffs
|
|
318
|
-
|
|
319
|
-
|
|
352
|
+
const visibleQuickDiffIds = ( new Set(( this.quickDiffs.filter(
|
|
353
|
+
quickDiff => this.quickDiffService.isQuickDiffProviderVisible(quickDiff.id)
|
|
354
|
+
).map(quickDiff => quickDiff.id))));
|
|
320
355
|
for (let i = 0; i < this.changes.length; i++) {
|
|
321
356
|
if (providerId && this.changes[i].providerId !== providerId) {
|
|
322
357
|
continue;
|
|
@@ -329,8 +364,7 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
329
364
|
if (getModifiedEndLineNumber(change) >= lineNumber) {
|
|
330
365
|
return i;
|
|
331
366
|
}
|
|
332
|
-
}
|
|
333
|
-
else {
|
|
367
|
+
} else {
|
|
334
368
|
if (change.modifiedStartLineNumber > lineNumber) {
|
|
335
369
|
return i;
|
|
336
370
|
}
|
|
@@ -339,9 +373,9 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
339
373
|
return 0;
|
|
340
374
|
}
|
|
341
375
|
findPreviousClosestChange(lineNumber, inclusive = true, providerId) {
|
|
342
|
-
const visibleQuickDiffIds = ( new Set(( this.quickDiffs
|
|
343
|
-
|
|
344
|
-
|
|
376
|
+
const visibleQuickDiffIds = ( new Set(( this.quickDiffs.filter(
|
|
377
|
+
quickDiff => this.quickDiffService.isQuickDiffProviderVisible(quickDiff.id)
|
|
378
|
+
).map(quickDiff => quickDiff.id))));
|
|
345
379
|
for (let i = this.changes.length - 1; i >= 0; i--) {
|
|
346
380
|
if (providerId && this.changes[i].providerId !== providerId) {
|
|
347
381
|
continue;
|
|
@@ -354,8 +388,7 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
354
388
|
if (change.modifiedStartLineNumber <= lineNumber) {
|
|
355
389
|
return i;
|
|
356
390
|
}
|
|
357
|
-
}
|
|
358
|
-
else {
|
|
391
|
+
} else {
|
|
359
392
|
if (getModifiedEndLineNumber(change) < lineNumber) {
|
|
360
393
|
return i;
|
|
361
394
|
}
|
|
@@ -372,14 +405,6 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
372
405
|
super.dispose();
|
|
373
406
|
}
|
|
374
407
|
};
|
|
375
|
-
QuickDiffModel = ( __decorate([
|
|
376
|
-
( __param(2, ISCMService)),
|
|
377
|
-
( __param(3, IQuickDiffService)),
|
|
378
|
-
( __param(4, IEditorWorkerService)),
|
|
379
|
-
( __param(5, IConfigurationService)),
|
|
380
|
-
( __param(6, ITextModelService)),
|
|
381
|
-
( __param(7, IChatEditingService)),
|
|
382
|
-
( __param(8, IProgressService))
|
|
383
|
-
], QuickDiffModel));
|
|
408
|
+
QuickDiffModel = ( __decorate([( __param(2, ISCMService)), ( __param(3, IQuickDiffService)), ( __param(4, IEditorWorkerService)), ( __param(5, IConfigurationService)), ( __param(6, ITextModelService)), ( __param(7, IChatEditingService)), ( __param(8, IProgressService))], QuickDiffModel));
|
|
384
409
|
|
|
385
410
|
export { QuickDiffModel, QuickDiffModelService };
|