@@ -196,7 +196,10 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
196
196
197
197
vscode . window . registerTreeDataProvider ( "ObjectScriptExplorer" , explorerProvider ) ;
198
198
199
- panel = vscode . window . createStatusBarItem ( vscode . StatusBarAlignment . Left ) ;
199
+ posPanel = vscode . window . createStatusBarItem ( vscode . StatusBarAlignment . Left , 0 ) ;
200
+ posPanel . show ( ) ;
201
+
202
+ panel = vscode . window . createStatusBarItem ( vscode . StatusBarAlignment . Left , 1 ) ;
200
203
201
204
const debugAdapterFactory = new ObjectScriptDebugAdapterDescriptorFactory ( ) ;
202
205
@@ -217,10 +220,33 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
217
220
} ) ;
218
221
219
222
vscode . window . onDidChangeActiveTextEditor ( ( textEditor : vscode . TextEditor ) => {
220
- if ( config ( "autoPreviewXML" ) ) {
223
+ posPanel . text = "" ;
224
+ if ( textEditor . document . fileName . endsWith ( ".xml" ) && config ( "autoPreviewXML" ) ) {
221
225
return xml2doc ( context , textEditor ) ;
222
226
}
223
227
} ) ;
228
+ vscode . window . onDidChangeTextEditorSelection ( ( event : vscode . TextEditorSelectionChangeEvent ) => {
229
+ posPanel . text = "" ;
230
+ const intMatch = event . textEditor . document . fileName . match ( / \/ ? ( .* ) \. i n t $ / i) ;
231
+ if ( ! intMatch || event . selections . length > 1 || ! event . selections [ 0 ] . isEmpty ) {
232
+ return ;
233
+ }
234
+ const line = event . selections [ 0 ] . start . line ;
235
+ const [ , routine ] = intMatch ;
236
+ const { document } = event . textEditor ;
237
+ let label = "" ;
238
+ let pos = 0 ;
239
+ for ( let i = line ; i > 0 ; i -- ) {
240
+ const labelMatch = document . lineAt ( i ) . text . match ( / ^ ( \w + ) .* / ) ;
241
+ if ( labelMatch ) {
242
+ [ , label ] = labelMatch ;
243
+ break ;
244
+ }
245
+ pos ++ ;
246
+ }
247
+ event . textEditor . document . getText ;
248
+ posPanel . text = `${ label } ${ pos > 0 ? "+" + pos : "" } ^${ routine } ` ;
249
+ } ) ;
224
250
225
251
const documentSelector = ( ...list ) =>
226
252
[ "file" , ...schemas ] . reduce ( ( acc , scheme ) => acc . concat ( list . map ( language => ( { scheme, language } ) ) ) , [ ] ) ;
0 commit comments