@codingame/monaco-vscode-scm-service-override 13.1.7 → 14.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/index.js +4 -4
- package/package.json +12 -12
- package/vscode/src/vs/workbench/contrib/scm/browser/activity.js +4 -4
- package/vscode/src/vs/workbench/contrib/scm/browser/media/dirtydiffDecorator.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/media/scm.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/scm/browser/menus.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/menus.js +12 -11
- package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffDecorator.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffDecorator.js +283 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffModel.d.ts +74 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffModel.js +365 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffWidget.d.ts +78 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffWidget.js +809 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/scm.contribution.js +92 -91
- package/vscode/src/vs/workbench/contrib/scm/browser/scmAccessibilityHelp.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/scmAccessibilityHelp.js +138 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/scmHistoryViewPane.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/scm/browser/scmHistoryViewPane.js +122 -71
- package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoriesViewPane.js +1 -1
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPane.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPane.js +96 -45
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPaneContainer.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPaneContainer.js +7 -5
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/scm/browser/workingSet.js +1 -1
- package/vscode/src/vs/workbench/contrib/scm/common/scmService.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/scm/common/scmService.js +23 -7
- package/vscode/src/vs/workbench/contrib/scm/browser/diff.d.ts +0 -22
- package/vscode/src/vs/workbench/contrib/scm/browser/diff.js +0 -93
- package/vscode/src/vs/workbench/contrib/scm/common/quickDiffService.d.ts +0 -16
- package/vscode/src/vs/workbench/contrib/scm/common/quickDiffService.js +0 -78
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
4
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
5
|
+
import { isTextFileEditorModel, EncodingMode } from '@codingame/monaco-vscode-a17f5129-e16c-5dac-857e-dcd91bfeffa2-common/vscode/vs/workbench/services/textfile/common/textfiles';
|
|
6
|
+
import { ITextFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/textfile/common/textfiles.service';
|
|
7
|
+
import { ReferenceCollection, Disposable, DisposableStore, DisposableMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
8
|
+
import { IEditorWorkerService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/editorWorker';
|
|
9
|
+
import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
10
|
+
import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService';
|
|
11
|
+
import { shouldSynchronizeModel } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/model';
|
|
12
|
+
import { compareChanges, getModifiedEndLineNumber } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/scm/common/quickDiff';
|
|
13
|
+
import { IQuickDiffService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/scm/common/quickDiff.service';
|
|
14
|
+
import { ThrottledDelayer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
15
|
+
import { ISCMService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/scm/common/scm.service';
|
|
16
|
+
import { sortedDiff, equals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
17
|
+
import { onUnexpectedError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
18
|
+
import { Iterable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iterator';
|
|
19
|
+
import { DiffState } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/diffEditor/diffEditorViewModel';
|
|
20
|
+
import { toLineChanges } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/diffEditor/diffEditorWidget';
|
|
21
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
22
|
+
import { ProgressLocation } from '@codingame/monaco-vscode-api/vscode/vs/platform/progress/common/progress';
|
|
23
|
+
import { IProgressService } from '@codingame/monaco-vscode-api/vscode/vs/platform/progress/common/progress.service';
|
|
24
|
+
import { WorkingSetEntryState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService';
|
|
25
|
+
import { IChatEditingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
|
|
26
|
+
import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
27
|
+
import { autorunWithStore, autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
|
|
28
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/derived';
|
|
29
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
30
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils';
|
|
31
|
+
|
|
32
|
+
const decoratorQuickDiffModelOptions = {
|
|
33
|
+
algorithm: 'legacy',
|
|
34
|
+
maxComputationTimeMs: 1000
|
|
35
|
+
};
|
|
36
|
+
let QuickDiffModelReferenceCollection = class QuickDiffModelReferenceCollection extends ReferenceCollection {
|
|
37
|
+
constructor(_instantiationService) {
|
|
38
|
+
super();
|
|
39
|
+
this._instantiationService = _instantiationService;
|
|
40
|
+
}
|
|
41
|
+
createReferencedObject(_key, textFileModel, options) {
|
|
42
|
+
return this._instantiationService.createInstance(QuickDiffModel, textFileModel, options);
|
|
43
|
+
}
|
|
44
|
+
destroyReferencedObject(_key, object) {
|
|
45
|
+
object.dispose();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
QuickDiffModelReferenceCollection = ( __decorate([
|
|
49
|
+
( __param(0, IInstantiationService))
|
|
50
|
+
], QuickDiffModelReferenceCollection));
|
|
51
|
+
let QuickDiffModelService = class QuickDiffModelService {
|
|
52
|
+
constructor(instantiationService, textFileService, uriIdentityService) {
|
|
53
|
+
this.instantiationService = instantiationService;
|
|
54
|
+
this.textFileService = textFileService;
|
|
55
|
+
this.uriIdentityService = uriIdentityService;
|
|
56
|
+
this._references = this.instantiationService.createInstance(QuickDiffModelReferenceCollection);
|
|
57
|
+
}
|
|
58
|
+
createQuickDiffModelReference(resource, options = decoratorQuickDiffModelOptions) {
|
|
59
|
+
const textFileModel = this.textFileService.files.get(resource);
|
|
60
|
+
if (!textFileModel?.isResolved()) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
resource = this.uriIdentityService.asCanonicalUri(resource).with({ query: JSON.stringify(options) });
|
|
64
|
+
return this._references.acquire(( resource.toString()), textFileModel, options);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
QuickDiffModelService = ( __decorate([
|
|
68
|
+
( __param(0, IInstantiationService)),
|
|
69
|
+
( __param(1, ITextFileService)),
|
|
70
|
+
( __param(2, IUriIdentityService))
|
|
71
|
+
], QuickDiffModelService));
|
|
72
|
+
let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
73
|
+
get originalTextModels() {
|
|
74
|
+
return ( Iterable.map(( this._originalEditorModels.values()), editorModel => editorModel.textEditorModel));
|
|
75
|
+
}
|
|
76
|
+
get changes() { return this._changes; }
|
|
77
|
+
get quickDiffChanges() { return this._quickDiffChanges; }
|
|
78
|
+
constructor(textFileModel, options, scmService, quickDiffService, editorWorkerService, configurationService, textModelResolverService, _chatEditingService, progressService) {
|
|
79
|
+
super();
|
|
80
|
+
this.options = options;
|
|
81
|
+
this.scmService = scmService;
|
|
82
|
+
this.quickDiffService = quickDiffService;
|
|
83
|
+
this.editorWorkerService = editorWorkerService;
|
|
84
|
+
this.configurationService = configurationService;
|
|
85
|
+
this.textModelResolverService = textModelResolverService;
|
|
86
|
+
this._chatEditingService = _chatEditingService;
|
|
87
|
+
this.progressService = progressService;
|
|
88
|
+
this._originalEditorModels = ( new ResourceMap());
|
|
89
|
+
this._originalEditorModelsDisposables = this._register(( new DisposableStore()));
|
|
90
|
+
this._disposed = false;
|
|
91
|
+
this._quickDiffs = [];
|
|
92
|
+
this._diffDelayer = ( new ThrottledDelayer(200));
|
|
93
|
+
this._onDidChange = ( new Emitter());
|
|
94
|
+
this.onDidChange = this._onDidChange.event;
|
|
95
|
+
this._changes = [];
|
|
96
|
+
this._quickDiffChanges = ( new Map());
|
|
97
|
+
this._repositoryDisposables = ( new DisposableMap());
|
|
98
|
+
this._model = textFileModel;
|
|
99
|
+
this._register(textFileModel.textEditorModel.onDidChangeContent(() => this.triggerDiff()));
|
|
100
|
+
this._register(Event.filter(configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.diffDecorationsIgnoreTrimWhitespace') || e.affectsConfiguration('diffEditor.ignoreTrimWhitespace'))(this.triggerDiff, this));
|
|
101
|
+
this._register(scmService.onDidAddRepository(this.onDidAddRepository, this));
|
|
102
|
+
for (const r of scmService.repositories) {
|
|
103
|
+
this.onDidAddRepository(r);
|
|
104
|
+
}
|
|
105
|
+
this._register(this._model.onDidChangeEncoding(() => {
|
|
106
|
+
this._diffDelayer.cancel();
|
|
107
|
+
this._quickDiffs = [];
|
|
108
|
+
this._originalEditorModels.clear();
|
|
109
|
+
this._quickDiffsPromise = undefined;
|
|
110
|
+
this.setChanges([], ( new Map()));
|
|
111
|
+
this.triggerDiff();
|
|
112
|
+
}));
|
|
113
|
+
this._register(this.quickDiffService.onDidChangeQuickDiffProviders(() => this.triggerDiff()));
|
|
114
|
+
this._register(autorunWithStore((r, store) => {
|
|
115
|
+
for (const session of this._chatEditingService.editingSessionsObs.read(r)) {
|
|
116
|
+
store.add(autorun(r => {
|
|
117
|
+
for (const entry of session.entries.read(r)) {
|
|
118
|
+
entry.state.read(r);
|
|
119
|
+
}
|
|
120
|
+
this.triggerDiff();
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
123
|
+
}));
|
|
124
|
+
this.triggerDiff();
|
|
125
|
+
}
|
|
126
|
+
get quickDiffs() {
|
|
127
|
+
return this._quickDiffs;
|
|
128
|
+
}
|
|
129
|
+
getQuickDiffResults() {
|
|
130
|
+
return ( this._quickDiffs.map(quickDiff => {
|
|
131
|
+
const changes = this.changes
|
|
132
|
+
.filter(change => change.label === quickDiff.label);
|
|
133
|
+
return {
|
|
134
|
+
label: quickDiff.label,
|
|
135
|
+
original: quickDiff.originalResource,
|
|
136
|
+
modified: this._model.resource,
|
|
137
|
+
changes: ( changes.map(change => change.change)),
|
|
138
|
+
changes2: ( changes.map(change => change.change2))
|
|
139
|
+
};
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
getDiffEditorModel(originalUri) {
|
|
143
|
+
const editorModel = this._originalEditorModels.get(originalUri);
|
|
144
|
+
return editorModel ?
|
|
145
|
+
{
|
|
146
|
+
modified: this._model.textEditorModel,
|
|
147
|
+
original: editorModel.textEditorModel
|
|
148
|
+
} : undefined;
|
|
149
|
+
}
|
|
150
|
+
onDidAddRepository(repository) {
|
|
151
|
+
const disposables = ( new DisposableStore());
|
|
152
|
+
disposables.add(repository.provider.onDidChangeResources(this.triggerDiff, this));
|
|
153
|
+
const onDidRemoveRepository = Event.filter(this.scmService.onDidRemoveRepository, r => r === repository);
|
|
154
|
+
disposables.add(onDidRemoveRepository(() => this._repositoryDisposables.deleteAndDispose(repository)));
|
|
155
|
+
this._repositoryDisposables.set(repository, disposables);
|
|
156
|
+
this.triggerDiff();
|
|
157
|
+
}
|
|
158
|
+
triggerDiff() {
|
|
159
|
+
if (!this._diffDelayer) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
this._diffDelayer
|
|
163
|
+
.trigger(async () => {
|
|
164
|
+
const result = await this.diff();
|
|
165
|
+
const editorModels = Array.from(( this._originalEditorModels.values()));
|
|
166
|
+
if (!result || this._disposed || this._model.isDisposed() || ( editorModels.some(editorModel => editorModel.isDisposed()))) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
this.setChanges(result.changes, result.mapChanges);
|
|
170
|
+
})
|
|
171
|
+
.catch(err => onUnexpectedError(err));
|
|
172
|
+
}
|
|
173
|
+
setChanges(changes, mapChanges) {
|
|
174
|
+
const diff = sortedDiff(this.changes, changes, (a, b) => compareChanges(a.change, b.change));
|
|
175
|
+
this._changes = changes;
|
|
176
|
+
this._quickDiffChanges = mapChanges;
|
|
177
|
+
this._onDidChange.fire({ changes, diff });
|
|
178
|
+
}
|
|
179
|
+
diff() {
|
|
180
|
+
return this.progressService.withProgress({ location: ProgressLocation.Scm, delay: 250 }, async () => {
|
|
181
|
+
const originalURIs = await this.getQuickDiffsPromise();
|
|
182
|
+
if (this._disposed || this._model.isDisposed() || (originalURIs.length === 0)) {
|
|
183
|
+
return Promise.resolve({ changes: [], mapChanges: ( new Map()) });
|
|
184
|
+
}
|
|
185
|
+
const filteredToDiffable = originalURIs.filter(quickDiff => this.editorWorkerService.canComputeDirtyDiff(quickDiff.originalResource, this._model.resource));
|
|
186
|
+
if (filteredToDiffable.length === 0) {
|
|
187
|
+
return Promise.resolve({ changes: [], mapChanges: ( new Map()) });
|
|
188
|
+
}
|
|
189
|
+
const ignoreTrimWhitespaceSetting = this.configurationService.getValue('scm.diffDecorationsIgnoreTrimWhitespace');
|
|
190
|
+
const ignoreTrimWhitespace = ignoreTrimWhitespaceSetting === 'inherit'
|
|
191
|
+
? this.configurationService.getValue('diffEditor.ignoreTrimWhitespace')
|
|
192
|
+
: ignoreTrimWhitespaceSetting !== 'false';
|
|
193
|
+
const allDiffs = [];
|
|
194
|
+
for (const quickDiff of filteredToDiffable) {
|
|
195
|
+
const diff = await this._diff(quickDiff.originalResource, this._model.resource, ignoreTrimWhitespace);
|
|
196
|
+
if (diff.changes && diff.changes2 && diff.changes.length === diff.changes2.length) {
|
|
197
|
+
for (let index = 0; index < diff.changes.length; index++) {
|
|
198
|
+
allDiffs.push({
|
|
199
|
+
label: quickDiff.label,
|
|
200
|
+
original: quickDiff.originalResource,
|
|
201
|
+
modified: this._model.resource,
|
|
202
|
+
change: diff.changes[index],
|
|
203
|
+
change2: diff.changes2[index]
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const sorted = allDiffs.sort((a, b) => compareChanges(a.change, b.change));
|
|
209
|
+
const map = ( new Map());
|
|
210
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
211
|
+
const label = sorted[i].label;
|
|
212
|
+
if (!( map.has(label))) {
|
|
213
|
+
map.set(label, []);
|
|
214
|
+
}
|
|
215
|
+
map.get(label).push(i);
|
|
216
|
+
}
|
|
217
|
+
return { changes: sorted, mapChanges: map };
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
async _diff(original, modified, ignoreTrimWhitespace) {
|
|
221
|
+
const maxComputationTimeMs = this.options.maxComputationTimeMs ?? Number.MAX_SAFE_INTEGER;
|
|
222
|
+
const result = await this.editorWorkerService.computeDiff(original, modified, {
|
|
223
|
+
computeMoves: false, ignoreTrimWhitespace, maxComputationTimeMs
|
|
224
|
+
}, this.options.algorithm);
|
|
225
|
+
return { changes: result ? toLineChanges(DiffState.fromDiffResult(result)) : null, changes2: result?.changes ?? null };
|
|
226
|
+
}
|
|
227
|
+
getQuickDiffsPromise() {
|
|
228
|
+
if (this._quickDiffsPromise) {
|
|
229
|
+
return this._quickDiffsPromise;
|
|
230
|
+
}
|
|
231
|
+
this._quickDiffsPromise = this.getOriginalResource().then(async (quickDiffs) => {
|
|
232
|
+
if (this._disposed) {
|
|
233
|
+
return [];
|
|
234
|
+
}
|
|
235
|
+
if (quickDiffs.length === 0) {
|
|
236
|
+
this._quickDiffs = [];
|
|
237
|
+
this._originalEditorModels.clear();
|
|
238
|
+
return [];
|
|
239
|
+
}
|
|
240
|
+
if (equals(this._quickDiffs, quickDiffs, (a, b) => ( a.originalResource.toString()) === ( b.originalResource.toString()) && a.label === b.label)) {
|
|
241
|
+
return quickDiffs;
|
|
242
|
+
}
|
|
243
|
+
this._quickDiffs = quickDiffs;
|
|
244
|
+
this._originalEditorModels.clear();
|
|
245
|
+
this._originalEditorModelsDisposables.clear();
|
|
246
|
+
return (await Promise.all(( quickDiffs.map(async (quickDiff) => {
|
|
247
|
+
try {
|
|
248
|
+
const ref = await this.textModelResolverService.createModelReference(quickDiff.originalResource);
|
|
249
|
+
if (this._disposed) {
|
|
250
|
+
ref.dispose();
|
|
251
|
+
return [];
|
|
252
|
+
}
|
|
253
|
+
this._originalEditorModels.set(quickDiff.originalResource, ref.object);
|
|
254
|
+
if (isTextFileEditorModel(ref.object)) {
|
|
255
|
+
const encoding = this._model.getEncoding();
|
|
256
|
+
if (encoding) {
|
|
257
|
+
ref.object.setEncoding(encoding, EncodingMode.Decode);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
this._originalEditorModelsDisposables.add(ref);
|
|
261
|
+
this._originalEditorModelsDisposables.add(ref.object.textEditorModel.onDidChangeContent(() => this.triggerDiff()));
|
|
262
|
+
return quickDiff;
|
|
263
|
+
}
|
|
264
|
+
catch (error) {
|
|
265
|
+
return [];
|
|
266
|
+
}
|
|
267
|
+
})))).flat();
|
|
268
|
+
});
|
|
269
|
+
return this._quickDiffsPromise.finally(() => {
|
|
270
|
+
this._quickDiffsPromise = undefined;
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
async getOriginalResource() {
|
|
274
|
+
if (this._disposed) {
|
|
275
|
+
return Promise.resolve([]);
|
|
276
|
+
}
|
|
277
|
+
const uri = this._model.resource;
|
|
278
|
+
const isBeingModifiedByChatEdits = ( this._chatEditingService.editingSessionsObs.get()
|
|
279
|
+
.some(
|
|
280
|
+
session => session.getEntry(uri)?.state.get() === WorkingSetEntryState.Modified
|
|
281
|
+
));
|
|
282
|
+
if (isBeingModifiedByChatEdits) {
|
|
283
|
+
return Promise.resolve([]);
|
|
284
|
+
}
|
|
285
|
+
const isSynchronized = this._model.textEditorModel ? shouldSynchronizeModel(this._model.textEditorModel) : undefined;
|
|
286
|
+
return this.quickDiffService.getQuickDiffs(uri, this._model.getLanguageId(), isSynchronized);
|
|
287
|
+
}
|
|
288
|
+
findNextClosestChange(lineNumber, inclusive = true, provider) {
|
|
289
|
+
let preferredProvider;
|
|
290
|
+
if (!provider && inclusive) {
|
|
291
|
+
preferredProvider = this.quickDiffs.find(value => value.isSCM)?.label;
|
|
292
|
+
}
|
|
293
|
+
const possibleChanges = [];
|
|
294
|
+
for (let i = 0; i < this.changes.length; i++) {
|
|
295
|
+
if (provider && this.changes[i].label !== provider) {
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
if (!this.quickDiffs.find(quickDiff => quickDiff.label === this.changes[i].label)?.visible) {
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
const change = this.changes[i];
|
|
302
|
+
const possibleChangesLength = possibleChanges.length;
|
|
303
|
+
if (inclusive) {
|
|
304
|
+
if (getModifiedEndLineNumber(change.change) >= lineNumber) {
|
|
305
|
+
if (preferredProvider && change.label !== preferredProvider) {
|
|
306
|
+
possibleChanges.push(i);
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
return i;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
if (change.change.modifiedStartLineNumber > lineNumber) {
|
|
315
|
+
return i;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
if ((possibleChanges.length > 0) && (possibleChanges.length === possibleChangesLength)) {
|
|
319
|
+
return possibleChanges[0];
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return possibleChanges.length > 0 ? possibleChanges[0] : 0;
|
|
323
|
+
}
|
|
324
|
+
findPreviousClosestChange(lineNumber, inclusive = true, provider) {
|
|
325
|
+
for (let i = this.changes.length - 1; i >= 0; i--) {
|
|
326
|
+
if (provider && this.changes[i].label !== provider) {
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
if (!this.quickDiffs.find(quickDiff => quickDiff.label === this.changes[i].label)?.visible) {
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
const change = this.changes[i].change;
|
|
333
|
+
if (inclusive) {
|
|
334
|
+
if (change.modifiedStartLineNumber <= lineNumber) {
|
|
335
|
+
return i;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
if (getModifiedEndLineNumber(change) < lineNumber) {
|
|
340
|
+
return i;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return this.changes.length - 1;
|
|
345
|
+
}
|
|
346
|
+
dispose() {
|
|
347
|
+
this._disposed = true;
|
|
348
|
+
this._quickDiffs = [];
|
|
349
|
+
this._diffDelayer.cancel();
|
|
350
|
+
this._originalEditorModels.clear();
|
|
351
|
+
this._repositoryDisposables.dispose();
|
|
352
|
+
super.dispose();
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
QuickDiffModel = ( __decorate([
|
|
356
|
+
( __param(2, ISCMService)),
|
|
357
|
+
( __param(3, IQuickDiffService)),
|
|
358
|
+
( __param(4, IEditorWorkerService)),
|
|
359
|
+
( __param(5, IConfigurationService)),
|
|
360
|
+
( __param(6, ITextModelService)),
|
|
361
|
+
( __param(7, IChatEditingService)),
|
|
362
|
+
( __param(8, IProgressService))
|
|
363
|
+
], QuickDiffModel));
|
|
364
|
+
|
|
365
|
+
export { QuickDiffModel, QuickDiffModelService };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Action, IAction } from "@codingame/monaco-vscode-api/vscode/vs/base/common/actions";
|
|
2
|
+
import { IContextViewService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service";
|
|
3
|
+
import { ISelectOptionItem } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/selectBox/selectBox";
|
|
4
|
+
import { SelectActionViewItem } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionViewItems";
|
|
5
|
+
import { IThemeService } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service";
|
|
6
|
+
import { ICodeEditor } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser";
|
|
7
|
+
import { EditorAction } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorExtensions";
|
|
8
|
+
import { IInstantiationService, ServicesAccessor } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
9
|
+
import { IEditorContribution } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/editorCommon";
|
|
10
|
+
import { IQuickDiffModelService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/scm/browser/quickDiffModel.service";
|
|
11
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
12
|
+
import { RawContextKey } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey";
|
|
13
|
+
import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
|
|
14
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
15
|
+
export declare const isQuickDiffVisible: RawContextKey<boolean>;
|
|
16
|
+
export interface IQuickDiffSelectItem extends ISelectOptionItem {
|
|
17
|
+
provider: string;
|
|
18
|
+
}
|
|
19
|
+
export declare class QuickDiffPickerViewItem extends SelectActionViewItem<IQuickDiffSelectItem> {
|
|
20
|
+
private readonly optionsItems;
|
|
21
|
+
constructor(action: IAction, providers: string[], selected: string, contextViewService: IContextViewService, themeService: IThemeService);
|
|
22
|
+
setSelection(provider: string): void;
|
|
23
|
+
protected getActionContext(_: string, index: number): IQuickDiffSelectItem;
|
|
24
|
+
render(container: HTMLElement): void;
|
|
25
|
+
}
|
|
26
|
+
export declare class QuickDiffPickerBaseAction extends Action {
|
|
27
|
+
private readonly callback;
|
|
28
|
+
static readonly ID = "quickDiff.base.switch";
|
|
29
|
+
static readonly LABEL: string;
|
|
30
|
+
constructor(callback: (event?: IQuickDiffSelectItem) => void);
|
|
31
|
+
run(event?: IQuickDiffSelectItem): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export declare class QuickDiffEditorController extends Disposable implements IEditorContribution {
|
|
34
|
+
private editor;
|
|
35
|
+
private readonly configurationService;
|
|
36
|
+
private readonly quickDiffModelService;
|
|
37
|
+
private readonly instantiationService;
|
|
38
|
+
static readonly ID = "editor.contrib.quickdiff";
|
|
39
|
+
static get(editor: ICodeEditor): QuickDiffEditorController | null;
|
|
40
|
+
private model;
|
|
41
|
+
private widget;
|
|
42
|
+
private readonly isQuickDiffVisible;
|
|
43
|
+
private session;
|
|
44
|
+
private mouseDownInfo;
|
|
45
|
+
private enabled;
|
|
46
|
+
private readonly gutterActionDisposables;
|
|
47
|
+
private stylesheet;
|
|
48
|
+
constructor(editor: ICodeEditor, contextKeyService: IContextKeyService, configurationService: IConfigurationService, quickDiffModelService: IQuickDiffModelService, instantiationService: IInstantiationService);
|
|
49
|
+
private onDidChangeGutterAction;
|
|
50
|
+
canNavigate(): boolean;
|
|
51
|
+
refresh(): void;
|
|
52
|
+
next(lineNumber?: number): void;
|
|
53
|
+
previous(lineNumber?: number): void;
|
|
54
|
+
close(): void;
|
|
55
|
+
private assertWidget;
|
|
56
|
+
private onDidModelChange;
|
|
57
|
+
private onEditorMouseDown;
|
|
58
|
+
private onEditorMouseUp;
|
|
59
|
+
dispose(): void;
|
|
60
|
+
}
|
|
61
|
+
export declare class ShowPreviousChangeAction extends EditorAction {
|
|
62
|
+
private readonly outerEditor?;
|
|
63
|
+
constructor(outerEditor?: ICodeEditor | undefined);
|
|
64
|
+
run(accessor: ServicesAccessor): void;
|
|
65
|
+
}
|
|
66
|
+
export declare class ShowNextChangeAction extends EditorAction {
|
|
67
|
+
private readonly outerEditor?;
|
|
68
|
+
constructor(outerEditor?: ICodeEditor | undefined);
|
|
69
|
+
run(accessor: ServicesAccessor): void;
|
|
70
|
+
}
|
|
71
|
+
export declare class GotoPreviousChangeAction extends EditorAction {
|
|
72
|
+
constructor();
|
|
73
|
+
run(accessor: ServicesAccessor): Promise<void>;
|
|
74
|
+
}
|
|
75
|
+
export declare class GotoNextChangeAction extends EditorAction {
|
|
76
|
+
constructor();
|
|
77
|
+
run(accessor: ServicesAccessor): Promise<void>;
|
|
78
|
+
}
|