Skip to content

Commit eca2efe

Browse files
authored
fix(amazonq): codeSelection incorrect if user has no selection #4921
Problem Ask Q to write a unit test of a function, Q does not know how to do it. It hallucinates the function.( It does not know which class I am generating against). See internal TT P128119238. Solution Let the cursorState.range be undefined if user do not have a selection. The function getSelectionInsideExtendedCodeBlock is supposed to take the original selection as input, not the importantRange (which is current line of cursor)
1 parent 25dee3f commit eca2efe

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Fix bug when Amazon Q chat sends code selection while user has no selection"
4+
}

packages/core/src/codewhispererChat/editor/context/focusArea/focusAreaExtractor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class FocusAreaContextExtractor {
5757
extendedCodeBlock: this.getRangeText(editor.document, extendedCodeBlockRange),
5858
codeBlock: codeBlock,
5959
selectionInsideExtendedCodeBlock: this.getSelectionInsideExtendedCodeBlock(
60-
importantRange as Selection,
60+
editor.selection,
6161
extendedCodeBlockRange
6262
),
6363
names:

0 commit comments

Comments
 (0)