Skip to content

Commit aba7c7c

Browse files
committed
Merge branch 'master' of github.com:zuoyaofu/aws-toolkit-vscode
2 parents 4cfb1e7 + 2d898fb commit aba7c7c

File tree

105 files changed

+3772
-677
lines changed

Some content is hidden

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

105 files changed

+3772
-677
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
* @aws/aws-ides-team
22
packages/core/src/codewhisperer/ @aws/codewhisperer-team
33
packages/core/src/amazonqFeatureDev/ @aws/earlybird
4-
packages/core/src/codewhispererChat/ @aws/flare
5-
packages/core/src/amazonq/ @aws/flare
64
packages/core/src/awsService/accessanalyzer/ @aws/access-analyzer

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ Unlike the user setting overrides, not all of these environment variables have t
534534
- `AWS_TOOLKIT_TEST_NO_COLOR`: If the tests should include colour in their output
535535
- `DEVELOPMENT_PATH`: The path to the aws toolkit vscode project
536536
- `TEST_DIR` - The directory where the test runner should find the tests
537+
- `AMAZONQ_FEATUREDEV_ITERATION_TEST` - Controls whether to enable multiple iteration testing for Amazon Q feature development
537538

538539
### SAM/CFN ("goformation") JSON schema
539540

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"skippedTestReport": "ts-node ./scripts/skippedTestReport.ts ./packages/amazonq/test/e2e/"
4242
},
4343
"devDependencies": {
44-
"@aws-toolkits/telemetry": "^1.0.317",
44+
"@aws-toolkits/telemetry": "^1.0.318",
4545
"@playwright/browser-chromium": "^1.43.1",
4646
"@stylistic/eslint-plugin": "^2.11.0",
4747
"@types/he": "^1.2.3",

packages/amazonq/.changes/1.63.0.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"date": "2025-05-01",
3+
"version": "1.63.0",
4+
"entries": [
5+
{
6+
"type": "Bug Fix",
7+
"description": "Q profile selection hangs when a region is blocked"
8+
},
9+
{
10+
"type": "Feature",
11+
"description": "Agentic coding experience: Amazon Q can now write code and run shell commands on your behalf"
12+
}
13+
]
14+
}

packages/amazonq/.changes/1.64.0.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"date": "2025-05-02",
3+
"version": "1.64.0",
4+
"entries": [
5+
{
6+
"type": "Bug Fix",
7+
"description": "Enable Amazon Q LSP in AL2 instances"
8+
}
9+
]
10+
}

packages/amazonq/.changes/1.65.0.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"date": "2025-05-05",
3+
"version": "1.65.0",
4+
"entries": [
5+
{
6+
"type": "Feature",
7+
"description": "Support selecting customizations across all Q profiles with automatic profile switching for enterprise users"
8+
},
9+
{
10+
"type": "Feature",
11+
"description": "Memorize and autofill users' last Sso login profile"
12+
}
13+
]
14+
}

packages/amazonq/.changes/1.66.0.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"date": "2025-05-09",
3+
"version": "1.66.0",
4+
"entries": [
5+
{
6+
"type": "Bug Fix",
7+
"description": "Avoid inline completion 'Improperly formed request' errors when file is too large"
8+
},
9+
{
10+
"type": "Bug Fix",
11+
"description": "Named agent tabs sometimes open with unnecessary input options"
12+
}
13+
]
14+
}

packages/amazonq/CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
## 1.66.0 2025-05-09
2+
3+
- **Bug Fix** Avoid inline completion 'Improperly formed request' errors when file is too large
4+
- **Bug Fix** Named agent tabs sometimes open with unnecessary input options
5+
6+
## 1.65.0 2025-05-05
7+
8+
- **Feature** Support selecting customizations across all Q profiles with automatic profile switching for enterprise users
9+
- **Feature** Memorize and autofill users' last Sso login profile
10+
11+
## 1.64.0 2025-05-02
12+
13+
- **Bug Fix** Enable Amazon Q LSP in AL2 instances
14+
15+
## 1.63.0 2025-05-01
16+
17+
- **Bug Fix** Q profile selection hangs when a region is blocked
18+
- **Feature** Agentic coding experience: Amazon Q can now write code and run shell commands on your behalf
19+
120
## 1.62.0 2025-04-25
221

322
- **Bug Fix** Toast message to warn users if Developer Profile is not selected

packages/amazonq/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "amazon-q-vscode",
33
"displayName": "Amazon Q",
44
"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.63.0-SNAPSHOT",
5+
"version": "1.67.0-SNAPSHOT",
66
"extensionKind": [
77
"workspace"
88
],

packages/amazonq/src/app/chat/activation.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export async function activate(context: ExtensionContext) {
1818
void amazonq.LspController.instance.trySetupLsp(context, {
1919
startUrl: AuthUtil.instance.startUrl,
2020
maxIndexSize: CodeWhispererSettings.instance.getMaxIndexSize(),
21-
isVectorIndexEnabled: CodeWhispererSettings.instance.isLocalIndexEnabled(),
21+
isVectorIndexEnabled: false,
2222
})
2323
}, 5000)
2424

