Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "Use documentChangeEvent as auto trigger condition"
}
3 changes: 2 additions & 1 deletion packages/amazonq/src/app/inline/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
context,
token,
isAutoTrigger,
getAllRecommendationsOptions
getAllRecommendationsOptions,
this.documentEventListener.getLastDocumentChangeEvent(document.uri.fsPath)?.event
)
// get active item from session for displaying
const items = this.sessionManager.getActiveRecommendation()
Expand Down
15 changes: 14 additions & 1 deletion packages/amazonq/src/app/inline/recommendationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import * as vscode from 'vscode'
import {
InlineCompletionListWithReferences,
InlineCompletionWithReferencesParams,
inlineCompletionWithReferencesRequestType,
TextDocumentContentChangeEvent,
} from '@aws/language-server-runtimes/protocol'
import { CancellationToken, InlineCompletionContext, Position, TextDocument } from 'vscode'
import { LanguageClient } from 'vscode-languageclient'
Expand Down Expand Up @@ -40,17 +42,28 @@
context: InlineCompletionContext,
token: CancellationToken,
isAutoTrigger: boolean,
options: GetAllRecommendationsOptions = { emitTelemetry: true, showUi: true }
options: GetAllRecommendationsOptions = { emitTelemetry: true, showUi: true },
documentChangeEvent?: vscode.TextDocumentChangeEvent
) {
// Record that a regular request is being made
this.cursorUpdateRecorder?.recordCompletionRequest()
let documentChangeParams = documentChangeEvent

Check failure on line 50 in packages/amazonq/src/app/inline/recommendationService.ts

View workflow job for this annotation

GitHub Actions / lint (18.x, stable)

'documentChangeParams' is never reassigned. Use 'const' instead
? {
textDocument: {
uri: document.uri.toString(),
version: document.version,
},
contentChanges: documentChangeEvent.contentChanges.map((x) => x as TextDocumentContentChangeEvent),
}
: undefined

let request: InlineCompletionWithReferencesParams = {
textDocument: {
uri: document.uri.toString(),
},
position,
context,
documentChangeParams: documentChangeParams,
}
if (options.editsStreakToken) {
request = { ...request, partialResultToken: options.editsStreakToken }
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,8 @@
"@aws-sdk/types": "^3.13.1",
"@aws/chat-client": "^0.1.4",
"@aws/chat-client-ui-types": "^0.1.47",
"@aws/language-server-runtimes": "^0.2.102",
"@aws/language-server-runtimes-types": "^0.1.43",
"@aws/language-server-runtimes": "^0.2.111",
"@aws/language-server-runtimes-types": "^0.1.47",
"@cspotcode/source-map-support": "^0.8.1",
"@sinonjs/fake-timers": "^10.0.2",
"@types/adm-zip": "^0.4.34",
Expand Down
Loading