Merge pull request #183452 from microsoft/ulugbekna/computeStickyModel-model-is-disposed

computeStickyModel: check token cancellation because it signals that the model is disposed
This commit is contained in:
Aiday Marlen Kyzy 2023-05-26 09:21:11 +02:00 committed by GitHub
commit 670f92f22b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -157,7 +157,7 @@ abstract class StickyModelCandidateProvider<T> implements IStickyModelCandidateP
public abstract get provider(): LanguageFeatureRegistry<object> | null;
public computeStickyModel(textModel: ITextModel, modelVersionId: number, token: CancellationToken): { statusPromise: Promise<Status> | Status; modelPromise: CancelablePromise<T | null> | null } {
if (!this.isProviderValid(textModel)) {
if (token.isCancellationRequested || !this.isProviderValid(textModel)) {
return { statusPromise: this._invalid(), modelPromise: null };
}
const providerModelPromise = createCancelablePromise(token => this.createModelFromProvider(textModel, modelVersionId, token));