Skip to content

Commit

Permalink
Update diagnostics for deleted files (#1441)
Browse files Browse the repository at this point in the history
  • Loading branch information
msujew committed Apr 8, 2024
1 parent d873ebe commit 29b57c2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/langium/src/lsp/language-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,14 @@ export function addFileOperationHandler(connection: Connection, services: Langiu

export function addDiagnosticsHandler(connection: Connection, services: LangiumSharedServices): void {
const documentBuilder = services.workspace.DocumentBuilder;
documentBuilder.onUpdate(async (_, deleted) => {
for (const uri of deleted) {
connection.sendDiagnostics({
uri: uri.toString(),
diagnostics: []
});
}
});
documentBuilder.onBuildPhase(DocumentState.Validated, async (documents, cancelToken) => {
for (const document of documents) {
if (document.diagnostics) {
Expand Down

0 comments on commit 29b57c2

Please sign in to comment.