-
Hello, When I edit a big document (300 000 lines) with my dsl it takes around 3.3s to build (from parsing to validation). I noticed that the cancellation of the previous build happen very late in case of multiple editions. I instrumented the builder this way: protected override async buildDocuments(documents: LangiumDocument[], options: BuildOptions, cancelToken: Cancellation.CancellationToken): Promise<void> {
try {
console.time('buildDocuments');
await super.buildDocuments(documents, options, cancelToken);
}
catch (e) {
console.log('exception');
throw e;
}
finally {
console.timeEnd('buildDocuments');
}
} If I append 10 characters in my file, one each 0.3 second (approximately), I have the following log:
The exception raised by the CancellationToken happen after around 2.5s. I tried to reduce the interruptionPeriod with In such case the final document is built after more than 20s after the last edition. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey @ydaveluy, Unfortunately, the first step in the document building pipeline is always parsing which is usually synchronous and therefore cannot be interrupted. We built the |
Beta Was this translation helpful? Give feedback.
Hey @ydaveluy,
Unfortunately, the first step in the document building pipeline is always parsing which is usually synchronous and therefore cannot be interrupted.
We built the
AsyncParser
for this, but it's not ideal. It has a fairly slow startup time, but you might want to use it anyway. See here on how to use it.