Skip to content

feat(amazonq): Auth and inline suggestions through Flare LSP #7450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 94 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
15efdd9
feat(amazonq): enable inline suggestions through flare by default (#7…
jpinkney-aws May 6, 2025
da499d5
fix(amazonq): respect suggestions enabled setting for auto trigger (#…
jpinkney-aws May 6, 2025
d91bbbb
Merge master into feature/flare-inline
aws-toolkit-automation May 6, 2025
f14533d
Merge master into feature/flare-inline
aws-toolkit-automation May 6, 2025
15ad617
Merge master into feature/flare-inline
aws-toolkit-automation May 6, 2025
d57cac5
refactor(amazonq): deprecate amazon q inline through vscode (#7237)
jpinkney-aws May 6, 2025
71040b4
Merge master into feature/flare-inline
aws-toolkit-automation May 6, 2025
c6fb67c
Merge master into feature/flare-inline
aws-toolkit-automation May 6, 2025
b7cab24
Merge master into feature/flare-inline
aws-toolkit-automation May 6, 2025
3e1614d
Merge master into feature/flare-inline
aws-toolkit-automation May 6, 2025
f114894
refactor(amazonq): deprecate codewhisperer context utils (#7241)
jpinkney-aws May 6, 2025
059a140
Merge master into feature/flare-inline
aws-toolkit-automation May 7, 2025
4a279d8
feat(amazonq): add experiment for basic e2e flow of inline chat throu…
Hweinstock May 7, 2025
86ceeba
feat(amazonq): add experiment for basic e2e flow of inline chat throu…
Hweinstock May 7, 2025
0b751ac
Merge master into feature/flare-inline
aws-toolkit-automation May 7, 2025
aeca817
refactor(amazonq): pull out all decryption logic to one place (#7248)
Hweinstock May 7, 2025
ddad4ec
Merge master into feature/flare-inline
aws-toolkit-automation May 7, 2025
858cad6
telemetry(amazonq): align flare/vscode codewhisperer_serviceInvocatio…
jpinkney-aws May 8, 2025
972d1af
Merge master into feature/flare-inline
aws-toolkit-automation May 8, 2025
8022cd3
Merge master into feature/flare-inline
aws-toolkit-automation May 8, 2025
1a728f1
Merge master into feature/flare-inline
aws-toolkit-automation May 8, 2025
bbf7b0e
feat(amazonq): re-add activeState/line trackers (#7257)
jpinkney-aws May 8, 2025
c77668d
refactor(amazonq): rename inline "generating" message class (#7267)
nkomonen-amazon May 8, 2025
4eac908
fix: Ensure we clear the "generating" inline message when done
nkomonen-amazon May 8, 2025
dd3b829
fix: show spinning icon on status bar when generating suggestion
nkomonen-amazon May 8, 2025
0d2c7fb
feat(amazonq): add tutorial trackers for lsp (#7264)
jpinkney-aws May 9, 2025
260fb37
Merge pull request #7272 from nkomonen-amazon/spinningStatusBar
jpinkney-aws May 9, 2025
7e65155
refactor(amazonq): remove local workspace indexing library
jpinkney-aws May 9, 2025
079bb52
refactor(amazonq): refactor base lsp config
jpinkney-aws May 9, 2025
6995107
telemetry(amazonq): implement codewhisperer_clientComponentLatency (#…
jpinkney-aws May 9, 2025
9a793ee
Merge pull request #7275 from jpinkney-aws/remove3
jpinkney-aws May 9, 2025
5f6ee4e
Merge pull request #7277 from jpinkney-aws/closingBrackets
jpinkney-aws May 9, 2025
4b52ff4
test(amazonq): update inline tests for flare (#7274)
jpinkney-aws May 9, 2025
0429352
fix(amazonq): debounce inline suggestion requests. (#7289)
Hweinstock May 12, 2025
2f7c3d9
refactor(amazonq): move debounce to top level. (#7292)
Hweinstock May 13, 2025
7bb3dac
Merge master into feature/flare-inline (#7261)
aws-toolkit-automation May 13, 2025
b649dbd
Merge master into feature/flare-inline (#7299)
aws-toolkit-automation May 14, 2025
692847a
test(amazonq): add tests for edge cases (#7305)
Hweinstock May 14, 2025
ffb6ec1
fix(amazonq): standardize reference type for reference log (#7311)
Hweinstock May 14, 2025
b5540e2
feat(amazonq): show a message when no suggestions are found on manual…
Hweinstock May 15, 2025
b63185c
fix: avoid relying on session state
Hweinstock May 15, 2025
7f5f9b7
cleanup: remove unused session logic
Hweinstock May 15, 2025
4554067
test: delete outdated tests
Hweinstock May 15, 2025
8c93836
refactor: remove noisy logs
Hweinstock May 15, 2025
0165fc8
fix: don't apply codelense to each item
Hweinstock May 15, 2025
2fdbb84
test: remove inline refrence codelense from tests
Hweinstock May 15, 2025
a814ee0
Merge master into feature/flare-inline (#7310)
aws-toolkit-automation May 15, 2025
d2072d2
refactor: simplify cases
Hweinstock May 15, 2025
daaa169
fix: make the codelense work
Hweinstock May 16, 2025
41ac579
merge(amazonq): Merge feature branch Auth on LSP Identity Server
opieter-aws May 16, 2025
344bdb6
Merge pull request #7332 from opieter-aws/featre/flare-mega
opieter-aws May 16, 2025
39ab198
Merge branch 'feature/flare-inline' into feature/flare-mega2
Hweinstock May 16, 2025
0b84152
fix: active inline properly
Hweinstock May 16, 2025
79977c7
Merge branch 'fix/suggestions' into feature/flare-mega2
Hweinstock May 16, 2025
275b6ca
Merge branch 'codelense/referenceLog' into feature/flare-mega2
Hweinstock May 16, 2025
112adb3
Merge pull request #7336 from Hweinstock/feature/flare-mega2
Hweinstock May 16, 2025
8d10589
Merge master into feature/flare-mega
aws-toolkit-automation May 16, 2025
534e7a4
Merge master into feature/flare-mega
aws-toolkit-automation May 16, 2025
0d6d35e
fix(amazonq): fix cache watcher on token file to avoid logout after S…
opieter-aws May 19, 2025
ca75b50
fix(amazonq): register commands before invocation (#7346)
opieter-aws May 19, 2025
b5692cc
Merge remote-tracking branch 'upstream/master' into HEAD
opieter-aws May 19, 2025
d66335a
Merge remote-tracking branch 'upstream/master' into HEAD
opieter-aws May 19, 2025
3a175df
Merge pull request #7347 from aws/autoMerge/feature/flare-mega
opieter-aws May 19, 2025
813efa0
fix(customizations): Fix bug where customizations were always registe…
opieter-aws May 20, 2025
165a060
Merge master into feature/flare-mega
aws-toolkit-automation May 20, 2025
67295aa
Merge master into feature/flare-mega
aws-toolkit-automation May 21, 2025
7983fc1
fix(amazonq): throw if no region profiles are available (#7357)
opieter-aws May 22, 2025
8d70e06
Merge master into feature/flare-mega
aws-toolkit-automation May 22, 2025
f17420b
Merge master into feature/flare-mega
aws-toolkit-automation May 22, 2025
f92321e
Merge master into feature/flare-mega
aws-toolkit-automation May 22, 2025
5ff4c32
Merge master into feature/flare-mega
aws-toolkit-automation May 23, 2025
e411922
fix(amazonq): Handle developer profile migration more gracefully (#7362)
opieter-aws May 23, 2025
0ddbf4a
fix(amazonq): handle existing Flare connection when migrating SSO con…
opieter-aws May 23, 2025
4535284
fix(telemetry): add result parameter when emitting telemetry (#7378)
opieter-aws May 23, 2025
dfcd2d6
Merge master into feature/flare-mega
aws-toolkit-automation May 23, 2025
5ca78d5
Merge master into feature/flare-mega (#7393)
aws-toolkit-automation May 29, 2025
a42118d
Merge master into feature/flare-mega
aws-toolkit-automation May 29, 2025
d4a1fa8
Merge remote-tracking branch 'upstream/master' into HEAD
opieter-aws Jun 9, 2025
8c5111a
Lintfix
opieter-aws Jun 9, 2025
ad93067
Merge pull request #7404 from aws/autoMerge/feature/flare-mega
opieter-aws Jun 9, 2025
3966878
fix(amazonq): merge master into feature/flare-mega (#7456)
leigaol Jun 10, 2025
7237d2f
merge
leigaol Jun 10, 2025
ac76283
merge 2
leigaol Jun 10, 2025
0993bd8
Merge pull request #7461 from leigaol/merge_mega
leigaol Jun 10, 2025
384d066
Merge master into feature/flare-mega
aws-toolkit-automation Jun 10, 2025
40b9e31
Merge master into feature/flare-mega
aws-toolkit-automation Jun 11, 2025
919cd73
fix(amazonq): fix git merge caused compile failure (#7475)
leigaol Jun 11, 2025
470df15
Merge master into feature/flare-mega
aws-toolkit-automation Jun 11, 2025
867899b
Merge master into feature/flare-mega
aws-toolkit-automation Jun 12, 2025
be790c2
Merge master into feature/flare-mega
aws-toolkit-automation Jun 12, 2025
952e5dc
Merge master into feature/flare-mega
aws-toolkit-automation Jun 12, 2025
ef92dcd
Merge master into feature/flare-mega
aws-toolkit-automation Jun 13, 2025
ed5d38b
Merge master into feature/flare-mega
aws-toolkit-automation Jun 13, 2025
eb75bc0
Merge master into feature/flare-mega
aws-toolkit-automation Jun 13, 2025
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
5 changes: 1 addition & 4 deletions docs/lsp.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ sequenceDiagram

## Language Server Debugging

1. Clone https://github.com/aws/language-servers.git and set it up in the same workspace as this project by cmd+shift+p and "add folder to workspace" and selecting the language-servers folder that you just cloned. Your VS code folder structure should look like below.


1. Clone https://github.com/aws/language-servers.git and set it up in the same workspace as this project by cmd+shift+p and "add folder to workspace" and selecting the language-servers folder that you just cloned. Your VS code folder structure should look like below.

```
/aws-toolkit-vscode
Expand All @@ -48,7 +46,6 @@ sequenceDiagram
3. Enable the lsp experiment:
```
"aws.experiments": {
"amazonqLSP": true,
"amazonqLSPInline": true, // optional: enables inline completion from flare
"amazonqLSPChat": true // optional: enables chat from flare
}
Expand Down
253 changes: 180 additions & 73 deletions package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "Fix Error: 'Amazon Q service is not signed in'"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "Fix Error: 'Amazon Q Profile is not selected for IDC connection type'"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "Previous and subsequent cells are used as context for completion in a Jupyter notebook"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "Support chat in AL2 aarch64"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Feature",
"description": "Add inline completion support for abap language"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "bugfix",
"description": "/review: disable auto-review by default"
}
1 change: 0 additions & 1 deletion packages/amazonq/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"watch": "npm run clean && npm run buildScripts && tsc -watch -p ./",
"testCompile": "npm run clean && npm run buildScripts && npm run compileOnly",
"test": "npm run testCompile && c8 --allowExternal ts-node ../core/scripts/test/launchTest.ts unit dist/test/unit/index.js ../core/dist/src/testFixtures/workspaceFolder",
"testE2E": "npm run testCompile && c8 --allowExternal ts-node ../core/scripts/test/launchTest.ts e2e dist/test/e2e/index.js ../core/dist/src/testFixtures/workspaceFolder",
"testWeb": "npm run compileDev && c8 --allowExternal ts-node ../core/scripts/test/launchTest.ts web dist/test/web/testRunnerWebCore.js",
"webRun": "npx @vscode/test-web --open-devtools --browserOption=--disable-web-security --waitForDebugger=9222 --extensionDevelopmentPath=. .",
"webWatch": "npm run clean && npm run buildScripts && webpack --mode development --watch",
Expand Down
20 changes: 19 additions & 1 deletion packages/amazonq/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { GenerateAssistantResponseCommandOutput, GenerateAssistantResponseReques
import { AuthUtil } from 'aws-core-vscode/codewhisperer'
import { ChatSession } from 'aws-core-vscode/codewhispererChat'
import { api } from 'aws-core-vscode/amazonq'
import { getLogger } from 'aws-core-vscode/shared'

export default {
chatApi: {
Expand All @@ -26,8 +27,25 @@ export default {
await AuthUtil.instance.showReauthenticatePrompt()
}
},
/**
* @deprecated use getAuthState() instead
*
* Legacy function for callers who expect auth state to be granular amongst Q features.
* Auth state is consistent between features, so getAuthState() can be consumed safely for all features.
*
*/
async getChatAuthState() {
return AuthUtil.instance.getChatAuthState()
getLogger().warn('Warning: getChatAuthState() is deprecated. Use getAuthState() instead.')
const state = AuthUtil.instance.getAuthState()
const convertedState = state === 'notConnected' ? 'disconnected' : state
return {
codewhispererCore: convertedState,
codewhispererChat: convertedState,
amazonQ: convertedState,
}
},
getAuthState() {
return AuthUtil.instance.getAuthState()
},
},
} satisfies api
5 changes: 3 additions & 2 deletions packages/amazonq/src/app/amazonqScan/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { Messenger } from './chat/controller/messenger/messenger'
import { UIMessageListener } from './chat/views/actions/uiMessageListener'
import { debounce } from 'lodash'
import { Commands, placeholder } from 'aws-core-vscode/shared'
import { auth2 } from 'aws-core-vscode/auth'

export function init(appContext: AmazonQAppInitContext) {
const scanChatControllerEventEmitters: ScanChatControllerEventEmitters = {
Expand Down Expand Up @@ -52,7 +53,7 @@ export function init(appContext: AmazonQAppInitContext) {
appContext.registerWebViewToAppMessagePublisher(new MessagePublisher<any>(scanChatUIInputEventEmitter), 'review')

const debouncedEvent = debounce(async () => {
const authenticated = (await AuthUtil.instance.getChatAuthState()).amazonQ === 'connected'
const authenticated = AuthUtil.instance.getAuthState() === 'connected'
let authenticatingSessionID = ''

if (authenticated) {
Expand All @@ -67,7 +68,7 @@ export function init(appContext: AmazonQAppInitContext) {
messenger.sendAuthenticationUpdate(authenticated, [authenticatingSessionID])
}, 500)

AuthUtil.instance.secondaryAuth.onDidChangeActiveConnection(() => {
AuthUtil.instance.onDidChangeConnectionState((e: auth2.AuthStateEvent) => {
return debouncedEvent()
})
AuthUtil.instance.regionProfileManager.onDidChangeRegionProfile(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class ScanController {
telemetry.amazonq_feedback.emit({
featureId: 'amazonQReview',
amazonqConversationId: this.sessionStorage.getSession().scanUuid,
credentialStartUrl: AuthUtil.instance.startUrl,
credentialStartUrl: AuthUtil.instance.connection?.startUrl,
interactionType: data.vote,
})
})
Expand All @@ -122,8 +122,8 @@ export class ScanController {
try {
getLogger().debug(`Q - Review: Session created with id: ${session.tabID}`)

const authState = await AuthUtil.instance.getChatAuthState()
if (authState.amazonQ !== 'connected') {
const authState = AuthUtil.instance.getAuthState()
if (authState !== 'connected') {
void this.messenger.sendAuthNeededExceptionMessage(authState, tabID)
session.isAuthenticating = true
return
Expand Down Expand Up @@ -161,8 +161,8 @@ export class ScanController {
return
}
// check that the session is authenticated
const authState = await AuthUtil.instance.getChatAuthState()
if (authState.amazonQ !== 'connected') {
const authState = AuthUtil.instance.getAuthState()
if (authState !== 'connected') {
void this.messenger.sendAuthNeededExceptionMessage(authState, message.tabID)
session.isAuthenticating = true
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import { AuthFollowUpType, AuthMessageDataMap } from 'aws-core-vscode/amazonq'
import {
FeatureAuthState,
SecurityScanError,
CodeWhispererConstants,
SecurityScanStep,
Expand All @@ -34,6 +33,7 @@ import {
import { i18n } from 'aws-core-vscode/shared'
import { ScanAction, scanProgressMessage } from '../../../models/constants'
import path from 'path'
import { auth2 } from 'aws-core-vscode/auth'

export type UnrecoverableErrorType = 'no-project-found' | 'no-open-file-found' | 'invalid-file-type'

Expand Down Expand Up @@ -78,19 +78,15 @@ export class Messenger {
this.dispatcher.sendUpdatePromptProgress(new UpdatePromptProgressMessage(tabID, progressField))
}

public async sendAuthNeededExceptionMessage(credentialState: FeatureAuthState, tabID: string) {
public async sendAuthNeededExceptionMessage(credentialState: auth2.AuthState, tabID: string) {
let authType: AuthFollowUpType = 'full-auth'
let message = AuthMessageDataMap[authType].message

switch (credentialState.amazonQ) {
case 'disconnected':
switch (credentialState) {
case 'notConnected':
authType = 'full-auth'
message = AuthMessageDataMap[authType].message
break
case 'unsupported':
authType = 'use-supported-auth'
message = AuthMessageDataMap[authType].message
break
case 'expired':
authType = 're-auth'
message = AuthMessageDataMap[authType].message
Expand Down
58 changes: 1 addition & 57 deletions packages/amazonq/src/app/inline/activation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,68 +6,26 @@
import vscode from 'vscode'
import {
AuthUtil,
CodeSuggestionsState,
CodeWhispererCodeCoverageTracker,
CodeWhispererConstants,
CodeWhispererSettings,
ConfigurationEntry,
DefaultCodeWhispererClient,
invokeRecommendation,
isInlineCompletionEnabled,
KeyStrokeHandler,
RecommendationHandler,
runtimeLanguageContext,
TelemetryHelper,
UserWrittenCodeTracker,
vsCodeState,
} from 'aws-core-vscode/codewhisperer'
import { Commands, getLogger, globals, sleep } from 'aws-core-vscode/shared'
import { globals, sleep } from 'aws-core-vscode/shared'

export async function activate() {
const codewhispererSettings = CodeWhispererSettings.instance
const client = new DefaultCodeWhispererClient()

if (isInlineCompletionEnabled()) {
await setSubscriptionsforInlineCompletion()
await AuthUtil.instance.setVscodeContextProps()
}

function getAutoTriggerStatus(): boolean {
return CodeSuggestionsState.instance.isSuggestionsEnabled()
}

async function getConfigEntry(): Promise<ConfigurationEntry> {
const isShowMethodsEnabled: boolean =
vscode.workspace.getConfiguration('editor').get('suggest.showMethods') || false
const isAutomatedTriggerEnabled: boolean = getAutoTriggerStatus()
const isManualTriggerEnabled: boolean = true
const isSuggestionsWithCodeReferencesEnabled = codewhispererSettings.isSuggestionsWithCodeReferencesEnabled()

// TODO:remove isManualTriggerEnabled
return {
isShowMethodsEnabled,
isManualTriggerEnabled,
isAutomatedTriggerEnabled,
isSuggestionsWithCodeReferencesEnabled,
}
}

async function setSubscriptionsforInlineCompletion() {
RecommendationHandler.instance.subscribeSuggestionCommands()

/**
* Automated trigger
*/
globals.context.subscriptions.push(
vscode.window.onDidChangeActiveTextEditor(async (editor) => {
await RecommendationHandler.instance.onEditorChange()
}),
vscode.window.onDidChangeWindowState(async (e) => {
await RecommendationHandler.instance.onFocusChange()
}),
vscode.window.onDidChangeTextEditorSelection(async (e) => {
await RecommendationHandler.instance.onCursorChange(e)
}),
vscode.workspace.onDidChangeTextDocument(async (e) => {
const editor = vscode.window.activeTextEditor
if (!editor) {
Expand All @@ -80,7 +38,6 @@ export async function activate() {
return
}

CodeWhispererCodeCoverageTracker.getTracker(e.document.languageId)?.countTotalTokens(e)
UserWrittenCodeTracker.instance.onTextDocumentChange(e)
/**
* Handle this keystroke event only when
Expand All @@ -105,19 +62,6 @@ export async function activate() {
* Then this event can be processed by our code.
*/
await sleep(CodeWhispererConstants.vsCodeCursorUpdateDelay)
if (!RecommendationHandler.instance.isSuggestionVisible()) {
await KeyStrokeHandler.instance.processKeyStroke(e, editor, client, await getConfigEntry())
}
}),
// manual trigger
Commands.register({ id: 'aws.amazonq.invokeInlineCompletion', autoconnect: true }, async () => {
invokeRecommendation(
vscode.window.activeTextEditor as vscode.TextEditor,
client,
await getConfigEntry()
).catch((e) => {
getLogger().error('invokeRecommendation failed: %s', (e as Error).message)
})
})
)
}
Expand Down
Loading
Loading