Skip to content

Commit 56d2e74

Browse files
laura-codessroger-zhanggfloralphrhamiltlaileni-aws
committed
Merge master into feature/ui-e2e-tests (#7680)
- Resolve conflicts and push to this PR branch. - **Do not squash-merge** this PR. Use the "Create a merge commit" option to do a regular merge. To perform the merge from the command line, you could do something like the following (where "origin" is the name of the remote in your local git repo): ``` git stash git fetch --all git checkout origin/feature/ui-e2e-tests git merge origin/master git commit git push origin HEAD:refs/heads/autoMerge/feature/ui-e2e-tests ``` --------- Co-authored-by: Roger Zhang <[email protected]> Co-authored-by: 🥩 Flora <[email protected]> Co-authored-by: Reed Hamilton <[email protected]> Co-authored-by: Laxman Reddy <[email protected]> Co-authored-by: Roger Zhang <[email protected]> Co-authored-by: Jacob Chung <[email protected]> Co-authored-by: aws-asolidu <[email protected]> Co-authored-by: Newton Der <[email protected]> Co-authored-by: Newton Der <[email protected]> Co-authored-by: aws-toolkit-automation <> Co-authored-by: laura-codess <[email protected]> Co-authored-by: Tyrone Smith <[email protected]> Co-authored-by: Aidan Ton <[email protected]> Co-authored-by: abhraina-aws <[email protected]> Co-authored-by: atontb <[email protected]> Co-authored-by: Nitish <[email protected]> Co-authored-by: Nitish Kumar Singh <[email protected]> Co-authored-by: Blake Lazarine <[email protected]> Co-authored-by: mkovelam <[email protected]> Co-authored-by: BlakeLazarine <[email protected]> Co-authored-by: Will Lo <[email protected]> Co-authored-by: Na Yue <[email protected]> Co-authored-by: Lei Gao <[email protected]> Co-authored-by: tsmithsz <[email protected]> Co-authored-by: Reed Hamilton <[email protected]> Co-authored-by: surajrdy-aws <[email protected]> Co-authored-by: Boyu <[email protected]> Co-authored-by: Dung Dong <[email protected]>
1 parent 669d551 commit 56d2e74

File tree

26 files changed

+297
-148
lines changed

26 files changed

+297
-148
lines changed

package-lock.json

Lines changed: 13 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
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": "Let Enter invoke auto completion more consistently"
4+
}
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": "Use documentChangeEvent as auto trigger condition"
4+
}

packages/amazonq/CHANGELOG.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
## 1.88.0 2025-08-06
2-
3-
- **Feature** Amazon Q Chat provides error explanations and fixes when hovering or right-clicking on error indicators and messages
4-
- **Feature** /transform: Show transformation history in Transformation Hub and allow users to resume jobs
5-
6-
## 1.87.0 2025-07-31
7-
8-
- Miscellaneous non-user-facing changes
9-
10-
## 1.86.0 2025-07-30
11-
12-
- **Bug Fix** Let Enter invoke auto completion more consistently
13-
- **Bug Fix** Faster and more responsive inline completion UX
14-
- **Bug Fix** Use documentChangeEvent as auto trigger condition
15-
161
## 1.85.0 2025-07-19
172

183
- Miscellaneous non-user-facing changes

packages/amazonq/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "amazon-q-vscode",
33
"displayName": "Amazon Q",
4-
"description": "The most capable generative AIpowered assistant for software development.",
5-
"version": "1.89.0-SNAPSHOT",
4+
"description": "The most capable generative AI-powered assistant for building, operating, and transforming software, with advanced capabilities for managing data and AI",
5+
"version": "1.86.0-SNAPSHOT",
66
"extensionKind": [
77
"workspace"
88
],

packages/amazonq/src/app/inline/EditRendering/imageRenderer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ export async function showEdits(
3737
return
3838
}
3939

