Skip to content

Commit bf99ef6

Browse files
committed
temp workaround for folder hierarcy issue
1 parent 9dfbab5 commit bf99ef6

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/services/languages/python/fastapiEndpointExtractor.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)