Skip to content
Discussion options

You must be logged in to vote

Hey @MechMel,

While this correctly notifies you about file changes, the documents in question will not be in a good state to be used as a source of code generation. We go trough multiple async document builder phases, which are responsible for stuff like cross reference resolution and validation. Using onDidChangeContent doesn't allow you to wait until these phases have completed.

Instead, you can use the DocumentBuilder.onBuildPhase(DocumentState.Validated, (documents, cancellationToken) => {}) callback. This has multiple advantages:

  1. It only runs your callback once the validation has completed. This allows to check whether your document has any errors or any other issues which prevent i…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MechMel
Comment options

Answer selected by MechMel
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