Skip to content

Commit 344bdb6

Browse files
authored
Merge pull request aws#7332 from opieter-aws/featre/flare-mega
feat(amazonq): Merge feature branch Auth on LSP Identity Server
2 parents fbf8bd0 + 41ac579 commit 344bdb6

File tree

119 files changed

+2510
-1809
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+2510
-1809
lines changed

docs/lsp.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ sequenceDiagram
2626

2727
## Language Server Debugging
2828

29-
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.
30-
31-
29+
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.
3230

3331
```
3432
/aws-toolkit-vscode
@@ -48,7 +46,6 @@ sequenceDiagram
4846
3. Enable the lsp experiment:
4947
```
5048
"aws.experiments": {
51-
"amazonqLSP": true,
5249
"amazonqLSPInline": true, // optional: enables inline completion from flare
5350
"amazonqLSPChat": true // optional: enables chat from flare
5451
}

package-lock.json

Lines changed: 0 additions & 1 deletion
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": "Fix Error: 'Amazon Q service is not signed in'"
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": "Fix Error: 'Amazon Q Profile is not selected for IDC connection type'"
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": "Previous and subsequent cells are used as context for completion in a Jupyter notebook"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "Add inline completion support for abap language"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "bugfix",
3+
"description": "/review: disable auto-review by default"
4+
}

packages/amazonq/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
"watch": "npm run clean && npm run buildScripts && tsc -watch -p ./",
6060
"testCompile": "npm run clean && npm run buildScripts && npm run compileOnly",
6161
"test": "npm run testCompile && c8 --allowExternal ts-node ../core/scripts/test/launchTest.ts unit dist/test/unit/index.js ../core/dist/src/testFixtures/workspaceFolder",
62-
"testE2E": "npm run testCompile && c8 --allowExternal ts-node ../core/scripts/test/launchTest.ts e2e dist/test/e2e/index.js ../core/dist/src/testFixtures/workspaceFolder",
6362
"testWeb": "npm run compileDev && c8 --allowExternal ts-node ../core/scripts/test/launchTest.ts web dist/test/web/testRunnerWebCore.js",
6463
"webRun": "npx @vscode/test-web --open-devtools --browserOption=--disable-web-security --waitForDebugger=9222 --extensionDevelopmentPath=. .",
6564
"webWatch": "npm run clean && npm run buildScripts && webpack --mode development --watch",

packages/amazonq/src/api.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { GenerateAssistantResponseCommandOutput, GenerateAssistantResponseReques
88
import { AuthUtil } from 'aws-core-vscode/codewhisperer'
99
import { ChatSession } from 'aws-core-vscode/codewhispererChat'
1010
import { api } from 'aws-core-vscode/amazonq'
11+
import { getLogger } from 'aws-core-vscode/shared'
1112

1213
export default {
1314
chatApi: {
@@ -26,8 +27,25 @@ export default {
2627
await AuthUtil.instance.showReauthenticatePrompt()
2728
}
2829
},
30+
/**
31+
* @deprecated use getAuthState() instead
32+
*
33+
* Legacy function for callers who expect auth state to be granular amongst Q features.
34+
* Auth state is consistent between features, so getAuthState() can be consumed safely for all features.
35+
*
36+
*/
2937
async getChatAuthState() {
30-
return AuthUtil.instance.getChatAuthState()
38+
getLogger().warn('Warning: getChatAuthState() is deprecated. Use getAuthState() instead.')
39+
const state = AuthUtil.instance.getAuthState()
40+
const convertedState = state === 'notConnected' ? 'disconnected' : state
41+
return {
42+
codewhispererCore: convertedState,
43+
codewhispererChat: convertedState,
44+
amazonQ: convertedState,
45+
}
46+
},
47+
getAuthState() {
48+
return AuthUtil.instance.getAuthState()
3149
},
3250
},
3351
} satisfies api

packages/amazonq/src/app/amazonqScan/app.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { Messenger } from './chat/controller/messenger/messenger'
1919
import { UIMessageListener } from './chat/views/actions/uiMessageListener'
2020
import { debounce } from 'lodash'
2121
import { Commands, placeholder } from 'aws-core-vscode/shared'
22+
import { auth2 } from 'aws-core-vscode/auth'
2223

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

5455
const debouncedEvent = debounce(async () => {
55-
const authenticated = (await AuthUtil.instance.getChatAuthState()).amazonQ === 'connected'
56+
const authenticated = AuthUtil.instance.getAuthState() === 'connected'
5657
let authenticatingSessionID = ''
5758

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

70-
AuthUtil.instance.secondaryAuth.onDidChangeActiveConnection(() => {
71+
AuthUtil.instance.onDidChangeConnectionState((e: auth2.AuthStateEvent) => {
7172
return debouncedEvent()
7273
})
7374
AuthUtil.instance.regionProfileManager.onDidChangeRegionProfile(() => {

0 commit comments

Comments
 (0)