Skip to content

Commit 20afa76

Browse files
committed
Merged PR 473246: Always open documents in the Razor LSP
In my previous PR, that added the method I'm removing here, I tried to be a little fancy and not bother opening the Razor document because if we were getting an LSP request for a document, then it must already be open. I completely forgot that this isn't true for the IDynamicFile LSP request. If a document is open, and you call `openTextDocument`, vscode just returns immediately anyway so there really is no harm in calling this. Related work items: #1822437
2 parents c6e8733 + a4ba1b0 commit 20afa76

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/razor/src/Document/RazorDocumentManager.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class RazorDocumentManager implements IRazorDocumentManager {
5050
// succeed. Without this, even a simple diagnostics request will fail in Roslyn if the user just opens a .razor document
5151
// and leaves it open past the timeout.
5252
if (this.razorDocumentGenerationInitialized) {
53-
await this.ensureProjectedDocumentsOpen(document);
53+
await this.ensureDocumentAndProjectedDocumentsOpen(document);
5454
}
5555

5656
return document;
@@ -306,10 +306,6 @@ export class RazorDocumentManager implements IRazorDocumentManager {
306306
await vscode.workspace.openTextDocument(razorUri);
307307
}
308308

309-
await this.ensureProjectedDocumentsOpen(document);
310-
}
311-
312-
private async ensureProjectedDocumentsOpen(document: IRazorDocument) {
313309
await vscode.workspace.openTextDocument(document.csharpDocument.uri);
314310
await vscode.workspace.openTextDocument(document.htmlDocument.uri);
315311
}

0 commit comments

Comments
 (0)