File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
src/services/languages/python Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -84,12 +84,20 @@ export class FastapiEndpointExtractor implements IEndpointExtractor
8484 continue ;
8585
8686 const path = match [ index ] ;
87- results . push ( new EndpointInfo (
88- vscode . workspace . getWorkspaceFolder ( document . uri ) ! . name + '$_$' + method + ' ' + prefix + path ,
89- method ,
90- path ,
91- relevantFunc . range ,
92- document . uri ) ) ;
87+ let folder = vscode . workspace . getWorkspaceFolder ( document . uri ) ;
88+ let folderPrefix = folder ?. uri . path . split ( '/' ) . slice ( 0 , - 1 ) . join ( '/' ) ;
89+ let relevantPath = document . uri . path . substring ( folderPrefix ! . length ) ;
90+ let pathParts = relevantPath . split ( '/' ) . filter ( x => x ) ;
91+ for ( let j = 0 ; j < pathParts . length - 1 ; j ++ ) {
92+ let possibleRoot = pathParts [ j ] ;
93+ results . push ( new EndpointInfo (
94+ possibleRoot + '$_$' + method + ' ' + prefix + path ,
95+ method ,
96+ path ,
97+ relevantFunc . range ,
98+ document . uri ) ) ;
99+ }
100+
93101 }
94102 return results ;
95103 }
You can’t perform that action at this time.
0 commit comments