@@ -30,14 +30,7 @@ export async function activate(context: ExtensionContext) {
3030
amazonq.listCodeWhispererCommandsWalkthrough.register(),
3131
amazonq.focusAmazonQPanel.register(),
3232
amazonq.focusAmazonQPanelKeybinding.register(),
33-
amazonq.tryChatCodeLensCommand.register(),
34-
vscode.workspace.onDidChangeConfiguration(async (configurationChangeEvent) => {
35-
if (configurationChangeEvent.affectsConfiguration('amazonQ.workspaceIndex')) {
36-
if (CodeWhispererSettings.instance.isLocalIndexEnabled()) {
37-
void setupLsp()
38-
}
39-
}
40-
})
33+
amazonq.tryChatCodeLensCommand.register()
4134
)
4235

4336
Commands.register('aws.amazonq.learnMore', () => {

packages/amazonq/src/extension.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
maybeShowMinVscodeWarning,
3434
Experiments,
3535
isSageMaker,
36+
isAmazonInternalOs,
3637
} from 'aws-core-vscode/shared'
3738
import { ExtStartUpSources } from 'aws-core-vscode/telemetry'
3839
import { VSCODE_EXTENSION_ID } from 'aws-core-vscode/utils'
@@ -43,7 +44,7 @@ import { registerCommands } from './commands'
4344
import { focusAmazonQPanel } from 'aws-core-vscode/codewhispererChat'
4445
import { activate as activateAmazonqLsp } from './lsp/activation'
4546
import { activate as activateInlineCompletion } from './app/inline/activation'
46-
import { isAmazonInternalOs } from 'aws-core-vscode/shared'
47+
import { hasGlibcPatch } from './lsp/client'
4748

4849
export const amazonQContextPrefix = 'amazonq'
4950

@@ -122,9 +123,10 @@ export async function activateAmazonQCommon(context: vscode.ExtensionContext, is
122123
await activateCodeWhisperer(extContext as ExtContext)
123124
if (
124125
(Experiments.instance.get('amazonqLSP', true) || Auth.instance.isInternalAmazonUser()) &&
125-
!isAmazonInternalOs()
126+
(!isAmazonInternalOs() || (await hasGlibcPatch()))
126127
) {
127128
// start the Amazon Q LSP for internal users first
129+
// for AL2, start LSP if glibc patch is found
128130
await activateAmazonqLsp(context)
129131
}
130132
if (!Experiments.instance.get('amazonqLSPInline', false)) {

packages/amazonq/src/lsp/auth.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,29 @@ export const notificationTypes = {
6666
* Facade over our VSCode Auth that does crud operations on the language server auth
6767
*/
6868
export class AmazonQLspAuth {
69-
constructor(private readonly client: LanguageClient) {}
69+
#logErrorIfChanged = onceChanged((s) => getLogger('amazonqLsp').error(s))
70+
constructor(
71+
private readonly client: LanguageClient,
72+
private readonly authUtil: AuthUtil = AuthUtil.instance
73+
) {}
7074

7175
/**
7276
* @param force bypass memoization, and forcefully update the bearer token
7377
*/
7478
async refreshConnection(force: boolean = false) {
75-
const activeConnection = AuthUtil.instance.auth.activeConnection
76-
if (activeConnection?.type === 'sso') {
79+
const activeConnection = this.authUtil.auth.activeConnection
80+
if (activeConnection?.state === 'valid' && activeConnection?.type === 'sso') {
7781
// send the token to the language server
78-
const token = await AuthUtil.instance.getBearerToken()
82+
const token = await this.authUtil.getBearerToken()
7983
await (force ? this._updateBearerToken(token) : this.updateBearerToken(token))
8084
}
8185
}
8286

87+
async logRefreshError(e: unknown) {
88+
const err = e as Error
89+
this.#logErrorIfChanged(`Unable to update bearer token: ${err.name}:${err.message}`)
90+
}
91+
8392
public updateBearerToken = onceChanged(this._updateBearerToken.bind(this))
8493
private async _updateBearerToken(token: string) {
8594
const request = await this.createUpdateCredentialsRequest({
@@ -93,10 +102,7 @@ export class AmazonQLspAuth {
93102

94103
public startTokenRefreshInterval(pollingTime: number = oneMinute / 2) {
95104
const interval = setInterval(async () => {
96-
await this.refreshConnection().catch((e) => {
97-
getLogger('amazonqLsp').error('Unable to update bearer token: %s', (e as Error).message)
98-
clearInterval(interval)
99-
})
105+
await this.refreshConnection().catch((e) => this.logRefreshError(e))
100106
}, pollingTime)
101107
return interval
102108
}

packages/amazonq/src/lsp/chat/activation.ts

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ export async function activate(languageClient: LanguageClient, encryptionKey: Bu
8585
type: 'customization',
8686
customization: undefinedIfEmpty(getSelectedCustomization().arn),
8787
})
88+
}),
89+
globals.logOutputChannel.onDidChangeLogLevel((logLevel) => {
90+
getLogger('amazonqLsp').info(`Local log level changed to ${logLevel}, notifying LSP`)
91+
void pushConfigUpdate(languageClient, {
92+
type: 'logLevel',
93+
})
8894
})
8995
)
9096
}
@@ -98,16 +104,24 @@ export async function activate(languageClient: LanguageClient, encryptionKey: Bu
98104
* push the given config.
99105
*/
100106
async function pushConfigUpdate(client: LanguageClient, config: QConfigs) {
101-
if (config.type === 'profile') {
102-
await client.sendRequest(updateConfigurationRequestType.method, {
103-
section: 'aws.q',
104-
settings: { profileArn: config.profileArn },
105-
})
106-
} else if (config.type === 'customization') {
107-
client.sendNotification(DidChangeConfigurationNotification.type.method, {
108-
section: 'aws.q',
109-
settings: { customization: config.customization },
110-
})
107+
switch (config.type) {
108+
case 'profile':
109+
await client.sendRequest(updateConfigurationRequestType.method, {
110+
section: 'aws.q',
111+
settings: { profileArn: config.profileArn },
112+
})
113+
break
114+
case 'customization':
115+
client.sendNotification(DidChangeConfigurationNotification.type.method, {
116+
section: 'aws.q',
117+
settings: { customization: config.customization },
118+
})
119+
break
120+
case 'logLevel':
121+
client.sendNotification(DidChangeConfigurationNotification.type.method, {
122+
section: 'aws.logLevel',
123+
})
124+
break
111125
}
112126
}
113127
type ProfileConfig = {
@@ -118,4 +132,7 @@ type CustomizationConfig = {
118132
type: 'customization'
119133
customization: string | undefined
120134
}
121-
type QConfigs = ProfileConfig | CustomizationConfig
135+
type LogLevelConfig = {
136+
type: 'logLevel'
137+
}
138+
type QConfigs = ProfileConfig | CustomizationConfig | LogLevelConfig

packages/amazonq/src/lsp/chat/commands.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
import { Commands, globals } from 'aws-core-vscode/shared'
77
import { window } from 'vscode'
88
import { AmazonQChatViewProvider } from './webviewProvider'
9+
import { CodeScanIssue } from 'aws-core-vscode/codewhisperer'
10+
import { EditorContextExtractor } from 'aws-core-vscode/codewhispererChat'
11+
import { DefaultAmazonQAppInitContext } from 'aws-core-vscode/amazonq'
912

1013
/**
1114
* TODO: Re-enable these once we can figure out which path they're going to live in
@@ -17,6 +20,52 @@ export function registerCommands(provider: AmazonQChatViewProvider) {
1720
registerGenericCommand('aws.amazonq.refactorCode', 'Refactor', provider),
1821
registerGenericCommand('aws.amazonq.fixCode', 'Fix', provider),
1922
registerGenericCommand('aws.amazonq.optimizeCode', 'Optimize', provider),
23+
Commands.register('aws.amazonq.generateUnitTests', async () => {
24+
DefaultAmazonQAppInitContext.instance.getAppsToWebViewMessagePublisher().publish({
25+
sender: 'testChat',
26+
command: 'test',
27+
type: 'chatMessage',
28+
})
29+
}),
30+
Commands.register('aws.amazonq.explainIssue', async (issue: CodeScanIssue) => {
31+
void focusAmazonQPanel().then(async () => {
32+
const editorContextExtractor = new EditorContextExtractor()
33+
const extractedContext = await editorContextExtractor.extractContextForTrigger('ContextMenu')
34+
const selectedCode =
35+
extractedContext?.activeFileContext?.fileText
36+
?.split('\n')
37+
.slice(issue.startLine, issue.endLine)
38+
.join('\n') ?? ''
39+
40+
// The message that gets sent to the UI
41+
const uiMessage = [
42+
'Explain the ',
43+
issue.title,
44+
' issue in the following code:',
45+
'\n```\n',
46+
selectedCode,
47+
'\n```',
48+
].join('')
49+
50+
// The message that gets sent to the backend
51+
const contextMessage = `Explain the issue "${issue.title}" (${JSON.stringify(
52+
issue
53+
)}) and generate code demonstrating the fix`
54+
55+
void provider.webview?.postMessage({
56+
command: 'sendToPrompt',
57+
params: {
58+
selection: '',
59+
triggerType: 'contextMenu',
60+
prompt: {
61+
prompt: uiMessage, // what gets sent to the user
62+
escapedPrompt: contextMessage, // what gets sent to the backend
63+
},
64+
autoSubmit: true,
65+
},
66+
})
67+
})
68+
}),
2069
Commands.register('aws.amazonq.sendToPrompt', (data) => {
2170
const triggerType = getCommandTriggerType(data)
2271
const selection = getSelectedText()

0 commit comments

Comments
 (0)