-
Notifications
You must be signed in to change notification settings - Fork 273
fix(amazonq): insert to cursor button in chat applies edit to active file #5897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Qodana Community for JVMIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at [email protected]
|
...ins-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/util/LspEditorUtil.kt
Fixed
Show fixed
Hide fixed
…o samgst/insert-to-cursor-fix
val textDocument = editor?.let { TextDocumentIdentifier(toUriString(it.virtualFile)) } | ||
val cursorPosition = editor?.let { LspEditorUtil.getCursorPosition(it) } | ||
val enrichedParams = (node.params as? ObjectNode)?.apply { | ||
set<JsonNode>("cursorPosition", serializer.objectMapper.valueToTree(cursorPosition)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see SEND_CHAT_COMMAND_PROMPT to see how we can reduce number of serializer calls
) | ||
} | ||
|
||
fun applyWorkspaceEdit(project: Project, edit: WorkspaceEdit) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follow up later with tests for at least this method
…o samgst/insert-to-cursor-fix
…o samgst/insert-to-cursor-fix
virtualFileManager = mockk(relaxed = true) | ||
fileDocumentManager = mockk(relaxed = true) | ||
fileEditorManager = mockk(relaxed = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
take a look at CodeInsightTestFixture
Clicking the
insert to cursor
option on code blocks generated in Q chat previously did not actually apply the change.This change now inserts the code block to the cursor position on the current active file in the editor.
Types of changes
Description
Checklist
License
I confirm that my contribution is made under the terms of the Apache 2.0 license.