Skip to content

Commit

Permalink
fix(language-service): provide outline for all embedded documents
Browse files Browse the repository at this point in the history
  • Loading branch information
forivall committed Jan 6, 2025
1 parent c2e27d7 commit 2f08429
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions packages/graphql-language-service-server/src/MessageProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -971,10 +971,16 @@ export class MessageProcessor {
}),
);

return this._languageService.getDocumentSymbols(
cachedDocument.contents[0].query,
textDocument.uri,
const results = await Promise.all(
cachedDocument.contents.map(content =>
this._languageService.getDocumentSymbols(
content.query,
textDocument.uri,
content.range,
),
),
);
return results.flat();
}

// async handleReferencesRequest(params: ReferenceParams): Promise<Location[]> {
Expand Down Expand Up @@ -1021,11 +1027,16 @@ export class MessageProcessor {
) {
return [];
}
const docSymbols = await this._languageService.getDocumentSymbols(
cachedDocument.contents[0].query,
uri,
const docSymbols = await Promise.all(
cachedDocument.contents.map(content =>
this._languageService.getDocumentSymbols(
content.query,
uri,
content.range,
),
),
);
symbols.push(...docSymbols);
symbols.push(...docSymbols.flat());
}),
);
return symbols.filter(symbol => symbol?.name?.includes(params.query));
Expand Down

0 comments on commit 2f08429

Please sign in to comment.