40+
// TODO: To investigate why it fails and patch [generateDiffSvg]
41+
if (newCode.length === 0) {
42+
getLogger('nextEditPrediction').warn('not able to apply provided edit suggestion, skip rendering')
43+
return
44+
}
45+
4046
if (svgImage) {
4147
// display the SVG image
4248
await displaySvgDecoration(

packages/amazonq/src/app/inline/EditRendering/svgGenerator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import { diffWordsWithSpace, diffLines } from 'diff'
6+
import { diffWordsWithSpace } from 'diff'
77
import * as vscode from 'vscode'
88
import { ToolkitError, getLogger } from 'aws-core-vscode/shared'
99
import { diffUtilities } from 'aws-core-vscode/shared'

packages/amazonq/src/app/inline/completion.ts

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ export class InlineCompletionManager implements Disposable {
112112
) => {
113113
try {
114114
vsCodeState.isCodeWhispererEditing = true
115-
const startLine = position.line
116115
// TODO: also log the seen state for other suggestions in session
117116
// Calculate timing metrics before diagnostic delay
118117
const totalSessionDisplayTime = performance.now() - requestStartTime
@@ -121,11 +120,6 @@ export class InlineCompletionManager implements Disposable {
121120
this.sessionManager.getActiveSession()?.diagnosticsBeforeAccept,
122121
getDiagnosticsOfCurrentFile()
123122
)
124-
// try remove the extra } ) ' " if there is a new reported problem
125-
// the extra } will cause syntax error
126-
if (diagnosticDiff.added.length > 0) {
127-
await handleExtraBrackets(editor, editor.selection.active, position)
128-
}
129123
const params: LogInlineCompletionSessionResultsParams = {
130124
sessionId: sessionId,
131125
completionSessionResult: {
@@ -170,22 +164,16 @@ export class InlineCompletionManager implements Disposable {
170164
const onInlineRejection = async () => {
171165
try {
172166
vsCodeState.isCodeWhispererEditing = true
173-
const session = this.sessionManager.getActiveSession()
174-
if (session === undefined) {
175-
return
176-
}
177-
const requestStartTime = session.requestStartTime
178-
const totalSessionDisplayTime = performance.now() - requestStartTime
179167
await commands.executeCommand('editor.action.inlineSuggest.hide')
180168
// TODO: also log the seen state for other suggestions in session
181169
this.disposable.dispose()
182170
this.disposable = languages.registerInlineCompletionItemProvider(
183171
CodeWhispererConstants.platformLanguageIds,
184172
this.inlineCompletionProvider
185173
)
186-
const sessionId = session.sessionId
174+
const sessionId = this.sessionManager.getActiveSession()?.sessionId
187175
const itemId = this.sessionManager.getActiveRecommendation()[0]?.itemId
188-
if (!itemId) {
176+
if (!sessionId || !itemId) {
189177
return
190178
}
191179
const params: LogInlineCompletionSessionResultsParams = {
@@ -197,8 +185,6 @@ export class InlineCompletionManager implements Disposable {
197185
discarded: false,
198186
},
199187
},
200-
firstCompletionDisplayLatency: session.firstCompletionDisplayLatency,
201-
totalSessionDisplayTime: totalSessionDisplayTime,
202188
}
203189
this.languageClient.sendNotification(this.logSessionResultMessageName, params)
204190
// clear session manager states once rejected
@@ -264,16 +250,21 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
264250
return []
265251
}
266252

267-
// there is a bug in VS Code, when hitting Enter, the context.triggerKind is Invoke (0)
268-
// when hitting other keystrokes, the context.triggerKind is Automatic (1)
269-
// we only mark option + C as manual trigger
270-
// this is a workaround since the inlineSuggest.trigger command take no params
271-
const isAutoTrigger = performance.now() - vsCodeState.lastManualTriggerTime > 50
253+
const isAutoTrigger = context.triggerKind === InlineCompletionTriggerKind.Automatic
272254
if (isAutoTrigger && !CodeSuggestionsState.instance.isSuggestionsEnabled()) {
273255
// return early when suggestions are disabled with auto trigger
274256
return []
275257
}
276258

259+
// yield event loop to let the document listen catch updates
260+
await sleep(1)
261+
// prevent user deletion invoking auto trigger
262+
// this is a best effort estimate of deletion
263+
if (this.documentEventListener.isLastEventDeletion(document.uri.fsPath)) {
264+
getLogger().debug('Skip auto trigger when deleting code')
265+
return []
266+
}
267+
277268
// yield event loop to let the document listen catch updates
278269
await sleep(1)
279270

@@ -364,8 +355,8 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
364355
},
365356
token,
366357
isAutoTrigger,
367-
this.documentEventListener,
368-
getAllRecommendationsOptions
358+
getAllRecommendationsOptions,
359+
this.documentEventListener.getLastDocumentChangeEvent(document.uri.fsPath)?.event
369360
)
370361
// get active item from session for displaying
371362
const items = this.sessionManager.getActiveRecommendation()

packages/amazonq/src/app/inline/recommendationService.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
5+
import * as vscode from 'vscode'
56
import {
67
InlineCompletionListWithReferences,
78
InlineCompletionWithReferencesParams,
89
inlineCompletionWithReferencesRequestType,
910
TextDocumentContentChangeEvent,
10-
editCompletionRequestType,
1111
} from '@aws/language-server-runtimes/protocol'
1212
import { CancellationToken, InlineCompletionContext, Position, TextDocument } from 'vscode'
1313
import { LanguageClient } from 'vscode-languageclient'
@@ -67,8 +67,8 @@ export class RecommendationService {
6767
context: InlineCompletionContext,
6868
token: CancellationToken,
6969
isAutoTrigger: boolean,
70-
documentEventListener: DocumentEventListener,
71-
options: GetAllRecommendationsOptions = { emitTelemetry: true, showUi: true }
70+
options: GetAllRecommendationsOptions = { emitTelemetry: true, showUi: true },
71+
documentChangeEvent?: vscode.TextDocumentChangeEvent
7272
) {
7373
const documentChangeEvent = documentEventListener?.getLastDocumentChangeEvent(document.uri.fsPath)?.event
7474

@@ -83,15 +83,13 @@ export class RecommendationService {
8383
contentChanges: documentChangeEvent.contentChanges.map((x) => x as TextDocumentContentChangeEvent),
8484
}
8585
: undefined
86-
const openTabs = await getOpenFilesInWindow()
8786
let request: InlineCompletionWithReferencesParams = {
8887
textDocument: {
8988
uri: document.uri.toString(),
9089
},
9190
position,
9291
context,
9392
documentChangeParams: documentChangeParams,
94-
openTabFilepaths: openTabs,
9593
}
9694
if (options.editsStreakToken) {
9795
request = { ...request, partialResultToken: options.editsStreakToken }
@@ -200,7 +198,6 @@ export class RecommendationService {
200198

201199
const isInlineEdit = result.items.some((item) => item.isInlineEdit)
202200

203-
// TODO: question, is it possible that the first request returns empty suggestion but has non-empty next token?
204201
if (result.partialResultToken) {
205202
if (!isInlineEdit) {
206203
// If the suggestion is COMPLETIONS and there are more results to fetch, handle them in the background

packages/amazonq/src/app/inline/sessionManager.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,6 @@ export class SessionManager {
131131
}
132132
}
133133

134-
public checkInlineSuggestionVisibility() {
135-
if (this.activeSession) {
136-
this.activeSession.displayed = true
137-
}
138-
}
139-
140134
private clearReferenceInlineHintsAndImportHints() {
141135
ReferenceInlineProvider.instance.removeInlineReference()
142136
ImportAdderProvider.instance.clear()

0 commit comments

Comments
 (0)