Skip to content

Fix resolveCodeLens calling validateRange on disposed model#317263

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/resolve-codelens-issue
Draft

Fix resolveCodeLens calling validateRange on disposed model#317263
Copilot wants to merge 2 commits into
mainfrom
copilot/resolve-codelens-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

MainThreadLanguageFeatures.resolveCodeLens awaits the extension host's $resolveCodeLens and then calls model.validateRange(result.range). If the editor/model is disposed during the await, this throws Model is disposed!.

  • src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts: extend the existing post-await guard to also bail out when the model is disposed.
const result = await this._proxy.$resolveCodeLens(handle, codeLens, token);
if (!result || token.isCancellationRequested || model.isDisposed()) {
    return undefined;
}
return { ...result, range: model.validateRange(result.range) };

Copilot AI requested review from Copilot and removed request for Copilot May 19, 2026 07:19
Copilot AI linked an issue May 19, 2026 that may be closed by this pull request
…tures

Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 19, 2026 07:23
Copilot AI changed the title [WIP] Fix resolveCodeLens invoking validateRange on disposed model Fix resolveCodeLens calling validateRange on disposed model May 19, 2026
Copilot AI requested a review from dmitrivMS May 19, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

resolveCodeLens invokes validateRange on disposed model

2 participants