File tree Expand file tree Collapse file tree 2 files changed +18
-12
lines changed Expand file tree Collapse file tree 2 files changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export async function jumpToTagAndOffset(): Promise<void> {
8
8
}
9
9
const nameMatch = file . name . match ( / ( .* ) \. ( i n t | m a c ) $ / i) ;
10
10
if ( ! nameMatch ) {
11
- vscode . window . showWarningMessage ( "Jump to Tag and Offset only supports .int and .mac routines." ) ;
11
+ vscode . window . showWarningMessage ( "Jump to Tag and Offset only supports .int and .mac routines." , "Dismiss" ) ;
12
12
return ;
13
13
}
14
14
const document = vscode . window . activeTextEditor ?. document ;
Original file line number Diff line number Diff line change @@ -656,19 +656,25 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
656
656
return ;
657
657
}
658
658
const [ , routine ] = nameMatch ;
659
- const line = event . selections [ 0 ] . start . line ;
660
659
let label = "" ;
661
660
let pos = 0 ;
662
- for ( let i = line ; i > 0 ; i -- ) {
663
- const labelMatch = document . lineAt ( i ) . text . match ( / ^ ( % ? \w + ) .* / ) ;
664
- if ( labelMatch ) {
665
- [ , label ] = labelMatch ;
666
- break ;
667
- }
668
- pos ++ ;
669
- }
670
- event . textEditor . document . getText ;
671
- posPanel . text = `${ label } ${ pos > 0 ? "+" + pos : "" } ^${ routine } ` ;
661
+ vscode . commands
662
+ . executeCommand < vscode . DocumentSymbol [ ] > ( "vscode.executeDocumentSymbolProvider" , document . uri )
663
+ . then ( ( symbols ) => {
664
+ const cursor = event . selections [ 0 ] . active ;
665
+ if ( symbols . length == 0 || cursor . isBefore ( symbols [ 0 ] . range . start ) ) {
666
+ pos = cursor . line - 1 ;
667
+ } else {
668
+ for ( const symbol of symbols ) {
669
+ if ( symbol . range . contains ( cursor ) ) {
670
+ label = symbol . name ;
671
+ pos = cursor . line - symbol . range . start . line ;
672
+ break ;
673
+ }
674
+ }
675
+ }
676
+ posPanel . text = `${ label } ${ pos > 0 ? "+" + pos : "" } ^${ routine } ` ;
677
+ } ) ;
672
678
} ) ;
673
679
674
680
const documentSelector = ( ...list ) =>
You can’t perform that action at this time.
0 commit comments