You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(codewhisperer): closing symbol handling during typeahead #4257
Problem
Closing symbol is not handled correctly when there is typeahead because the recommendation passed in as the argument is "original" which doesn't factor in typeahead.
Solution
Pass in another range marker, effectiveRange which denotes the effective recommendation written by CodeWhisperer.
* @param endPosition: end position of the recommendation
34
-
* @param startPosition: start position of the recommendation
33
+
* LeftContext | Recommendation | RightContext
34
+
* This function aims to resolve symbols which are redundant and need to be removed
35
+
* The high level logic is as followed
36
+
* 1. Pair non-paired closing symbols(parenthesis, brackets, quotes) existing in the "recommendation" with non-paired symbols existing in the "leftContext"
37
+
* 2. Remove non-paired closing symbols existing in the "rightContext"
38
+
* @param endPosition: end position of the effective recommendation written by CodeWhisperer
39
+
* @param startPosition: start position of the effective recommendation by CodeWhisperer
40
+
*
41
+
* for example given file context ('|' is where we trigger the service):
42
+
* anArray.pu|
43
+
* recommendation returned: "sh(element);"
44
+
* typeahead: "sh("
45
+
* the effective recommendation written by CodeWhisperer: "element);"
0 commit comments