@@ -42,6 +42,8 @@ import { DiffEditorEditors } from './diffEditorEditors';
4242import { DiffEditorOptions } from './diffEditorOptions' ;
4343import { DiffEditorViewModel , DiffMapping , DiffState } from './diffEditorViewModel' ;
4444import { 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' ;
4547
4648export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
4749 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 {
8385 @IContextKeyService private readonly _parentContextKeyService : IContextKeyService ,
8486 @IInstantiationService private readonly _parentInstantiationService : IInstantiationService ,
8587 @ICodeEditorService codeEditorService : ICodeEditorService ,
88+ @IAudioCueService private readonly _audioCueService : IAudioCueService ,
8689 ) {
8790 super ( ) ;
8891 codeEditorService . willCreateDiffEditor ( ) ;
@@ -235,6 +238,19 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
235238 event . event . stopPropagation ( ) ;
236239 }
237240 } ) ) ;
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+ } ) ) ;
238254 }
239255
240256 public getContentHeight ( ) {
@@ -429,6 +445,14 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
429445 diff = findLast ( diffs , d => d . lineRangeMapping . modifiedRange . startLineNumber < curLineNumber ) ?? diffs [ diffs . length - 1 ] ;
430446 }
431447 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+ }
432456 }
433457
434458 revealFirstDiff ( ) : void {
0 commit comments