Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion docs-engine/src/docResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,17 @@ export class DocResolver {
private getCorpusGroupForIndexedSymbol(symbol: IndexedSymbolSummary): string | undefined {
const root = symbol.package || symbol.name.split('.')[0] || '';
const baseUrl = this.inventoryFetcher.getPackageBaseUrl(root) || this.inventoryFetcher.getPackageBaseUrl('builtins');
return baseUrl?.includes('docs.python.org') ? PYHOVER_PYTHON_STDLIB_CORPUS_GROUP : undefined;
if (!baseUrl) {
return undefined;
}

try {
const parsed = new URL(baseUrl);
return parsed.hostname === 'docs.python.org' ? PYHOVER_PYTHON_STDLIB_CORPUS_GROUP : undefined;
} catch {
// If baseUrl is not a valid URL, fall back to no special corpus group.
return undefined;
}
}

async buildPythonStdlibCorpus(
Expand Down
Loading