@@ -16,20 +16,20 @@ export async function jumpToTagAndOffset(): Promise<void> {
16
16
return ;
17
17
}
18
18
19
- // Build map of labels in routine
20
- const map = new Map ( ) ;
21
- const options = [ ] ;
22
- for ( let i = 0 ; i < document . lineCount ; i ++ ) {
23
- const labelMatch = document . lineAt ( i ) . text . match ( / ^ ( % ? \w + ) . * / ) ;
24
- if ( labelMatch ) {
25
- map . set ( labelMatch [ 1 ] , i ) ;
26
- options . push ( labelMatch [ 1 ] ) ;
27
- }
28
- }
29
-
30
- const items : vscode . QuickPickItem [ ] = options . map ( ( option ) => {
31
- return { label : option } ;
32
- } ) ;
19
+ // Get the labels from the document symbol provider
20
+ const map = new Map < string , number > ( ) ;
21
+ const symbols : vscode . DocumentSymbol [ ] = await vscode . commands . executeCommand (
22
+ "vscode.executeDocumentSymbolProvider" ,
23
+ document . uri
24
+ ) ;
25
+ const items : vscode . QuickPickItem [ ] = symbols
26
+ . filter ( ( symbol ) => symbol . kind === vscode . SymbolKind . Method )
27
+ . map ( ( symbol ) => {
28
+ map . set ( symbol . name , symbol . range . start . line ) ;
29
+ return {
30
+ label : symbol . name ,
31
+ } ;
32
+ } ) ;
33
33
const quickPick = vscode . window . createQuickPick ( ) ;
34
34
quickPick . title = "Jump to Tag + Offset" ;
35
35
quickPick . items = items ;
@@ -50,7 +50,7 @@ export async function jumpToTagAndOffset(): Promise<void> {
50
50
return ;
51
51
}
52
52
} else {
53
- offset += parseInt ( map . get ( parts [ 0 ] ) , 10 ) ;
53
+ offset += map . get ( parts [ 0 ] ) ;
54
54
}
55
55
if ( parts . length > 1 ) {
56
56
offset += parseInt ( parts [ 1 ] , 10 ) ;
0 commit comments