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
DecorationControllerbefore calling any TextEditor methodsDiffViewProviderwhen resettinggetEnvironmentDetails.tsandregisterCommands.tsChanges
DecorationController.tsto track disposal state and check editor validity before operationsDiffViewProvider.tsto properly dispose controllers and handle disposed editorsgetEnvironmentDetails.tsfor accessing editor document propertiesregisterCommands.tsfor accessing editor viewColumn propertyDecorationControllerdisposal handlingTesting
Fixes #5954
Important
Fixes 'TextEditor is closed/disposed' warnings by adding disposal checks and handling in
DecorationControllerandDiffViewProvider, with comprehensive tests added.DecorationControllerto prevent operations on disposedTextEditorinstances.TextEditorproperty access in try-catch blocks inDecorationController.tsandDiffViewProvider.tsto handle disposed editors gracefully.DiffViewProviderduring reset.getEnvironmentDetails.tsandregisterCommands.tsto protect against accessing properties of disposed editors.__tests__/DecorationController.spec.tsto cover disposal scenarios.This description was created by
for 6b68b16. You can customize this summary. It will automatically update as commits are pushed.