Skip to content

Commit

Permalink
Use new version of withVirtualDocUri() for statement range provider…
Browse files Browse the repository at this point in the history
… as well
  • Loading branch information
juliasilge committed Nov 9, 2024
1 parent 323a5ca commit 3e6b431
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions apps/vscode/src/host/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,13 @@ class EmbeddedStatementRangeProvider implements HostStatementRangeProvider {
token: vscode.CancellationToken): Promise<hooks.StatementRange | undefined> {
const vdoc = await virtualDoc(document, position, this._engine);
if (vdoc) {
const vdocUri = await virtualDocUri(vdoc, document.uri, "statementRange");
try {
return await withVirtualDocUri(vdoc, document.uri, "statementRange", async (uri: vscode.Uri) => {
return getStatementRange(
vdocUri.uri,
uri,
adjustedPosition(vdoc.language, position),
vdoc.language
);
} catch (error) {
return undefined;
} finally {
if (vdocUri.cleanup) {
await vdocUri.cleanup();
}
}
});
} else {
return undefined;
}
Expand Down

0 comments on commit 3e6b431

Please sign in to comment.