Function interruptAndCheck

  • This function does two things:

    1. Check the elapsed time since the last call to this function or to startCancelableOperation. If the predefined period (configured with setInterruptionPeriod) is exceeded, execution is delayed with delayNextTick.
    2. If the predefined period is not met yet or execution is resumed after an interruption, the given cancellation token is checked, and if cancellation is requested, OperationCanceled is thrown.

    All services in Langium that receive a CancellationToken may potentially call this function, so the CancellationToken must be caught (with an async try-catch block or a catch callback attached to the promise) to avoid that event being exposed as an error.

    Parameters

    Returns Promise<void>