@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.
@@ -59,20 +59,28 @@ import { quickDiffDecorationCount } from './quickDiffDecorator.js';
59
59
  import { hasNativeContextMenu } from '@codingame/monaco-vscode-api/vscode/vs/platform/window/common/window';
60
60
 
61
61
  var QuickDiffEditorController_1;
62
- const isQuickDiffVisible = ( new RawContextKey('dirtyDiffVisible', false));
62
+ const isQuickDiffVisible = ( new RawContextKey("dirtyDiffVisible", false));
63
63
  let QuickDiffPickerViewItem = class QuickDiffPickerViewItem extends SelectActionViewItem {
64
64
  constructor(action, contextViewService, themeService, configurationService) {
65
- const styles = { ...defaultSelectBoxStyles };
65
+ const styles = {
66
+ ...defaultSelectBoxStyles
67
+ };
66
68
  const theme = themeService.getColorTheme();
67
69
  const editorBackgroundColor = theme.getColor(editorBackground);
68
70
  const peekTitleColor = theme.getColor(peekViewTitleBackground);
69
71
  const opaqueTitleColor = peekTitleColor?.makeOpaque(editorBackgroundColor) ?? editorBackgroundColor;
70
72
  styles.selectBackground = ( ( opaqueTitleColor.lighten(.6)).toString());
71
- super(null, action, [], 0, contextViewService, styles, { ariaLabel: ( localize(10445, 'Switch quick diff base')), useCustomDrawn: !hasNativeContextMenu(configurationService) });
73
+ super(null, action, [], 0, contextViewService, styles, {
74
+ ariaLabel: ( localize(10763, "Switch quick diff base")),
75
+ useCustomDrawn: !hasNativeContextMenu(configurationService)
76
+ });
72
77
  this.optionsItems = [];
73
78
  }
74
79
  setSelection(quickDiffs, providerId) {
75
- this.optionsItems = ( quickDiffs.map(quickDiff => ({ providerId: quickDiff.id, text: quickDiff.label })));
80
+ this.optionsItems = ( quickDiffs.map(quickDiff => ({
81
+ providerId: quickDiff.id,
82
+ text: quickDiff.label
83
+ })));
76
84
  const index = this.optionsItems.findIndex(item => item.providerId === providerId);
77
85
  this.setOptions(this.optionsItems, index);
78
86
  }
@@ -84,16 +92,21 @@ let QuickDiffPickerViewItem = class QuickDiffPickerViewItem extends SelectAction
84
92
  this.setFocusable(true);
85
93
  }
86
94
  };
