Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions aws-toolkit-vscode.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
{
"path": "packages/amazonq",
},
{
"path": "../language-servers",
},
],
"settings": {
"typescript.tsdk": "node_modules/typescript/lib",
Expand Down
6 changes: 3 additions & 3 deletions packages/amazonq/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"env": {
"SSMDOCUMENT_LANGUAGESERVER_PORT": "6010",
"WEBPACK_DEVELOPER_SERVER": "http://localhost:8080"
"WEBPACK_DEVELOPER_SERVER": "http://localhost:8080",
// Below allows for overrides used during development
// "__AMAZONQLSP_PATH": "${workspaceFolder}/../../../language-servers/app/aws-lsp-codewhisperer-runtimes/out/agent-standalone.js",
// "__AMAZONQLSP_UI": "${workspaceFolder}/../../../language-servers/chat-client/build/amazonq-ui.js"
"__AMAZONQLSP_PATH": "${workspaceFolder}/../../../language-servers/app/aws-lsp-codewhisperer-runtimes/out/agent-standalone.js",
"__AMAZONQLSP_UI": "${workspaceFolder}/../../../language-servers/chat-client/build/amazonq-ui.js"
},
"envFile": "${workspaceFolder}/.local.env",
"outFiles": ["${workspaceFolder}/dist/**/*.js", "${workspaceFolder}/../core/dist/**/*.js"],
Expand Down
43 changes: 27 additions & 16 deletions packages/amazonq/src/app/inline/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,30 +239,41 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
const editor = window.activeTextEditor
if (prevSession && prevSessionId && prevItemId && prevStartPosition) {
const prefix = document.getText(new Range(prevStartPosition, position))
const prevItemMatchingPrefix = []
const prevItemMatchingPrefix: InlineCompletionItemWithReferences[] = []
for (const item of this.sessionManager.getActiveRecommendation()) {
const text = typeof item.insertText === 'string' ? item.insertText : item.insertText.value
if (text.startsWith(prefix) && position.isAfterOrEqual(prevStartPosition)) {
item.command = {
command: 'aws.amazonq.acceptInline',
title: 'On acceptance',
arguments: [
prevSessionId,
item,
editor,
prevSession?.requestStartTime,
position.line,
prevSession?.firstCompletionDisplayLatency,
],
if (prefix.length > 0 && text.startsWith(prefix) && position.isAfterOrEqual(prevStartPosition)) {
if (item.isInlineEdit) {
prevItemMatchingPrefix.push(item)
} else {
item.command = {
command: 'aws.amazonq.acceptInline',
title: 'On acceptance',
arguments: [
prevSessionId,
item,
editor,
prevSession?.requestStartTime,
position.line,
prevSession?.firstCompletionDisplayLatency,
],
}
item.range = new Range(prevStartPosition, position)
prevItemMatchingPrefix.push(item)
}
item.range = new Range(prevStartPosition, position)
prevItemMatchingPrefix.push(item as InlineCompletionItem)
}
}
// re-use previous suggestions as long as new typed prefix matches
if (prevItemMatchingPrefix.length > 0) {
if (prevItemMatchingPrefix[0].isInlineEdit) {
// Check if Next Edit Prediction feature flag is enabled
if (Experiments.instance.isExperimentEnabled('amazonqLSPNEP')) {
void showEdits(prevItemMatchingPrefix[0], editor, prevSession, this.languageClient).then()
}
return []
}
getLogger().debug(`Re-using suggestions that match user typed characters`)
return prevItemMatchingPrefix
return prevItemMatchingPrefix as InlineCompletionItem[]
}
getLogger().debug(`Auto rejecting suggestions from previous session`)
// if no such suggestions, report the previous suggestion as Reject
Expand Down
Loading