@@ -392,6 +392,7 @@ suite('InlineEditTriggerer', () => {
392392 const doc2 = createTextDocument ( undefined , Uri . file ( 'file2.py' ) ) ;
393393
394394 nextEditProvider . lastRejectionTime = Date . now ( ) - TRIGGER_INLINE_EDIT_REJECTION_COOLDOWN - 1 ;
395+ nextEditProvider . lastOutcome = NesOutcome . Accepted ;
395396
396397 // Configure to trigger on document switch
397398 void configurationService . setConfig ( ConfigKey . Advanced . InlineEditsTriggerOnEditorChangeAfterSeconds , 30 ) ;
@@ -504,6 +505,7 @@ suite('InlineEditTriggerer', () => {
504505 const doc2 = createTextDocument ( undefined , Uri . file ( 'file2.py' ) ) ;
505506
506507 nextEditProvider . lastRejectionTime = Date . now ( ) - TRIGGER_INLINE_EDIT_REJECTION_COOLDOWN - 1 ;
508+ nextEditProvider . lastOutcome = NesOutcome . Accepted ;
507509
508510 const triggerAfterSeconds = 30 ;
509511 // Configure to trigger on document switch
@@ -930,6 +932,7 @@ suite('InlineEditTriggerer', () => {
930932 const doc2 = createTextDocument ( undefined , Uri . file ( 'file2.py' ) , 'line1\nline2' ) ;
931933
932934 nextEditProvider . lastRejectionTime = Date . now ( ) - TRIGGER_INLINE_EDIT_REJECTION_COOLDOWN - 1 ;
935+ nextEditProvider . lastOutcome = NesOutcome . Accepted ;
933936 void configurationService . setConfig ( ConfigKey . Advanced . InlineEditsTriggerOnEditorChangeAfterSeconds , 30 ) ;
934937
935938 // Edit doc1 and trigger
@@ -1148,6 +1151,7 @@ suite('InlineEditTriggerer', () => {
11481151 const doc2 = createTextDocument ( undefined , Uri . file ( 'file2.py' ) ) ;
11491152
11501153 nextEditProvider . lastRejectionTime = Date . now ( ) - TRIGGER_INLINE_EDIT_REJECTION_COOLDOWN - 1 ;
1154+ nextEditProvider . lastOutcome = NesOutcome . Accepted ;
11511155 void configurationService . setConfig ( ConfigKey . Advanced . InlineEditsTriggerOnEditorChangeAfterSeconds , 30 ) ;
11521156
11531157 // Fire an undo change — this should still update lastEditTimestamp
@@ -1216,25 +1220,31 @@ suite('InlineEditTriggerer', () => {
12161220 assert . strictEqual ( firedEvents . length , 0 , 'Should not fire on doc switch during rejection cooldown' ) ;
12171221 } ) ;
12181222
1219- test ( 'Same-line cooldown is bypassed when triggerOnActiveEditorChange is set' , ( ) => {
1220- const { document, textEditor } = createTextDocument ( ) ;
1223+ test ( 'Same-line cooldown is bypassed after switching away and back' , ( ) => {
1224+ const doc1 = createTextDocument ( undefined , Uri . file ( 'file1.py' ) ) ;
1225+ const doc2 = createTextDocument ( undefined , Uri . file ( 'file2.py' ) ) ;
12211226 nextEditProvider . lastRejectionTime = Date . now ( ) - TRIGGER_INLINE_EDIT_REJECTION_COOLDOWN - 1 ;
12221227
1223- // Enable triggerOnActiveEditorChange — this bypasses same-line cooldown
1224- void configurationService . setConfig ( ConfigKey . Advanced . InlineEditsTriggerOnEditorChangeAfterSeconds , 30 ) ;
1225-
1226- triggerTextChange ( document ) ;
1227- triggerTextSelectionChange ( textEditor , new Selection ( 0 , 5 , 0 , 5 ) ) ;
1228+ // Edit doc1 and trigger on line 0
1229+ triggerTextChange ( doc1 . document ) ;
1230+ triggerTextSelectionChange ( doc1 . textEditor , new Selection ( 0 , 5 , 0 , 5 ) ) ;
12281231
12291232 const initialCount = firedEvents . length ;
12301233 assert . isAtLeast ( initialCount , 1 , 'First trigger should fire' ) ;
12311234
1232- // Same line, different column — normally would be in cooldown,
1233- // but triggerOnActiveEditorChange is set so cooldown is bypassed
1234- triggerTextSelectionChange ( textEditor , new Selection ( 0 , 10 , 0 , 10 ) ) ;
1235+ // Same line — cooldown blocks
1236+ triggerTextSelectionChange ( doc1 . textEditor , new Selection ( 0 , 10 , 0 , 10 ) ) ;
1237+ assert . strictEqual ( firedEvents . length , initialCount , 'Same-line cooldown should block' ) ;
1238+
1239+ // Switch to doc2
1240+ triggerTextChange ( doc2 . document ) ;
1241+ triggerTextSelectionChange ( doc2 . textEditor , new Selection ( 0 , 0 , 0 , 0 ) ) ;
1242+ const countAfterDoc2 = firedEvents . length ;
12351243
1236- assert . isAtLeast ( firedEvents . length , initialCount + 1 ,
1237- 'Same-line cooldown should be bypassed when triggerOnActiveEditorChange is set' ) ;
1244+ // Switch back to doc1, same line — cooldown should be cleared by the doc switch
1245+ triggerTextSelectionChange ( doc1 . textEditor , new Selection ( 0 , 10 , 0 , 10 ) ) ;
1246+ assert . isAtLeast ( firedEvents . length , countAfterDoc2 + 1 ,
1247+ 'Same-line cooldown should be bypassed after switching away and back' ) ;
12381248 } ) ;
12391249
12401250 test ( 'Output pane documents are ignored for selection changes' , ( ) => {
0 commit comments