87
- QuickDiffPickerViewItem = ( __decorate([
88
- ( __param(1, IContextViewService)),
89
- ( __param(2, IThemeService)),
90
- ( __param(3, IConfigurationService))
91
- ], QuickDiffPickerViewItem));
95
+ QuickDiffPickerViewItem = ( __decorate([( __param(1, IContextViewService)), ( __param(2, IThemeService)), ( __param(3, IConfigurationService))], QuickDiffPickerViewItem));
92
96
  class QuickDiffPickerBaseAction extends Action {
93
- static { this.ID = 'quickDiff.base.switch'; }
94
- static { this.LABEL = ( localize(10446, "Switch Quick Diff Base")); }
97
+ static {
98
+ this.ID = "quickDiff.base.switch";
99
+ }
100
+ static {
101
+ this.LABEL = ( localize(10764, "Switch Quick Diff Base"));
102
+ }
95
103
  constructor(callback) {
96
- super(QuickDiffPickerBaseAction.ID, QuickDiffPickerBaseAction.LABEL, undefined, undefined);
104
+ super(
105
+ QuickDiffPickerBaseAction.ID,
106
+ QuickDiffPickerBaseAction.LABEL,
107
+ undefined,
108
+ undefined
109
+ );
97
110
  this.callback = callback;
98
111
  }
99
112
  async run(event) {
@@ -110,46 +123,56 @@ class QuickDiffWidgetActionRunner extends ActionRunner {
110
123
  }
111
124
  let QuickDiffWidgetEditorAction = class QuickDiffWidgetEditorAction extends Action {
112
125
  constructor(editor, action, cssClass, keybindingService, instantiationService) {
113
- const keybinding = keybindingService.lookupKeybinding(action.id);
114
- const label = action.label + (keybinding ? ` (${keybinding.getLabel()})` : '');
126
+ const label = keybindingService.appendKeybinding(action.label, action.id);
115
127
  super(action.id, label, cssClass);
116
128
  this.instantiationService = instantiationService;
117
129
  this.action = action;
118
130
  this.editor = editor;
119
131
  }
120
132
  run() {
121
- return Promise.resolve(this.instantiationService.invokeFunction(accessor => this.action.run(accessor, this.editor, null)));
133
+ return Promise.resolve(
134
+ this.instantiationService.invokeFunction(accessor => this.action.run(accessor, this.editor, null))
135
+ );
122
136
  }
123
137
  };
124
- QuickDiffWidgetEditorAction = ( __decorate([
125
- ( __param(3, IKeybindingService)),
126
- ( __param(4, IInstantiationService))
127
- ], QuickDiffWidgetEditorAction));
138
+ QuickDiffWidgetEditorAction = ( __decorate([( __param(3, IKeybindingService)), ( __param(4, IInstantiationService))], QuickDiffWidgetEditorAction));
128
139
  let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
129
- constructor(editor, model, themeService, instantiationService, menuService, contextKeyService, quickDiffService) {
130
- super(editor, { isResizeable: true, frameWidth: 1, keepEditorSelection: true, className: 'dirty-diff' }, instantiationService);
140
+ constructor(
141
+ editor,
142
+ model,
143
+ themeService,
144
+ instantiationService,
145
+ menuService,
146
+ contextKeyService,
147
+ quickDiffService
148
+ ) {
149
+ super(editor, {
150
+ isResizeable: true,
151
+ frameWidth: 1,
152
+ keepEditorSelection: true,
153
+ className: "dirty-diff"
154
+ }, instantiationService);
131
155
  this.model = model;
132
156
  this.themeService = themeService;
133
157
  this.menuService = menuService;
134
158
  this.contextKeyService = contextKeyService;
135
159
  this.quickDiffService = quickDiffService;
136
160
  this._index = 0;
137
- this._providerId = '';
161
+ this._providerId = "";
138
162
  this.height = undefined;
139
163
  this._disposables.add(themeService.onDidColorThemeChange(this._applyTheme, this));
140
164
  this._applyTheme(themeService.getColorTheme());
141
165
  if (!Iterable.isEmpty(this.model.originalTextModels)) {
142
- contextKeyService = contextKeyService.createOverlay([
143
- ['originalResourceScheme', Iterable.first(this.model.originalTextModels)?.uri.scheme],
144
- ['originalResourceSchemes', ( Iterable.map(this.model.originalTextModels, textModel => textModel.uri.scheme))]
145
- ]);
166
+ contextKeyService = contextKeyService.createOverlay([[
167
+ "originalResourceScheme",
168
+ Iterable.first(this.model.originalTextModels)?.uri.scheme
169
+ ], ["originalResourceSchemes", ( Iterable.map(this.model.originalTextModels, textModel => textModel.uri.scheme))]]);
146
170
  }
147
171
  this.create();
148
172
  if (editor.hasModel()) {
149
173
  this.title = basename(editor.getModel().uri);
150
- }
151
- else {
152
- this.title = '';
174
+ } else {
175
+ this.title = "";
153
176
  }
154
177
  this.setTitle(this.title);
155
178
  }
@@ -167,8 +190,8 @@ let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
167
190
  const labeledChange = this.model.changes[index];
168
191
  const change = labeledChange.change;
169
192
  this._index = index;
170
- this.contextKeyService.createKey('originalResource', ( this.model.changes[index].original.toString()));
171
- this.contextKeyService.createKey('originalResourceScheme', this.model.changes[index].original.scheme);
193
+ this.contextKeyService.createKey("originalResource", ( this.model.changes[index].original.toString()));
194
+ this.contextKeyService.createKey("originalResourceScheme", this.model.changes[index].original.scheme);
172
195
  this.updateActions();
173
196
  this.change = change;
174
197
  this._providerId = labeledChange.providerId;
@@ -186,12 +209,18 @@ let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
186
209
  const lineHeight = this.editor.getOption(EditorOption.lineHeight);
187
210
  const editorHeight = this.editor.getLayoutInfo().height;
188
211
  const editorHeightInLines = Math.floor(editorHeight / lineHeight);
189
- const height = Math.min(getChangeHeight(change) + 2 + 6 , Math.floor(editorHeightInLines / 3));
212
+ const height = Math.min(
213
+ getChangeHeight(change) + 2 + 6,
214
+ Math.floor(editorHeightInLines / 3)
215
+ );
190
216
  this.renderTitle();
191
217
  this.updateDropdown();
192
218
  const changeType = getChangeType(change);
193
219
  const changeTypeColor = getChangeTypeColor(this.themeService.getColorTheme(), changeType);
194
- this.style({ frameColor: changeTypeColor, arrowColor: changeTypeColor });
220
+ this.style({
221
+ frameColor: changeTypeColor,
222
+ arrowColor: changeTypeColor
223
+ });
195
224
  const providerSpecificChanges = [];
196
225
  let contextIndex = index;
197
226
  for (const change of this.model.changes) {
@@ -214,30 +243,24 @@ let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
214
243
  const providerIndex = providerChanges.indexOf(this._index);
215
244
  let detail;
216
245
  if (!this.shouldUseDropdown()) {
217
- const label = this.model.quickDiffs
218
- .find(quickDiff => quickDiff.id === this._providerId)?.label ?? '';
219
- detail = this.model.changes.length > 1
220
- ? ( localize(
221
- 10447,
246
+ const label = this.model.quickDiffs.find(quickDiff => quickDiff.id === this._providerId)?.label ?? "";
247
+ detail = this.model.changes.length > 1 ? ( localize(
248
+ 10765,
222
249
  "{0} - {1} of {2} changes",
223
250
  label,
224
251
  providerIndex + 1,
225
252
  providerChanges.length
226
- ))
227
- : ( localize(
228
- 10448,
253
+ )) : ( localize(
254
+ 10766,
229
255
  "{0} - {1} of {2} change",
230
256
  label,
231
257
  providerIndex + 1,
232
258
  providerChanges.length
233
259
  ));
234
- this.dropdownContainer.style.display = 'none';
235
- }
236
- else {
237
- detail = this.model.changes.length > 1
238
- ? ( localize(10449, "{0} of {1} changes", providerIndex + 1, providerChanges.length))
239
- : ( localize(10450, "{0} of {1} change", providerIndex + 1, providerChanges.length));
240
- this.dropdownContainer.style.display = 'inherit';
260
+ this.dropdownContainer.style.display = "none";
261
+ } else {
262
+ detail = this.model.changes.length > 1 ? ( localize(10767, "{0} of {1} changes", providerIndex + 1, providerChanges.length)) : ( localize(10768, "{0} of {1} change", providerIndex + 1, providerChanges.length));
263
+ this.dropdownContainer.style.display = "inherit";
241
264
  }
242
265
  this.setTitle(this.title, detail);
243
266
  }
@@ -260,9 +283,11 @@ let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
260
283
  break;
261
284
  }
262
285
  }
263
- const closestIndex = Math.abs(this.model.changes[closestGreaterIndex].change.modifiedEndLineNumber - this.model.changes[this._index].change.modifiedEndLineNumber)
264
- < Math.abs(this.model.changes[closestLesserIndex].change.modifiedEndLineNumber - this.model.changes[this._index].change.modifiedEndLineNumber)
265
- ? closestGreaterIndex : closestLesserIndex;
286
+ const closestIndex = Math.abs(
287
+ this.model.changes[closestGreaterIndex].change.modifiedEndLineNumber - this.model.changes[this._index].change.modifiedEndLineNumber
288
+ ) < Math.abs(
289
+ this.model.changes[closestLesserIndex].change.modifiedEndLineNumber - this.model.changes[this._index].change.modifiedEndLineNumber
290
+ ) ? closestGreaterIndex : closestLesserIndex;
266
291
  this.showChange(closestIndex, false);
267
292
  }
268
293
  shouldUseDropdown() {
@@ -281,11 +306,22 @@ let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
281
306
  this.menu.dispose();
282
307
  }
283
308
  this.menu = this.menuService.createMenu(MenuId.SCMChangeContext, this.contextKeyService);
284
- const actions = getFlatActionBarActions(this.menu.getActions({ shouldForwardArgs: true }));
309
+ const actions = getFlatActionBarActions(this.menu.getActions({
310
+ shouldForwardArgs: true
311
+ }));
285
312
  this._actionbarWidget.clear();
286
- this._actionbarWidget.push(actions.reverse(), { label: false, icon: true });
287
- this._actionbarWidget.push([next, previous], { label: false, icon: true });
288
- this._actionbarWidget.push(this._disposables.add(( new Action('peekview.close', ( localize(10451, "Close")), ThemeIcon.asClassName(Codicon.close), true, () => this.dispose()))), { label: false, icon: true });
313
+ this._actionbarWidget.push(actions.reverse(), {
314
+ label: false,
315
+ icon: true
316
+ });
317
+ this._actionbarWidget.push([next, previous], {
318
+ label: false,
319
+ icon: true
320
+ });
321
+ this._actionbarWidget.push(this._disposables.add(( new Action("peekview.close", ( localize(10769, "Close")), ThemeIcon.asClassName(Codicon.close), true, () => this.dispose()))), {
322
+ label: false,
323
+ icon: true
324
+ });
289
325
  }
290
326
  updateDropdown() {
291
327
  const quickDiffs = this.getQuickDiffsContainingChange();
@@ -293,18 +329,16 @@ let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
293
329
  }
294
330
  getQuickDiffsContainingChange() {
295
331
  const change = this.model.changes[this._index];
296
- const quickDiffsWithChange = ( this.model.changes
297
- .filter(c => change.change2.modified.intersectsOrTouches(c.change2.modified))
298
- .map(c => c.providerId));
299
- return this.model.quickDiffs
300
- .filter(quickDiff => quickDiffsWithChange.includes(quickDiff.id) &&
301
- this.quickDiffService.isQuickDiffProviderVisible(quickDiff.id));
332
+ const quickDiffsWithChange = ( this.model.changes.filter(c => change.change2.modified.intersectsOrTouches(c.change2.modified)).map(c => c.providerId));
333
+ return this.model.quickDiffs.filter(
334
+ quickDiff => quickDiffsWithChange.includes(quickDiff.id) && this.quickDiffService.isQuickDiffProviderVisible(quickDiff.id)
335
+ );
302
336
  }
303
337
  _fillHead(container) {
304
338
  super._fillHead(container, true);
305
- const action = ( new QuickDiffPickerBaseAction((event) => this.switchQuickDiff(event)));
339
+ const action = ( new QuickDiffPickerBaseAction(event => this.switchQuickDiff(event)));
306
340
  this._disposables.add(action);
307
- this.dropdownContainer = prepend(this._titleElement, $('.dropdown'));
341
+ this.dropdownContainer = prepend(this._titleElement, $(".dropdown"));
308
342
  this.dropdown = this.instantiationService.createInstance(QuickDiffPickerViewItem, action);
309
343
  this.dropdown.render(this.dropdownContainer);
310
344
  }
@@ -323,10 +357,12 @@ let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
323
357
  }
