Skip to content

What's the timing of sending textDocument/publishDiagnostics from langium to monaco editor? #1819

Answered by msujew
durianwaffle asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @durianwaffle,

Langium will only publish/update the diagnostics once, when the Validated document state has been reached. Otherwise, users will experience a flickering of diagnostics as the publishDiagnostice notification replaces all existing diagnostics on the language client for the given document.

documentBuilder.onDocumentPhase(DocumentState.Validated, async (document) => {
if (document.diagnostics) {
connection.sendDiagnostics({
uri: document.uri.toString(),
diagnostics: document.diagnostics
});
}
});

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by durianwaffle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants