-
I'm making a programming language named Mynx. I want to watch all Mynx files in the workspace, and transpile them on edit. Here is how I am currently doing this. Is this the right way? Is there a better way to do this?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
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 Instead, you can use the
Make sure to use the |
Beta Was this translation helpful? Give feedback.
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: