@@ -22,7 +22,10 @@ export default () => {
22
22
historyPerEditor . set ( key , history )
23
23
}
24
24
25
+ let writePositions = true
26
+
25
27
const pushPosition = ( kind ?: OurKind , forceAdd = false ) => {
28
+ if ( ! writePositions ) return
26
29
const editor = vscode . window . activeTextEditor
27
30
if ( ! editor ) return
28
31
const position = editor . selection . active
@@ -93,6 +96,7 @@ export default () => {
93
96
} ) ,
94
97
)
95
98
99
+ const currentPos = editor . selection . active
96
100
const index = await showQuickPick ( getItems ( ) , {
97
101
title : 'Tracked Positions Stack' ,
98
102
ignoreFocusOut : true ,
@@ -101,13 +105,24 @@ export default () => {
101
105
this . items = getItems ( )
102
106
}
103
107
} ,
108
+ onDidChangeFirstActive ( item , index ) {
109
+ writePositions = false
110
+ const [ selectedPos ] = history [ index ] !
111
+ editor . selection = new vscode . Selection ( selectedPos , selectedPos )
112
+ editor . revealRange ( new vscode . Range ( selectedPos , selectedPos ) )
113
+ setTimeout ( ( ) => {
114
+ writePositions = true
115
+ } )
116
+ } ,
104
117
} )
105
118
onHistoryUpdate = undefined
106
- if ( index === undefined ) return
119
+ if ( index === undefined ) {
120
+ editor . selection = new vscode . Selection ( currentPos , currentPos )
121
+ editor . revealRange ( new vscode . Range ( currentPos , currentPos ) )
122
+ return
123
+ }
124
+
107
125
void vscode . window . showTextDocument ( uri )
108
- const [ selectedPos ] = history [ index ] !
109
- editor . selection = new vscode . Selection ( selectedPos , selectedPos )
110
- editor . revealRange ( new vscode . Range ( selectedPos , selectedPos ) )
111
126
} )
112
127
disposables . push ( extensionCtx . subscriptions . at ( - 1 ) ! )
113
128
registerExtensionCommand ( 'goToPreviousTrackedPosition' , ( ) => {
0 commit comments