324
358
  _fillBody(container) {
325
359
  const options = {
326
- diffAlgorithm: 'advanced',
360
+ diffAlgorithm: "advanced",
327
361
  fixedOverflowWidgets: true,
328
362
  ignoreTrimWhitespace: false,
329
- minimap: { enabled: false },
363
+ minimap: {
364
+ enabled: false
365
+ },
330
366
  readOnly: false,
331
367
  renderGutterMenu: false,
332
368
  renderIndicators: false,
@@ -334,27 +370,35 @@ let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
334
370
  renderSideBySide: false,
335
371
  scrollbar: {
336
372
  verticalScrollbarSize: 14,
337
- horizontal: 'auto',
373
+ horizontal: "auto",
338
374
  useShadows: true,
339
375
  verticalHasArrows: false,
340
376
  horizontalHasArrows: false
341
377
  },
342
378
  scrollBeyondLastLine: false,
343
- stickyScroll: { enabled: false }
379
+ stickyScroll: {
380
+ enabled: false
381
+ }
344
382
  };
345
383
  this.diffEditor = this.instantiationService.createInstance(EmbeddedDiffEditorWidget, container, options, {}, this.editor);
346
384
  this._disposables.add(this.diffEditor);
347
385
  }
348
386
  _onWidth(width) {
349
- if (typeof this.height === 'undefined') {
387
+ if (typeof this.height === "undefined") {
350
388
  return;
351
389
  }
352
- this.diffEditor.layout({ height: this.height, width });
390
+ this.diffEditor.layout({
391
+ height: this.height,
392
+ width
393
+ });
353
394
  }
354
395
  _doLayoutBody(height, width) {
355
396
  super._doLayoutBody(height, width);
356
- this.diffEditor.layout({ height, width });
357
- if (typeof this.height === 'undefined' && this.change) {
397
+ this.diffEditor.layout({
398
+ height,
399
+ width
400
+ });
401
+ if (typeof this.height === "undefined" && this.change) {
358
402
  this.revealChange(this.change);
359
403
  }
360
404
  this.height = height;
@@ -364,12 +408,10 @@ let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
364
408
  if (change.modifiedEndLineNumber === 0) {
365
409
  start = change.modifiedStartLineNumber;
366
410
  end = change.modifiedStartLineNumber + 1;
367
- }
368
- else if (change.originalEndLineNumber > 0) {
411
+ } else if (change.originalEndLineNumber > 0) {
369
412
  start = change.modifiedStartLineNumber - 1;
370
413
  end = change.modifiedEndLineNumber + 1;
371
- }
372
- else {
414
+ } else {
373
415
  start = change.modifiedStartLineNumber;
374
416
  end = change.modifiedEndLineNumber;
375
417
  }
@@ -394,8 +436,7 @@ let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
394
436
  toggleFocus() {
395
437
  if (this.diffEditor.hasTextFocus()) {
396
438
  this.editor.focus();
397
- }
398
- else {
439
+ } else {
399
440
  this.diffEditor.focus();
400
441
  }
401
442
  }
@@ -405,20 +446,24 @@ let QuickDiffWidget = class QuickDiffWidget extends PeekViewWidget {
405
446
  super.dispose();
406
447
  }
407
448
  };
408
- QuickDiffWidget = ( __decorate([
409
- ( __param(2, IThemeService)),
410
- ( __param(3, IInstantiationService)),
411
- ( __param(4, IMenuService)),
412
- ( __param(5, IContextKeyService)),
413
- ( __param(6, IQuickDiffService))
414
- ], QuickDiffWidget));
449
+ QuickDiffWidget = ( __decorate([( __param(2, IThemeService)), ( __param(3, IInstantiationService)), ( __param(4, IMenuService)), ( __param(5, IContextKeyService)), ( __param(6, IQuickDiffService))], QuickDiffWidget));
415
450
  let QuickDiffEditorController = class QuickDiffEditorController extends Disposable {
416
- static { QuickDiffEditorController_1 = this; }
417
- static { this.ID = 'editor.contrib.quickdiff'; }
451
+ static {
452
+ QuickDiffEditorController_1 = this;
453
+ }
454
+ static {
455
+ this.ID = "editor.contrib.quickdiff";
456
+ }
418
457
  static get(editor) {
419
458
  return editor.getContribution(QuickDiffEditorController_1.ID);
420
459
  }
421
- constructor(editor, contextKeyService, configurationService, quickDiffModelService, instantiationService) {
460
+ constructor(
461
+ editor,
462
+ contextKeyService,
463
+ configurationService,
464
+ quickDiffModelService,
465
+ instantiationService
466
+ ) {
422
467
  super();
423
468
  this.editor = editor;
424
469
  this.configurationService = configurationService;
@@ -430,41 +475,43 @@ let QuickDiffEditorController = class QuickDiffEditorController extends Disposab
430
475
  this.mouseDownInfo = null;
431
476
  this.enabled = false;
432
477
  this.gutterActionDisposables = ( new DisposableStore());
433
- this.enabled = !contextKeyService.getContextKeyValue('isInDiffEditor');
478
+ this.enabled = !contextKeyService.getContextKeyValue("isInDiffEditor");
434
479
  this.stylesheet = createStyleSheet(undefined, undefined, this._store);
435
480
  if (this.enabled) {
436
481
  this.isQuickDiffVisible = isQuickDiffVisible.bindTo(contextKeyService);
437
482
  this._register(editor.onDidChangeModel(() => this.close()));
438
- const onDidChangeGutterAction = Event.filter(configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.diffDecorationsGutterAction'));
483
+ const onDidChangeGutterAction = Event.filter(
484
+ configurationService.onDidChangeConfiguration,
485
+ e => e.affectsConfiguration("scm.diffDecorationsGutterAction")
486
+ );
439
487
  this._register(onDidChangeGutterAction(this.onDidChangeGutterAction, this));
440
488
  this.onDidChangeGutterAction();
441
489
  }
442
490
  }
443
491
  onDidChangeGutterAction() {
444
- const gutterAction = this.configurationService.getValue('scm.diffDecorationsGutterAction');
492
+ const gutterAction = this.configurationService.getValue("scm.diffDecorationsGutterAction");
445
493
  this.gutterActionDisposables.clear();
446
- if (gutterAction === 'diff') {
494
+ if (gutterAction === "diff") {
447
495
  this.gutterActionDisposables.add(this.editor.onMouseDown(e => this.onEditorMouseDown(e)));
448
496
  this.gutterActionDisposables.add(this.editor.onMouseUp(e => this.onEditorMouseUp(e)));
449
497
  this.stylesheet.textContent = `
450
- .monaco-editor .dirty-diff-glyph {
451
- cursor: pointer;
452
- }
498
+ .monaco-editor .dirty-diff-glyph {
499
+ cursor: pointer;
500
+ }
453
501
 
454
- .monaco-editor .margin-view-overlays .dirty-diff-glyph:hover::before {
455
- height: 100%;
456
- width: 6px;
457
- left: -6px;
458
- }
502
+ .monaco-editor .margin-view-overlays .dirty-diff-glyph:hover::before {
503
+ height: 100%;
504
+ width: 6px;
505
+ left: -6px;
506
+ }
459
507
 
460
- .monaco-editor .margin-view-overlays .dirty-diff-deleted:hover::after {
461
- bottom: 0;
462
- border-top-width: 0;
463
- border-bottom-width: 0;
464
- }
465
- `;
466
- }
467
- else {
508
+ .monaco-editor .margin-view-overlays .dirty-diff-deleted:hover::after {
509
+ bottom: 0;
510
+ border-top-width: 0;
511
+ border-bottom-width: 0;
512
+ }
513
+ `;
514
+ } else {
468
515
  this.stylesheet.textContent = ``;
469
516
  }
470
517
  }
@@ -487,10 +534,13 @@ let QuickDiffEditorController = class QuickDiffEditorController extends Disposab
487
534
  return;
488
535
  }
489
536
  let index;
490
- if (this.editor.hasModel() && (typeof lineNumber === 'number' || !this.widget.providerId)) {
491
- index = this.model.findNextClosestChange(typeof lineNumber === 'number' ? lineNumber : this.editor.getPosition().lineNumber, true, this.widget.providerId);
492
- }
493
- else {
537
+ if (this.editor.hasModel() && (typeof lineNumber === "number" || !this.widget.providerId)) {
538
+ index = this.model.findNextClosestChange(
539
+ typeof lineNumber === "number" ? lineNumber : this.editor.getPosition().lineNumber,
540
+ true,
541
+ this.widget.providerId
542
+ );
543
+ } else {
494
544
  const providerChanges = this.model.quickDiffChanges.get(this.widget.providerId) ?? ( this.model.quickDiffChanges.values()).next().value;
495
545
  const mapIndex = providerChanges.findIndex(value => value === this.widget.index);
496
546
  index = providerChanges[rot(mapIndex + 1, providerChanges.length)];
@@ -505,10 +555,13 @@ let QuickDiffEditorController = class QuickDiffEditorController extends Disposab
505
555
  return;
506
556
  }
507
557
  let index;
508
- if (this.editor.hasModel() && (typeof lineNumber === 'number' || !this.widget.providerId)) {
509
- index = this.model.findPreviousClosestChange(typeof lineNumber === 'number' ? lineNumber : this.editor.getPosition().lineNumber, true, this.widget.providerId);
510
- }
511
- else {
558
+ if (this.editor.hasModel() && (typeof lineNumber === "number" || !this.widget.providerId)) {
559
+ index = this.model.findPreviousClosestChange(
560
+ typeof lineNumber === "number" ? lineNumber : this.editor.getPosition().lineNumber,
561
+ true,
562
+ this.widget.providerId
563
+ );
564
+ } else {
512
565
  const providerChanges = this.model.quickDiffChanges.get(this.widget.providerId) ?? ( this.model.quickDiffChanges.values()).next().value;
513
566
  const mapIndex = providerChanges.findIndex(value => value === this.widget.index);
514
567
  index = providerChanges[rot(mapIndex - 1, providerChanges.length)];
@@ -547,8 +600,7 @@ let QuickDiffEditorController = class QuickDiffEditorController extends Disposab
547
600
  this.isQuickDiffVisible.set(true);
548
601
  const disposables = ( new DisposableStore());
549
602
  disposables.add(Event.once(this.widget.onDidClose)(this.close, this));
550
- const onDidModelChange = Event.chain(this.model.onDidChange, $ => ( $.filter(e => e.diff.length > 0)
551
- .map(e => e.diff)));
603
+ const onDidModelChange = Event.chain(this.model.onDidChange, $ => ( $.filter(e => e.diff.length > 0).map(e => e.diff)));
552
604
  onDidModelChange(this.onDidModelChange, this, disposables);
553
605
  disposables.add(modelRef);
554
606
  disposables.add(this.widget);
@@ -588,7 +640,7 @@ let QuickDiffEditorController = class QuickDiffEditorController extends Disposab
588
640
  if (!e.target.element) {
589
641
  return;
590
642
  }
591
- if (e.target.element.className.indexOf('dirty-diff-glyph') < 0) {
643
+ if (e.target.element.className.indexOf("dirty-diff-glyph") < 0) {
592
644
  return;
593
645
  }
594
646
  const data = e.target.detail;
@@ -597,13 +649,17 @@ let QuickDiffEditorController = class QuickDiffEditorController extends Disposab
597
649
  if (gutterOffsetX < -3 || gutterOffsetX > 3) {
598
650
  return;
599
651
  }
600
- this.mouseDownInfo = { lineNumber: range.startLineNumber };
652
+ this.mouseDownInfo = {
653
+ lineNumber: range.startLineNumber
654
+ };
601
655
  }
602
656
  onEditorMouseUp(e) {
603
657
  if (!this.mouseDownInfo) {
604
658
  return;
605
659
  }
606
- const { lineNumber } = this.mouseDownInfo;
660
+ const {
661
+ lineNumber
662
+ } = this.mouseDownInfo;
607
663
  this.mouseDownInfo = null;
608
664
  const range = e.target.range;
609
665
  if (!range || range.startLineNumber !== lineNumber) {
@@ -621,19 +677,16 @@ let QuickDiffEditorController = class QuickDiffEditorController extends Disposab
621
677
  return;
622
678
  }
623
679
  try {
624
- const index = modelRef.object.changes
625
- .findIndex(change => lineIntersectsChange(lineNumber, change.change));
680
+ const index = modelRef.object.changes.findIndex(change => lineIntersectsChange(lineNumber, change.change));
626
681
  if (index < 0) {
627
682
  return;
628
683
  }
629
684
  if (index === this.widget?.index) {
630
685
  this.close();
631
- }
632
- else {
686
+ } else {
633
687
  this.next(lineNumber);
634
688
  }
635
- }
636
- finally {
689
+ } finally {
637
690
  modelRef.dispose();
638
691
  }
639
692
  }
@@ -642,19 +695,18 @@ let QuickDiffEditorController = class QuickDiffEditorController extends Disposab
642
695
  super.dispose();
643
696
  }
644
697
  };
645
- QuickDiffEditorController = QuickDiffEditorController_1 = ( __decorate([
646
- ( __param(1, IContextKeyService)),
647
- ( __param(2, IConfigurationService)),
648
- ( __param(3, IQuickDiffModelService)),
649
- ( __param(4, IInstantiationService))
650
- ], QuickDiffEditorController));
698
+ QuickDiffEditorController = QuickDiffEditorController_1 = ( __decorate([( __param(1, IContextKeyService)), ( __param(2, IConfigurationService)), ( __param(3, IQuickDiffModelService)), ( __param(4, IInstantiationService))], QuickDiffEditorController));
651
699
  class ShowPreviousChangeAction extends EditorAction {
652
700
  constructor(outerEditor) {
653
701
  super({
654
- id: 'editor.action.dirtydiff.previous',
655
- label: ( localize2(10452, "Show Previous Change")),
702
+ id: "editor.action.dirtydiff.previous",
703
+ label: ( localize2(10770, "Show Previous Change")),
656
704
  precondition: ( TextCompareEditorActiveContext.toNegated()),
657
- kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F3, weight: KeybindingWeight.EditorContrib }
705
+ kbOpts: {
706
+ kbExpr: EditorContextKeys.editorTextFocus,
707
+ primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F3,
708
+ weight: KeybindingWeight.EditorContrib
709
+ }
658
710
  });
659
711
  this.outerEditor = outerEditor;
660
712
  }
@@ -677,10 +729,14 @@ registerEditorAction(ShowPreviousChangeAction);
677
729
  class ShowNextChangeAction extends EditorAction {
678
730
  constructor(outerEditor) {
679
731
  super({
680
- id: 'editor.action.dirtydiff.next',
681
- label: ( localize2(10453, "Show Next Change")),
732
+ id: "editor.action.dirtydiff.next",
733
+ label: ( localize2(10771, "Show Next Change")),
682
734
  precondition: ( TextCompareEditorActiveContext.toNegated()),
683
- kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F3, weight: KeybindingWeight.EditorContrib }
735
+ kbOpts: {
736
+ kbExpr: EditorContextKeys.editorTextFocus,
737
+ primary: KeyMod.Alt | KeyCode.F3,
738
+ weight: KeybindingWeight.EditorContrib
739
+ }
684
740
  });
685
741
  this.outerEditor = outerEditor;
686
742
  }
@@ -703,10 +759,14 @@ registerEditorAction(ShowNextChangeAction);
703
759
  class GotoPreviousChangeAction extends EditorAction {
704
760
  constructor() {
705
761
  super({
706
- id: 'workbench.action.editor.previousChange',
707
- label: ( localize2(10454, "Go to Previous Change")),
762
+ id: "workbench.action.editor.previousChange",
763
+ label: ( localize2(10772, "Go to Previous Change")),
708
764
  precondition: ( ContextKeyExpr.and(( TextCompareEditorActiveContext.toNegated()), ( quickDiffDecorationCount.notEqualsTo(0)))),
709
- kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F5, weight: KeybindingWeight.EditorContrib }
765
+ kbOpts: {
766
+ kbExpr: EditorContextKeys.editorTextFocus,
767
+ primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F5,
768
+ weight: KeybindingWeight.EditorContrib
769
+ }
710
770
  });
711
771
  }
712
772
  async run(accessor) {
@@ -728,8 +788,7 @@ class GotoPreviousChangeAction extends EditorAction {
728
788
  const change = modelRef.object.changes[index];
729
789
  await playAccessibilitySymbolForChange(change.change, accessibilitySignalService);
730
790
  setPositionAndSelection(change.change, outerEditor, accessibilityService, codeEditorService);
731
- }
732
- finally {
791
+ } finally {
733
792
  modelRef?.dispose();
734
793
  }
735
794
  }
@@ -738,10 +797,14 @@ registerEditorAction(GotoPreviousChangeAction);
738
797
  class GotoNextChangeAction extends EditorAction {
739
798
  constructor() {
740
799
  super({
741
- id: 'workbench.action.editor.nextChange',
742
- label: ( localize2(10455, "Go to Next Change")),
800
+ id: "workbench.action.editor.nextChange",
801
+ label: ( localize2(10773, "Go to Next Change")),
743
802
  precondition: ( ContextKeyExpr.and(( TextCompareEditorActiveContext.toNegated()), ( quickDiffDecorationCount.notEqualsTo(0)))),
744
- kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F5, weight: KeybindingWeight.EditorContrib }
803
+ kbOpts: {
804
+ kbExpr: EditorContextKeys.editorTextFocus,
805
+ primary: KeyMod.Alt | KeyCode.F5,
806
+ weight: KeybindingWeight.EditorContrib
807
+ }
745
808
  });
746
809
  }
747
810
  async run(accessor) {
@@ -763,36 +826,35 @@ class GotoNextChangeAction extends EditorAction {
763
826
  const change = modelRef.object.changes[index].change;
764
827
  await playAccessibilitySymbolForChange(change, accessibilitySignalService);
765
828
  setPositionAndSelection(change, outerEditor, accessibilityService, codeEditorService);
766
- }
767
- finally {
829
+ } finally {
768
830
  modelRef?.dispose();
769
831
  }
770
832
  }
771
833
  }
772
834
  registerEditorAction(GotoNextChangeAction);
773
835
  MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
774
- group: '7_change_nav',
836
+ group: "7_change_nav",
775
837
  command: {
776
- id: 'editor.action.dirtydiff.next',
777
- title: ( localize(10456, "Next &&Change"))
838
+ id: "editor.action.dirtydiff.next",
839
+ title: ( localize(10774, "Next &&Change"))
778
840
  },
779
841
  order: 1
780
842
  });
781
843
  MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
782
- group: '7_change_nav',
844
+ group: "7_change_nav",
783
845
  command: {
784
- id: 'editor.action.dirtydiff.previous',
785
- title: ( localize(10457, "Previous &&Change"))
846
+ id: "editor.action.dirtydiff.previous",
847
+ title: ( localize(10775, "Previous &&Change"))
786
848
  },
787
849
  order: 2
788
850
  });
789
851
  KeybindingsRegistry.registerCommandAndKeybindingRule({
790
- id: 'closeQuickDiff',
852
+ id: "closeQuickDiff",
791
853
  weight: KeybindingWeight.EditorContrib + 50,
792
854
  primary: KeyCode.Escape,
793
855
  secondary: [KeyMod.Shift | KeyCode.Escape],
794
856
  when: ( ContextKeyExpr.and(isQuickDiffVisible)),
795
- handler: (accessor) => {
857
+ handler: accessor => {
796
858
  const outerEditor = getOuterEditorFromDiffEditor(accessor);
797
859
  if (!outerEditor) {
798
860
  return;
@@ -805,11 +867,11 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
805
867
  }
806
868
  });
807
869
  KeybindingsRegistry.registerCommandAndKeybindingRule({
808
- id: 'togglePeekWidgetFocus',
870
+ id: "togglePeekWidgetFocus",
809
871
  weight: KeybindingWeight.EditorContrib,
810
872
  primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyCode.F2),
811
873
  when: isQuickDiffVisible,
812
- handler: (accessor) => {
874
+ handler: accessor => {
813
875
  const outerEditor = getOuterEditorFromDiffEditor(accessor);
814
876
  if (!outerEditor) {
815
877
  return;
@@ -826,22 +888,36 @@ function setPositionAndSelection(change, editor, accessibilityService, codeEdito
826
888
  editor.setPosition(position);
827
889
  editor.revealPositionInCenter(position);
828
890
  if (accessibilityService.isScreenReaderOptimized()) {
829
- editor.setSelection({ startLineNumber: change.modifiedStartLineNumber, startColumn: 0, endLineNumber: change.modifiedStartLineNumber, endColumn: Number.MAX_VALUE });
830
- codeEditorService.getActiveCodeEditor()?.writeScreenReaderContent('diff-navigation');
891
+ editor.setSelection({
892
+ startLineNumber: change.modifiedStartLineNumber,
893
+ startColumn: 0,
894
+ endLineNumber: change.modifiedStartLineNumber,
895
+ endColumn: Number.MAX_VALUE
896
+ });
897
+ codeEditorService.getActiveCodeEditor()?.writeScreenReaderContent("diff-navigation");
831
898
  }
832
899
  }
833
900
  async function playAccessibilitySymbolForChange(change, accessibilitySignalService) {
834
901
  const changeType = getChangeType(change);
835
902
  switch (changeType) {
836
- case ChangeType.Add:
837
- accessibilitySignalService.playSignal(AccessibilitySignal.diffLineInserted, { allowManyInParallel: true, source: 'quickDiffDecoration' });
838
- break;
839
- case ChangeType.Delete:
840
- accessibilitySignalService.playSignal(AccessibilitySignal.diffLineDeleted, { allowManyInParallel: true, source: 'quickDiffDecoration' });
841
- break;
842
- case ChangeType.Modify:
843
- accessibilitySignalService.playSignal(AccessibilitySignal.diffLineModified, { allowManyInParallel: true, source: 'quickDiffDecoration' });
844
- break;
903
+ case ChangeType.Add:
904
+ accessibilitySignalService.playSignal(AccessibilitySignal.diffLineInserted, {
905
+ allowManyInParallel: true,
906
+ source: "quickDiffDecoration"
907
+ });
908
+ break;
909
+ case ChangeType.Delete:
910
+ accessibilitySignalService.playSignal(AccessibilitySignal.diffLineDeleted, {
911
+ allowManyInParallel: true,
912
+ source: "quickDiffDecoration"
913
+ });
914
+ break;
915
+ case ChangeType.Modify:
916
+ accessibilitySignalService.playSignal(AccessibilitySignal.diffLineModified, {
917
+ allowManyInParallel: true,
918
+ source: "quickDiffDecoration"
919
+ });
920
+ break;
845
921
  }
846
922
  }
847
923
  function getOuterEditorFromDiffEditor(accessor) {