@@ -42,6 +42,8 @@ import { DiffEditorEditors } from './diffEditorEditors';
42
42
import { DiffEditorOptions } from './diffEditorOptions' ;
43
43
import { DiffEditorViewModel , DiffMapping , DiffState } from './diffEditorViewModel' ;
44
44
import { AccessibleDiffViewer } from 'vs/editor/browser/widget/diffEditorWidget2/accessibleDiffViewer' ;
45
+ import { CursorChangeReason } from 'vs/editor/common/cursorEvents' ;
46
+ import { AudioCue , IAudioCueService } from 'vs/platform/audioCues/browser/audioCueService' ;
45
47
46
48
export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
47
49
private readonly elements = h ( 'div.monaco-diff-editor.side-by-side' , { style : { position : 'relative' , height : '100%' } } , [
@@ -83,6 +85,7 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
83
85
@IContextKeyService private readonly _parentContextKeyService : IContextKeyService ,
84
86
@IInstantiationService private readonly _parentInstantiationService : IInstantiationService ,
85
87
@ICodeEditorService codeEditorService : ICodeEditorService ,
88
+ @IAudioCueService private readonly _audioCueService : IAudioCueService ,
86
89
) {
87
90
super ( ) ;
88
91
codeEditorService . willCreateDiffEditor ( ) ;
@@ -235,6 +238,19 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
235
238
event . event . stopPropagation ( ) ;
236
239
}
237
240
} ) ) ;
241
+
242
+ this . _register ( Event . runAndSubscribe ( this . _editors . modified . onDidChangeCursorPosition , ( e ) => {
243
+ if ( e ?. reason === CursorChangeReason . Explicit ) {
244
+ const diff = this . _diffModel . get ( ) ?. diff . get ( ) ?. mappings . find ( m => m . lineRangeMapping . modifiedRange . contains ( e . position . lineNumber ) ) ;
245
+ if ( diff ?. lineRangeMapping . modifiedRange . isEmpty ) {
246
+ this . _audioCueService . playAudioCue ( AudioCue . diffLineDeleted ) ;
247
+ } else if ( diff ?. lineRangeMapping . originalRange . isEmpty ) {
248
+ this . _audioCueService . playAudioCue ( AudioCue . diffLineInserted ) ;
249
+ } else if ( diff ) {
250
+ this . _audioCueService . playAudioCue ( AudioCue . diffLineModified ) ;
251
+ }
252
+ }
253
+ } ) ) ;
238
254
}
239
255
240
256
public getContentHeight ( ) {
@@ -429,6 +445,14 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
429
445
diff = findLast ( diffs , d => d . lineRangeMapping . modifiedRange . startLineNumber < curLineNumber ) ?? diffs [ diffs . length - 1 ] ;
430
446
}
431
447
this . _goTo ( diff ) ;
448
+
449
+ if ( diff . lineRangeMapping . modifiedRange . isEmpty ) {
450
+ this . _audioCueService . playAudioCue ( AudioCue . diffLineDeleted ) ;
451
+ } else if ( diff . lineRangeMapping . originalRange . isEmpty ) {
452
+ this . _audioCueService . playAudioCue ( AudioCue . diffLineInserted ) ;
453
+ } else if ( diff ) {
454
+ this . _audioCueService . playAudioCue ( AudioCue . diffLineModified ) ;
455
+ }
432
456
}
433
457
434
458
revealFirstDiff ( ) : void {
0 commit comments