@codingame/monaco-vscode-scm-service-override 16.1.0 → 17.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 +14 -14
- package/vscode/src/vs/workbench/contrib/scm/browser/activity.js +5 -5
- package/vscode/src/vs/workbench/contrib/scm/browser/media/dirtydiffDecorator.css +58 -21
- package/vscode/src/vs/workbench/contrib/scm/browser/media/scm.css +0 -3
- package/vscode/src/vs/workbench/contrib/scm/browser/menus.js +1 -1
- package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffDecorator.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffDecorator.js +113 -54
- package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffModel.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffModel.js +53 -43
- package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffWidget.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/scm/browser/quickDiffWidget.js +45 -37
- package/vscode/src/vs/workbench/contrib/scm/browser/scm.contribution.js +86 -80
- package/vscode/src/vs/workbench/contrib/scm/browser/scmAccessibilityHelp.js +23 -23
- package/vscode/src/vs/workbench/contrib/scm/browser/scmHistoryViewPane.js +30 -30
- package/vscode/src/vs/workbench/contrib/scm/browser/scmRepositoriesViewPane.js +1 -1
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewPane.js +26 -26
- package/vscode/src/vs/workbench/contrib/scm/browser/scmViewService.js +1 -1
- package/vscode/src/vs/workbench/contrib/scm/browser/workingSet.js +1 -1
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
4
4
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
5
|
-
import { isTextFileEditorModel, EncodingMode } from '@codingame/monaco-vscode-
|
|
5
|
+
import { isTextFileEditorModel, EncodingMode } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/textfile/common/textfiles';
|
|
6
6
|
import { ITextFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/textfile/common/textfiles.service';
|
|
7
7
|
import { ReferenceCollection, Disposable, DisposableStore, DisposableMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
8
8
|
import { IEditorWorkerService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/editorWorker.service';
|
|
9
9
|
import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
10
10
|
import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service';
|
|
11
11
|
import { shouldSynchronizeModel } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/model';
|
|
12
|
-
import { compareChanges, getModifiedEndLineNumber } from '@codingame/monaco-vscode-
|
|
12
|
+
import { compareChanges, getModifiedEndLineNumber } from '@codingame/monaco-vscode-bb83fe45-f4c7-5673-b9f1-5c409a63f19c-common/vscode/vs/workbench/contrib/scm/common/quickDiff';
|
|
13
13
|
import { IQuickDiffService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/scm/common/quickDiff.service';
|
|
14
14
|
import { ThrottledDelayer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
15
15
|
import { ISCMService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/scm/common/scm.service';
|
|
@@ -21,7 +21,7 @@ import { toLineChanges } from '@codingame/monaco-vscode-api/vscode/vs/editor/bro
|
|
|
21
21
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
22
22
|
import { ProgressLocation } from '@codingame/monaco-vscode-api/vscode/vs/platform/progress/common/progress';
|
|
23
23
|
import { IProgressService } from '@codingame/monaco-vscode-api/vscode/vs/platform/progress/common/progress.service';
|
|
24
|
-
import {
|
|
24
|
+
import { ModifiedFileEntryState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService';
|
|
25
25
|
import { IChatEditingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
|
|
26
26
|
import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
27
27
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
@@ -127,9 +127,8 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
127
127
|
getQuickDiffResults() {
|
|
128
128
|
return ( this._quickDiffs.map(quickDiff => {
|
|
129
129
|
const changes = this.changes
|
|
130
|
-
.filter(change => change.
|
|
130
|
+
.filter(change => change.providerId === quickDiff.id);
|
|
131
131
|
return {
|
|
132
|
-
label: quickDiff.label,
|
|
133
132
|
original: quickDiff.originalResource,
|
|
134
133
|
modified: this._model.resource,
|
|
135
134
|
changes: ( changes.map(change => change.change)),
|
|
@@ -180,20 +179,38 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
180
179
|
if (this._disposed || this._model.isDisposed() || (originalURIs.length === 0)) {
|
|
181
180
|
return Promise.resolve({ changes: [], mapChanges: ( new Map()) });
|
|
182
181
|
}
|
|
183
|
-
const
|
|
184
|
-
|
|
182
|
+
const quickDiffs = originalURIs
|
|
183
|
+
.filter(quickDiff => this.editorWorkerService.canComputeDirtyDiff(quickDiff.originalResource, this._model.resource));
|
|
184
|
+
if (quickDiffs.length === 0) {
|
|
185
185
|
return Promise.resolve({ changes: [], mapChanges: ( new Map()) });
|
|
186
186
|
}
|
|
187
|
+
const quickDiffPrimary = quickDiffs.find(quickDiff => quickDiff.kind === 'primary');
|
|
187
188
|
const ignoreTrimWhitespaceSetting = this.configurationService.getValue('scm.diffDecorationsIgnoreTrimWhitespace');
|
|
188
189
|
const ignoreTrimWhitespace = ignoreTrimWhitespaceSetting === 'inherit'
|
|
189
190
|
? this.configurationService.getValue('diffEditor.ignoreTrimWhitespace')
|
|
190
191
|
: ignoreTrimWhitespaceSetting !== 'false';
|
|
191
192
|
const allDiffs = [];
|
|
192
|
-
for (const quickDiff of
|
|
193
|
+
for (const quickDiff of quickDiffs) {
|
|
193
194
|
const diff = await this._diff(quickDiff.originalResource, this._model.resource, ignoreTrimWhitespace);
|
|
194
195
|
if (diff.changes && diff.changes2 && diff.changes.length === diff.changes2.length) {
|
|
195
196
|
for (let index = 0; index < diff.changes.length; index++) {
|
|
197
|
+
const change2 = diff.changes2[index];
|
|
198
|
+
if (quickDiffPrimary && quickDiff.kind === 'secondary') {
|
|
199
|
+
const primaryQuickDiffChange = allDiffs
|
|
200
|
+
.find(d => d.change2.modified.equals(change2.modified) &&
|
|
201
|
+
d.change2.original.length === change2.original.length);
|
|
202
|
+
if (primaryQuickDiffChange) {
|
|
203
|
+
const primaryModel = this._originalEditorModels.get(quickDiffPrimary.originalResource)?.textEditorModel;
|
|
204
|
+
const primaryContent = primaryModel?.getValueInRange(primaryQuickDiffChange.change2.toRangeMapping().originalRange);
|
|
205
|
+
const secondaryModel = this._originalEditorModels.get(quickDiff.originalResource)?.textEditorModel;
|
|
206
|
+
const secondaryContent = secondaryModel?.getValueInRange(change2.toRangeMapping().originalRange);
|
|
207
|
+
if (primaryContent === secondaryContent) {
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
196
212
|
allDiffs.push({
|
|
213
|
+
providerId: quickDiff.id,
|
|
197
214
|
label: quickDiff.label,
|
|
198
215
|
original: quickDiff.originalResource,
|
|
199
216
|
modified: this._model.resource,
|
|
@@ -235,7 +252,9 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
235
252
|
this._originalEditorModels.clear();
|
|
236
253
|
return [];
|
|
237
254
|
}
|
|
238
|
-
if (equals(this._quickDiffs, quickDiffs, (a, b) =>
|
|
255
|
+
if (equals(this._quickDiffs, quickDiffs, (a, b) => a.id === b.id &&
|
|
256
|
+
( a.originalResource.toString()) === ( b.originalResource.toString()) &&
|
|
257
|
+
this.quickDiffService.isQuickDiffProviderVisible(a.id) === this.quickDiffService.isQuickDiffProviderVisible(b.id))) {
|
|
239
258
|
return quickDiffs;
|
|
240
259
|
}
|
|
241
260
|
this._quickDiffs = quickDiffs;
|
|
@@ -275,7 +294,7 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
275
294
|
const uri = this._model.resource;
|
|
276
295
|
const isBeingModifiedByChatEdits = ( this._chatEditingService.editingSessionsObs.get()
|
|
277
296
|
.some(
|
|
278
|
-
session => session.getEntry(uri)?.state.get() ===
|
|
297
|
+
session => session.getEntry(uri)?.state.get() === ModifiedFileEntryState.Modified
|
|
279
298
|
));
|
|
280
299
|
if (isBeingModifiedByChatEdits) {
|
|
281
300
|
return Promise.resolve([]);
|
|
@@ -284,47 +303,38 @@ let QuickDiffModel = class QuickDiffModel extends Disposable {
|
|
|
284
303
|
return this.quickDiffService.getQuickDiffs(uri, this._model.getLanguageId(), isSynchronized);
|
|
285
304
|
}
|
|
286
305
|
findNextClosestChange(lineNumber, inclusive = true, provider) {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
306
|
+
const visibleQuickDiffLabels = ( this.quickDiffs
|
|
307
|
+
.filter(quickDiff => (!provider || quickDiff.label === provider) &&
|
|
308
|
+
this.quickDiffService.isQuickDiffProviderVisible(quickDiff.id))
|
|
309
|
+
.map(quickDiff => quickDiff.label));
|
|
310
|
+
if (!inclusive) {
|
|
311
|
+
const nextChange = this.changes
|
|
312
|
+
.findIndex(change => visibleQuickDiffLabels.includes(change.label) &&
|
|
313
|
+
change.change.modifiedStartLineNumber > lineNumber);
|
|
314
|
+
return nextChange !== -1 ? nextChange : 0;
|
|
290
315
|
}
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
const change = this.changes[i];
|
|
300
|
-
const possibleChangesLength = possibleChanges.length;
|
|
301
|
-
if (inclusive) {
|
|
302
|
-
if (getModifiedEndLineNumber(change.change) >= lineNumber) {
|
|
303
|
-
if (preferredProvider && change.label !== preferredProvider) {
|
|
304
|
-
possibleChanges.push(i);
|
|
305
|
-
}
|
|
306
|
-
else {
|
|
307
|
-
return i;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
else {
|
|
312
|
-
if (change.change.modifiedStartLineNumber > lineNumber) {
|
|
313
|
-
return i;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
if ((possibleChanges.length > 0) && (possibleChanges.length === possibleChangesLength)) {
|
|
317
|
-
return possibleChanges[0];
|
|
318
|
-
}
|
|
316
|
+
const primaryQuickDiffId = this.quickDiffs
|
|
317
|
+
.find(quickDiff => quickDiff.kind === 'primary')?.id;
|
|
318
|
+
const primaryInclusiveChangeIndex = this.changes
|
|
319
|
+
.findIndex(change => change.providerId === primaryQuickDiffId &&
|
|
320
|
+
change.change.modifiedStartLineNumber <= lineNumber &&
|
|
321
|
+
getModifiedEndLineNumber(change.change) >= lineNumber);
|
|
322
|
+
if (primaryInclusiveChangeIndex !== -1) {
|
|
323
|
+
return primaryInclusiveChangeIndex;
|
|
319
324
|
}
|
|
320
|
-
|
|
325
|
+
const inclusiveChangeIndex = this.changes
|
|
326
|
+
.findIndex(change => visibleQuickDiffLabels.includes(change.label) &&
|
|
327
|
+
change.change.modifiedStartLineNumber <= lineNumber &&
|
|
328
|
+
getModifiedEndLineNumber(change.change) >= lineNumber);
|
|
329
|
+
return inclusiveChangeIndex !== -1 ? inclusiveChangeIndex : 0;
|
|
321
330
|
}
|
|
322
331
|
findPreviousClosestChange(lineNumber, inclusive = true, provider) {
|
|
323
332
|
for (let i = this.changes.length - 1; i >= 0; i--) {
|
|
324
333
|
if (provider && this.changes[i].label !== provider) {
|
|
325
334
|
continue;
|
|
326
335
|
}
|
|
327
|
-
|
|
336
|
+
const quickDiff = this.quickDiffs.find(quickDiff => quickDiff.id === this.changes[i].providerId);
|
|
337
|
+
if (!quickDiff || !this.quickDiffService.isQuickDiffProviderVisible(quickDiff.id)) {
|
|
328
338
|
continue;
|
|
329
339
|
}
|
|
330
340
|
const change = this.changes[i].change;
|
|
@@ -17,9 +17,9 @@ export interface IQuickDiffSelectItem extends ISelectOptionItem {
|
|
|
17
17
|
provider: string;
|
|
18
18
|
}
|
|
19
19
|
export declare class QuickDiffPickerViewItem extends SelectActionViewItem<IQuickDiffSelectItem> {
|
|
20
|
-
private
|
|
21
|
-
constructor(action: IAction,
|
|
22
|
-
setSelection(provider: string): void;
|
|
20
|
+
private optionsItems;
|
|
21
|
+
constructor(action: IAction, contextViewService: IContextViewService, themeService: IThemeService);
|
|
22
|
+
setSelection(providers: string[], provider: string): void;
|
|
23
23
|
protected getActionContext(_: string, index: number): IQuickDiffSelectItem;
|
|
24
24
|
render(container: HTMLElement): void;
|
|
25
25
|
}
|
|
@@ -35,7 +35,8 @@ import { RawContextKey, ContextKeyExpr } from '@codingame/monaco-vscode-api/vsco
|
|
|
35
35
|
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
36
36
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
37
37
|
import { rot } from '@codingame/monaco-vscode-api/vscode/vs/base/common/numbers';
|
|
38
|
-
import { getModifiedEndLineNumber, getChangeHeight, getChangeType, getChangeTypeColor, lineIntersectsChange, ChangeType } from '@codingame/monaco-vscode-
|
|
38
|
+
import { getModifiedEndLineNumber, getChangeHeight, getChangeType, getChangeTypeColor, lineIntersectsChange, ChangeType } from '@codingame/monaco-vscode-bb83fe45-f4c7-5673-b9f1-5c409a63f19c-common/vscode/vs/workbench/contrib/scm/common/quickDiff';
|
|
39
|
+
import { IQuickDiffService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/scm/common/quickDiff.service';
|
|
39
40
|
import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service';
|
|
40
41
|
import { TextCompareEditorActiveContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contextkeys';
|
|
41
42
|
import { EditorContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/editorContextKeys';
|
|
@@ -59,24 +60,20 @@ import { quickDiffDecorationCount } from './quickDiffDecorator.js';
|
|
|
59
60
|
var QuickDiffEditorController_1;
|
|
60
61
|
const isQuickDiffVisible = ( new RawContextKey('dirtyDiffVisible', false));
|
|
61
62
|
let QuickDiffPickerViewItem = class QuickDiffPickerViewItem extends SelectActionViewItem {
|
|
62
|
-
constructor(action,
|
|
63
|
-
const items = ( providers.map(provider => ({ provider, text: provider })));
|
|
64
|
-
let startingSelection = providers.indexOf(selected);
|
|
65
|
-
if (startingSelection === -1) {
|
|
66
|
-
startingSelection = 0;
|
|
67
|
-
}
|
|
63
|
+
constructor(action, contextViewService, themeService) {
|
|
68
64
|
const styles = { ...defaultSelectBoxStyles };
|
|
69
65
|
const theme = themeService.getColorTheme();
|
|
70
66
|
const editorBackgroundColor = theme.getColor(editorBackground);
|
|
71
67
|
const peekTitleColor = theme.getColor(peekViewTitleBackground);
|
|
72
68
|
const opaqueTitleColor = peekTitleColor?.makeOpaque(editorBackgroundColor) ?? editorBackgroundColor;
|
|
73
69
|
styles.selectBackground = ( ( opaqueTitleColor.lighten(.6)).toString());
|
|
74
|
-
super(null, action,
|
|
75
|
-
this.optionsItems =
|
|
70
|
+
super(null, action, [], 0, contextViewService, styles, { ariaLabel: ( localize(9080, 'Switch quick diff base')) });
|
|
71
|
+
this.optionsItems = [];
|
|
76
72
|
}
|
|
77
|
-
setSelection(provider) {
|
|
73
|
+
setSelection(providers, provider) {
|
|
74
|
+
this.optionsItems = ( providers.map(provider => ({ provider, text: provider })));
|
|
78
75
|
const index = this.optionsItems.findIndex(item => item.provider === provider);
|
|
79
|
-
this.
|
|
76
|
+
this.setOptions(this.optionsItems, index);
|
|
80
77
|
}
|
|
81
78
|
getActionContext(_, index) {
|
|
82
79
|
return this.optionsItems[index];
|
|
@@ -87,12 +84,12 @@ let QuickDiffPickerViewItem = class QuickDiffPickerViewItem extends SelectAction
|
|
|
87
84
|
}
|
|
88
85
|
};
|
|
89
86
|
QuickDiffPickerViewItem = ( __decorate([
|
|
90
|
-
( __param(
|
|
91
|
-
( __param(
|
|
87
|
+
( __param(1, IContextViewService)),
|
|
88
|
+
( __param(2, IThemeService))
|
|
92
89
|
], QuickDiffPickerViewItem));
|
|
93
90
|
class QuickDiffPickerBaseAction extends Action {
|
|
94
91
|
static { this.ID = 'quickDiff.base.switch'; }
|
|
95
|
-
static { this.LABEL = ( localize(
|
|
92
|
+
static { this.LABEL = ( localize(9081, "Switch Quick Diff Base")); }
|
|
96
93
|
constructor(callback) {
|
|
97
94
|
super(QuickDiffPickerBaseAction.ID, QuickDiffPickerBaseAction.LABEL, undefined, undefined);
|
|
98
95
|
this.callback = callback;
|
|
@@ -127,12 +124,13 @@ QuickDiffWidgetEditorAction = ( __decorate([
|
|
|
127
124
|
( __param(4, IInstantiationService))
|
|
128
125
|
], QuickDiffWidgetEditorAction));
|
|
129
126
|
let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
|
|
130
|
-
constructor(editor, model, themeService, instantiationService, menuService, contextKeyService) {
|
|
127
|
+
constructor(editor, model, themeService, instantiationService, menuService, contextKeyService, quickDiffService) {
|
|
131
128
|
super(editor, { isResizeable: true, frameWidth: 1, keepEditorSelection: true, className: 'dirty-diff' }, instantiationService);
|
|
132
129
|
this.model = model;
|
|
133
130
|
this.themeService = themeService;
|
|
134
131
|
this.menuService = menuService;
|
|
135
132
|
this.contextKeyService = contextKeyService;
|
|
133
|
+
this.quickDiffService = quickDiffService;
|
|
136
134
|
this._index = 0;
|
|
137
135
|
this._provider = '';
|
|
138
136
|
this.height = undefined;
|
|
@@ -167,6 +165,7 @@ let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
|
|
|
167
165
|
const labeledChange = this.model.changes[index];
|
|
168
166
|
const change = labeledChange.change;
|
|
169
167
|
this._index = index;
|
|
168
|
+
this.contextKeyService.createKey('originalResource', ( this.model.changes[index].original.toString()));
|
|
170
169
|
this.contextKeyService.createKey('originalResourceScheme', this.model.changes[index].original.scheme);
|
|
171
170
|
this.updateActions();
|
|
172
171
|
this._provider = labeledChange.label;
|
|
@@ -181,12 +180,12 @@ let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
|
|
|
181
180
|
return;
|
|
182
181
|
}
|
|
183
182
|
this.diffEditor.setModel(diffEditorModel);
|
|
184
|
-
this.dropdown?.setSelection(labeledChange.label);
|
|
185
183
|
const position = ( new Position(getModifiedEndLineNumber(change), 1));
|
|
186
184
|
const lineHeight = this.editor.getOption(EditorOption.lineHeight);
|
|
187
185
|
const editorHeight = this.editor.getLayoutInfo().height;
|
|
188
186
|
const editorHeightInLines = Math.floor(editorHeight / lineHeight);
|
|
189
187
|
const height = Math.min(getChangeHeight(change) + 8, Math.floor(editorHeightInLines / 3));
|
|
188
|
+
this.updateDropdown(labeledChange.label);
|
|
190
189
|
this.renderTitle(labeledChange.label);
|
|
191
190
|
const changeType = getChangeType(change);
|
|
192
191
|
const changeTypeColor = getChangeTypeColor(this.themeService.getColorTheme(), changeType);
|
|
@@ -215,14 +214,14 @@ let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
|
|
|
215
214
|
if (!this.shouldUseDropdown()) {
|
|
216
215
|
detail = this.model.changes.length > 1
|
|
217
216
|
? ( localize(
|
|
218
|
-
|
|
217
|
+
9082,
|
|
219
218
|
"{0} - {1} of {2} changes",
|
|
220
219
|
label,
|
|
221
220
|
providerIndex + 1,
|
|
222
221
|
providerChanges.length
|
|
223
222
|
))
|
|
224
223
|
: ( localize(
|
|
225
|
-
|
|
224
|
+
9083,
|
|
226
225
|
"{0} - {1} of {2} change",
|
|
227
226
|
label,
|
|
228
227
|
providerIndex + 1,
|
|
@@ -232,8 +231,8 @@ let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
|
|
|
232
231
|
}
|
|
233
232
|
else {
|
|
234
233
|
detail = this.model.changes.length > 1
|
|
235
|
-
? ( localize(
|
|
236
|
-
: ( localize(
|
|
234
|
+
? ( localize(9084, "{0} of {1} changes", providerIndex + 1, providerChanges.length))
|
|
235
|
+
: ( localize(9085, "{0} of {1} change", providerIndex + 1, providerChanges.length));
|
|
237
236
|
this.dropdownContainer.style.display = 'inherit';
|
|
238
237
|
}
|
|
239
238
|
this.setTitle(this.title, detail);
|
|
@@ -251,7 +250,7 @@ let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
|
|
|
251
250
|
}
|
|
252
251
|
}
|
|
253
252
|
let closestLesserIndex = this._index > 0 ? this._index - 1 : this.model.changes.length - 1;
|
|
254
|
-
for (let i = closestLesserIndex; i !== this._index; i
|
|
253
|
+
for (let i = closestLesserIndex; i !== this._index; i > 0 ? i-- : i = this.model.changes.length - 1) {
|
|
255
254
|
if (this.model.changes[i].label === newProvider) {
|
|
256
255
|
closestLesserIndex = i;
|
|
257
256
|
break;
|
|
@@ -263,11 +262,8 @@ let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
|
|
|
263
262
|
this.showChange(closestIndex, false);
|
|
264
263
|
}
|
|
265
264
|
shouldUseDropdown() {
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
.filter(result => ( visibleQuickDiffs.some(quickDiff => quickDiff.label === result.label)));
|
|
269
|
-
return visibleQuickDiffResults
|
|
270
|
-
.filter(quickDiff => quickDiff.changes.length > 0).length > 1;
|
|
265
|
+
const quickDiffs = this.getQuickDiffsContainingChange();
|
|
266
|
+
return quickDiffs.length > 1;
|
|
271
267
|
}
|
|
272
268
|
updateActions() {
|
|
273
269
|
if (!this._actionbarWidget) {
|
|
@@ -285,15 +281,26 @@ let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
|
|
|
285
281
|
this._actionbarWidget.clear();
|
|
286
282
|
this._actionbarWidget.push(actions.reverse(), { label: false, icon: true });
|
|
287
283
|
this._actionbarWidget.push([next, previous], { label: false, icon: true });
|
|
288
|
-
this._actionbarWidget.push(this._disposables.add(( new Action('peekview.close', ( localize(
|
|
284
|
+
this._actionbarWidget.push(this._disposables.add(( new Action('peekview.close', ( localize(9086, "Close")), ThemeIcon.asClassName(Codicon.close), true, () => this.dispose()))), { label: false, icon: true });
|
|
285
|
+
}
|
|
286
|
+
updateDropdown(label) {
|
|
287
|
+
const quickDiffs = this.getQuickDiffsContainingChange();
|
|
288
|
+
this.dropdown?.setSelection(( quickDiffs.map(quickDiff => quickDiff.label)), label);
|
|
289
|
+
}
|
|
290
|
+
getQuickDiffsContainingChange() {
|
|
291
|
+
const change = this.model.changes[this._index];
|
|
292
|
+
const quickDiffsWithChange = ( this.model.changes
|
|
293
|
+
.filter(c => change.change2.modified.overlapOrTouch(c.change2.modified))
|
|
294
|
+
.map(c => c.providerId));
|
|
295
|
+
return this.model.quickDiffs
|
|
296
|
+
.filter(quickDiff => quickDiffsWithChange.includes(quickDiff.id) &&
|
|
297
|
+
this.quickDiffService.isQuickDiffProviderVisible(quickDiff.id));
|
|
289
298
|
}
|
|
290
299
|
_fillHead(container) {
|
|
291
300
|
super._fillHead(container, true);
|
|
292
|
-
const visibleQuickDiffs = this.model.quickDiffs.filter(quickDiff => quickDiff.visible);
|
|
293
301
|
this.dropdownContainer = prepend(this._titleElement, $('.dropdown'));
|
|
294
|
-
this.dropdown = this.instantiationService.createInstance(QuickDiffPickerViewItem, ( new QuickDiffPickerBaseAction((event) => this.switchQuickDiff(event)))
|
|
302
|
+
this.dropdown = this.instantiationService.createInstance(QuickDiffPickerViewItem, ( new QuickDiffPickerBaseAction((event) => this.switchQuickDiff(event))));
|
|
295
303
|
this.dropdown.render(this.dropdownContainer);
|
|
296
|
-
this.updateActions();
|
|
297
304
|
}
|
|
298
305
|
_getActionBarOptions() {
|
|
299
306
|
const actionRunner = ( new QuickDiffWidgetActionRunner());
|
|
@@ -386,7 +393,8 @@ QuickDiffWidget = ( __decorate([
|
|
|
386
393
|
( __param(2, IThemeService)),
|
|
387
394
|
( __param(3, IInstantiationService)),
|
|
388
395
|
( __param(4, IMenuService)),
|
|
389
|
-
( __param(5, IContextKeyService))
|
|
396
|
+
( __param(5, IContextKeyService)),
|
|
397
|
+
( __param(6, IQuickDiffService))
|
|
390
398
|
], QuickDiffWidget));
|
|
391
399
|
let QuickDiffEditorController = class QuickDiffEditorController extends Disposable {
|
|
392
400
|
static { QuickDiffEditorController_1 = this; }
|
|
@@ -623,7 +631,7 @@ class ShowPreviousChangeAction extends EditorAction {
|
|
|
623
631
|
constructor(outerEditor) {
|
|
624
632
|
super({
|
|
625
633
|
id: 'editor.action.dirtydiff.previous',
|
|
626
|
-
label: ( localize2(
|
|
634
|
+
label: ( localize2(9087, "Show Previous Change")),
|
|
627
635
|
precondition: ( TextCompareEditorActiveContext.toNegated()),
|
|
628
636
|
kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F3, weight: KeybindingWeight.EditorContrib }
|
|
629
637
|
});
|
|
@@ -649,7 +657,7 @@ class ShowNextChangeAction extends EditorAction {
|
|
|
649
657
|
constructor(outerEditor) {
|
|
650
658
|
super({
|
|
651
659
|
id: 'editor.action.dirtydiff.next',
|
|
652
|
-
label: ( localize2(
|
|
660
|
+
label: ( localize2(9088, "Show Next Change")),
|
|
653
661
|
precondition: ( TextCompareEditorActiveContext.toNegated()),
|
|
654
662
|
kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F3, weight: KeybindingWeight.EditorContrib }
|
|
655
663
|
});
|
|
@@ -675,7 +683,7 @@ class GotoPreviousChangeAction extends EditorAction {
|
|
|
675
683
|
constructor() {
|
|
676
684
|
super({
|
|
677
685
|
id: 'workbench.action.editor.previousChange',
|
|
678
|
-
label: ( localize2(
|
|
686
|
+
label: ( localize2(9089, "Go to Previous Change")),
|
|
679
687
|
precondition: ( ContextKeyExpr.and(( TextCompareEditorActiveContext.toNegated()), ( quickDiffDecorationCount.notEqualsTo(0)))),
|
|
680
688
|
kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F5, weight: KeybindingWeight.EditorContrib }
|
|
681
689
|
});
|
|
@@ -710,7 +718,7 @@ class GotoNextChangeAction extends EditorAction {
|
|
|
710
718
|
constructor() {
|
|
711
719
|
super({
|
|
712
720
|
id: 'workbench.action.editor.nextChange',
|
|
713
|
-
label: ( localize2(
|
|
721
|
+
label: ( localize2(9090, "Go to Next Change")),
|
|
714
722
|
precondition: ( ContextKeyExpr.and(( TextCompareEditorActiveContext.toNegated()), ( quickDiffDecorationCount.notEqualsTo(0)))),
|
|
715
723
|
kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F5, weight: KeybindingWeight.EditorContrib }
|
|
716
724
|
});
|
|
@@ -745,7 +753,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
|
|
|
745
753
|
group: '7_change_nav',
|
|
746
754
|
command: {
|
|
747
755
|
id: 'editor.action.dirtydiff.next',
|
|
748
|
-
title: ( localize(
|
|
756
|
+
title: ( localize(9091, "Next &&Change"))
|
|
749
757
|
},
|
|
750
758
|
order: 1
|
|
751
759
|
});
|
|
@@ -753,7 +761,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
|
|
|
753
761
|
group: '7_change_nav',
|
|
754
762
|
command: {
|
|
755
763
|
id: 'editor.action.dirtydiff.previous',
|
|
756
|
-
title: ( localize(
|
|
764
|
+
title: ( localize(9092, "Previous &&Change"))
|
|
757
765
|
},
|
|
758
766
|
order: 2
|
|
759
767
|
});
|