Fix editor context retrieval due to async chat operation #27
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.
Developer Information:
The following changes are going to fix the issue related to copilot not being able to read content from the active editor as the chat orchestrator is now an async operation.
The content reading method was moved to the prompt handler function in order to be executed in the required UI thread.
AI Summary:
This pull request introduces several changes to the
ChatOrchestrator
class and its related components to enhance the handling of editor content as context for AI-generated responses. The most important changes include modifying method signatures, updating test cases, and importing necessary utilities.Changes to
ChatOrchestrator
and related interfaces:com.developer.nefarious.zjoule.plugin/src/com/developer/nefarious/zjoule/plugin/chat/ChatOrchestrator.java
: Modified thegetAnswer
method to accept an additional parametereditorContent
and updated the logic to use this content as context. [1] [2]com.developer.nefarious.zjoule.plugin/src/com/developer/nefarious/zjoule/plugin/chat/IChatOrchestrator.java
: Updated thegetAnswer
method signature to include theeditorContent
parameter.Updates to
PromptHandler
:com.developer.nefarious.zjoule.plugin/src/com/developer/nefarious/zjoule/plugin/core/functions/PromptHandler.java
: Added import forEditorContentReader
and updated thefunction
method to read editor content and pass it togetAnswer
. [1] [2] [3]Test case adjustments:
com.developer.nefarious.zjoule.test/src/com/developer/nefarious/zjoule/test/chat/ChatOrchestratorTest.java
: Updated multiple test cases to accommodate the neweditorContent
parameter in thegetAnswer
method. [1] [2] [3] [4] [5] [6]