fix: prevent "TextEditor is closed/disposed" warnings #5956
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the issue where "TextEditor is closed/disposed" warnings were being spammed in the logs when Roo Code performs API actions and edits documents.
Problem
The extension was attempting to access TextEditor instances that had already been disposed, causing frequent warning messages (tens per second) in the VS Code output.
Solution
DecorationController
before calling any TextEditor methodsDiffViewProvider
when resettinggetEnvironmentDetails.ts
andregisterCommands.ts
Changes
DecorationController.ts
to track disposal state and check editor validity before operationsDiffViewProvider.ts
to properly dispose controllers and handle disposed editorsgetEnvironmentDetails.ts
for accessing editor document propertiesregisterCommands.ts
for accessing editor viewColumn propertyDecorationController
disposal handlingTesting
Fixes #5954
Important
Fixes 'TextEditor is closed/disposed' warnings by adding disposal checks and handling in
DecorationController
andDiffViewProvider
, with comprehensive tests added.DecorationController
to prevent operations on disposedTextEditor
instances.TextEditor
property access in try-catch blocks inDecorationController.ts
andDiffViewProvider.ts
to handle disposed editors gracefully.DiffViewProvider
during reset.getEnvironmentDetails.ts
andregisterCommands.ts
to protect against accessing properties of disposed editors.__tests__/DecorationController.spec.ts
to cover disposal scenarios.This description was created by
for 6b68b16. You can customize this summary. It will automatically update as commits are pushed.