File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
src/services/languages/python Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export class FastapiEndpointExtractor implements IEndpointExtractor
1818 {
1919 const appToken = tokens [ i ] ;
2020 const methodToken = tokens [ i + 1 ] ;
21- if ( appToken . text != 'app' || appToken . type != TokenType . variable || methodToken . type != TokenType . method )
21+ if ( ( appToken . text != 'app' && appToken . text != 'router' ) || appToken . type != TokenType . variable || methodToken . type != TokenType . method )
2222 continue ;
2323
2424 const method = methodToken . text ;
@@ -28,17 +28,17 @@ export class FastapiEndpointExtractor implements IEndpointExtractor
2828 const lineText = document . getText ( new vscode . Range (
2929 appToken . range . start ,
3030 new vscode . Position ( methodToken . range . end . line , 1000 ) ) ) ;
31- const match = new RegExp ( `^app\\.${ method } \\(["'](.*?)["']` ) . exec ( lineText ) ;
31+ const match = new RegExp ( `^( app|router) \\.${ method } \\(["'](.*?)["']` ) . exec ( lineText ) ;
3232 if ( ! match )
3333 continue ;
3434
3535 const relevantFunc = symbolInfo . firstOrDefault ( s => s . range . contains ( methodToken . range ) )
3636 if ( ! relevantFunc )
3737 continue ;
3838
39- const path = match [ 1 ] ;
39+ const path = match [ 2 ] ;
4040 results . push ( new EndpointInfo (
41- vscode . workspace . getWorkspaceFolder ( document . uri ) ! . name + '$_$' + method + ' ' + match [ 1 ] ,
41+ vscode . workspace . getWorkspaceFolder ( document . uri ) ! . name + '$_$' + method + ' ' + path ,
4242 method ,
4343 path ,
4444 relevantFunc . range ,
You can’t perform that action at this time.
0 commit comments