Skip to content

Conversation

andrewyuq
Copy link
Contributor

  1. listener will be completed managed by fileOpen/fileClose, otherwise killing Amazon Q Context process will dispose TextDocumentServiceHandler which will remove this listener before fileClose and logs an error during fileClose

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Description

Checklist

  • My code follows the code style of this project
  • I have added tests to cover my changes
  • A short description of the change has been added to the CHANGELOG if the change is customer-facing in the IDE.
  • I have added metrics for my changes (if required)

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

1. listener will be completed managed by fileOpen/fileClose,
otherwise killing Amazon Q Context process will dispose
TextDocumentServiceHandler which will remove this listener
before fileClose and logs an error during fileClose
@andrewyuq andrewyuq requested a review from a team as a code owner June 11, 2025 20:40
@andrewyuq andrewyuq requested a review from Copilot June 11, 2025 20:40
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates how the real-time edit listener is registered on documents, removing the automatic disposal via this and relying solely on explicit file open/close management.

  • Removed the parentDisposable parameter from addDocumentListener(listener, this)
  • Moved file.putUserData(KEY_REAL_TIME_EDIT_LISTENER, listener) to execute after listener registration inside the read action
Comments suppressed due to low confidence (1)

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/textdocument/TextDocumentServiceHandler.kt:75

  • Without a parentDisposable, this listener will persist indefinitely. Ensure you explicitly remove or clear the listener during fileClose to avoid memory leaks, and consider adding tests to verify that cleanup.
FileDocumentManager.getInstance().getDocument(file)?.addDocumentListener(listener)

@andrewyuq andrewyuq merged commit 31502bc into aws:main Jun 11, 2025
11 of 12 checks passed
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.

2 participants