Skip to content

Commit 1d336f1

Browse files
aws-toolkit-automationctlai95jpinkney-awsnkomonen-amazonakhamis-amzn
authored
Merge master into feature/amazonqLSP-auth (#7309)
## Automatic merge failed - Resolve conflicts and push to this PR branch. - **Do not squash-merge** this PR. Use the "Create a merge commit" option to do a regular merge. ## Command line hint To perform the merge from the command line, you could do something like the following (where "origin" is the name of the remote in your local git repo): ``` git stash git fetch --all git checkout origin/feature/amazonqLSP-auth git merge origin/master git commit git push origin HEAD:refs/heads/autoMerge/feature/amazonqLSP-auth ``` --------- Signed-off-by: nkomonen-amazon <nkomonen@amazon.com> Co-authored-by: aws-toolkit-automation <> Co-authored-by: Tai Lai <ctlai95@gmail.com> Co-authored-by: Josh Pinkney <103940141+jpinkney-aws@users.noreply.github.com> Co-authored-by: Nikolas Komonen <118216176+nkomonen-amazon@users.noreply.github.com> Co-authored-by: Adam Khamis <110852798+akhamis-amzn@users.noreply.github.com> Co-authored-by: Na Yue <yueny@amazon.com> Co-authored-by: Laxman Reddy <141967714+laileni-aws@users.noreply.github.com> Co-authored-by: Jiatong Li <lijiatong1997@outlook.com> Co-authored-by: Avi Alpert <131792194+avi-alpert@users.noreply.github.com> Co-authored-by: Brad Skaggs <126105424+brdskggs@users.noreply.github.com> Co-authored-by: Zoe Lin <60411978+zixlin7@users.noreply.github.com> Co-authored-by: chungjac <chungjac@amazon.com> Co-authored-by: Lei Gao <97199248+leigaol@users.noreply.github.com> Co-authored-by: Will Lo <96078566+Will-ShaoHua@users.noreply.github.com> Co-authored-by: invictus <149003065+ashishrp-aws@users.noreply.github.com> Co-authored-by: opieter-aws <opieter@amazon.com>
1 parent 8f0d76a commit 1d336f1

26 files changed

+465
-1504
lines changed

CONTRIBUTING.md

+3
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,9 @@ If you need to report an issue attach these to give the most detailed informatio
387387
4. Open the Command Palette again and select `Reload Window`.
388388
5. Now you should see additional `[debug]` prefixed logs in the output.
389389
- ![](./docs/images/logsDebugLog.png)
390+
6. To export logs, click the kebab (`...`), select `Export Logs`, and then select the appropriate channel (`Amazon Q Logs` for Amazon Q)
391+
- ![](./docs/images/openExportLogs.png)
392+
- ![](./docs/images/exportAmazonQLogs.png)
390393
391394
### Telemetry
392395

docs/images/exportAmazonQLogs.png

114 KB
Loading

docs/images/openExportLogs.png

108 KB
Loading

package-lock.json

+361-1,454
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
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.318",
44+
"@aws-toolkits/telemetry": "^1.0.322",
4545
"@playwright/browser-chromium": "^1.43.1",
4646
"@stylistic/eslint-plugin": "^2.11.0",
4747
"@types/he": "^1.2.3",

packages/amazonq/.changes/1.67.0.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"date": "2025-05-14",
3+
"version": "1.67.0",
4+
"entries": [
5+
{
6+
"type": "Bug Fix",
7+
"description": "Previous and subsequent cells are used as context for completion in a Jupyter notebook"
8+
},
9+
{
10+
"type": "Bug Fix",
11+
"description": "Support chat in AL2 aarch64"
12+
}
13+
]
14+
}
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+
}
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+
}
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+
}

packages/amazonq/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.67.0 2025-05-14
2+
3+
- **Bug Fix** Previous and subsequent cells are used as context for completion in a Jupyter notebook
4+
- **Bug Fix** Support chat in AL2 aarch64
5+
16
## 1.66.0 2025-05-09
27

38
- **Bug Fix** Avoid inline completion 'Improperly formed request' errors when file is too large

packages/amazonq/package.json

+1-1
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.67.0-SNAPSHOT",
5+
"version": "1.68.0-SNAPSHOT",
66
"extensionKind": [
77
"workspace"
88
],

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

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ import {
3232
getSerializedChatRequestType,
3333
listConversationsRequestType,
3434
conversationClickRequestType,
35+
listMcpServersRequestType,
36+
mcpServerClickRequestType,
3537
ShowSaveFileDialogRequestType,
3638
ShowSaveFileDialogParams,
3739
LSPErrorCodes,
@@ -310,6 +312,8 @@ export function registerMessageListeners(
310312
}
311313
case listConversationsRequestType.method:
312314
case conversationClickRequestType.method:
315+
case listMcpServersRequestType.method:
316+
case mcpServerClickRequestType.method:
313317
case tabBarActionRequestType.method:
314318
await resolveChatResponse(message.command, message.params, languageClient, webview)
315319
break

packages/amazonq/src/lsp/client.ts

+11-14
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
GetConfigurationFromServerParams,
1818
RenameFilesParams,
1919
ResponseMessage,
20-
updateConfigurationRequestType,
2120
WorkspaceFolder,
2221
GetSsoTokenProgress,
2322
GetSsoTokenProgressToken,
@@ -31,6 +30,7 @@ import {
3130
ShowDocumentResult,
3231
ResponseError,
3332
LSPErrorCodes,
33+
updateConfigurationRequestType,
3434
} from '@aws/language-server-runtimes/protocol'
3535
import { AuthUtil, CodeWhispererSettings, getSelectedCustomization } from 'aws-core-vscode/codewhisperer'
3636
import {
@@ -43,8 +43,7 @@ import {
4343
getLogger,
4444
undefinedIfEmpty,
4545
getOptOutPreference,
46-
isAmazonInternalOs,
47-
fs,
46+
isAmazonLinux2,
4847
oidcClientName,
4948
openUrl,
5049
getClientId,
@@ -60,14 +59,16 @@ import { telemetry } from 'aws-core-vscode/telemetry'
6059
const localize = nls.loadMessageBundle()
6160
const logger = getLogger('amazonqLsp.lspClient')
6261

62+
export const glibcLinker: string = process.env.VSCODE_SERVER_CUSTOM_GLIBC_LINKER || ''
63+
export const glibcPath: string = process.env.VSCODE_SERVER_CUSTOM_GLIBC_PATH || ''
64+
export function hasGlibcPatch(): boolean {
65+
return glibcLinker.length > 0 && glibcPath.length > 0
66+
}
67+
6368
export const clientId = 'amazonq'
6469
export const clientName = oidcClientName()
6570
export const encryptionKey = crypto.randomBytes(32)
6671

67-
export async function hasGlibcPatch(): Promise<boolean> {
68-
return await fs.exists('/opt/vsc-sysroot/lib64/ld-linux-x86-64.so.2')
69-
}
70-
7172
export async function startLanguageServer(
7273
extensionContext: vscode.ExtensionContext,
7374
resourcePaths: AmazonQResourcePaths
@@ -88,13 +89,8 @@ export async function startLanguageServer(
8889
const traceServerEnabled = Settings.instance.isSet(`${clientId}.trace.server`)
8990
let executable: string[] = []
9091
// apply the GLIBC 2.28 path to node js runtime binary
91-
if (isAmazonInternalOs() && (await hasGlibcPatch())) {
92-
executable = [
93-
'/opt/vsc-sysroot/lib64/ld-linux-x86-64.so.2',
94-
'--library-path',
95-
'/opt/vsc-sysroot/lib64',
96-
resourcePaths.node,
97-
]
92+
if (isAmazonLinux2() && hasGlibcPatch()) {
93+
executable = [glibcLinker, '--library-path', glibcPath, resourcePaths.node]
9894
getLogger('amazonqLsp').info(`Patched node runtime with GLIBC to ${executable}`)
9995
} else {
10096
executable = [resourcePaths.node]
@@ -177,6 +173,7 @@ export async function startLanguageServer(
177173

178174
const disposable = client.start()
179175
toDispose.push(disposable)
176+
await client.onReady()
180177

181178
await client.onReady()
182179

packages/amazonq/test/unit/codewhisperer/util/runtimeLanguageContext.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ describe('runtimeLanguageContext', function () {
177177
'jsx',
178178
'kotlin',
179179
'php',
180-
'plaintext',
181180
'python',
182181
'ruby',
183182
'rust',
@@ -288,7 +287,6 @@ describe('runtimeLanguageContext', function () {
288287
['jsx', 'jsx'],
289288
['kotlin', 'kt'],
290289
['php', 'php'],
291-
['plaintext', 'txt'],
292290
['python', 'py'],
293291
['ruby', 'rb'],
294292
['rust', 'rs'],

packages/core/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@
443443
"@aws-sdk/types": "^3.13.1",
444444
"@aws/chat-client": "^0.1.4",
445445
"@aws/chat-client-ui-types": "^0.1.24",
446-
"@aws/language-server-runtimes": "^0.2.70",
447-
"@aws/language-server-runtimes-types": "^0.1.26",
446+
"@aws/language-server-runtimes": "^0.2.81",
447+
"@aws/language-server-runtimes-types": "^0.1.28",
448448
"@cspotcode/source-map-support": "^0.8.1",
449449
"@sinonjs/fake-timers": "^10.0.2",
450450
"@types/adm-zip": "^0.4.34",

packages/core/src/amazonq/lsp/lspController.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { activate as activateLsp, LspClient } from './lspClient'
1111
import { telemetry } from '../../shared/telemetry/telemetry'
1212
import { isCloud9 } from '../../shared/extensionUtilities'
1313
import globals, { isWeb } from '../../shared/extensionGlobals'
14-
import { isAmazonInternalOs } from '../../shared/vscode/env'
14+
import { isAmazonLinux2 } from '../../shared/vscode/env'
1515
import { WorkspaceLspInstaller } from './workspaceInstaller'
1616
import { lspSetupStage } from '../../shared/lsp/utils/setupStage'
1717
import { RelevantTextDocumentAddition } from '../../codewhispererChat/controllers/chat/model'
@@ -165,7 +165,7 @@ export class LspController {
165165
}
166166

167167
async trySetupLsp(context: vscode.ExtensionContext, buildIndexConfig: BuildIndexConfig) {
168-
if (isCloud9() || isWeb() || isAmazonInternalOs()) {
168+
if (isCloud9() || isWeb() || isAmazonLinux2()) {
169169
this.logger.warn('Skipping LSP setup. LSP is not compatible with the current environment. ')
170170
// do not do anything if in Cloud9 or Web mode or in AL2 (AL2 does not support node v18+)
171171
return

packages/core/src/auth/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export {
1818
isBuilderIdConnection,
1919
getTelemetryMetadataForConn,
2020
isIamConnection,
21+
isSsoConnection,
2122
} from './connection'
2223
export { Auth } from './auth'
2324
export { CredentialsStore } from './credentials/store'

packages/core/src/codewhisperer/util/editorContext.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ export function extractContextForCodeWhisperer(editor: vscode.TextEditor): codew
151151
)
152152
let languageName = 'plaintext'
153153
if (!checkLeftContextKeywordsForJson(document.fileName, caretLeftFileContext, editor.document.languageId)) {
154-
languageName =
155-
runtimeLanguageContext.normalizeLanguage(editor.document.languageId) ?? editor.document.languageId
154+
languageName = runtimeLanguageContext.resolveLang(editor.document)
156155
}
157156
if (editor.document.uri.scheme === 'vscode-notebook-cell') {
158157
const notebook = getEnclosingNotebook(editor)

packages/core/src/codewhisperer/util/runtimeLanguageContext.ts

+21-4
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class RuntimeLanguageContext {
6767

6868
constructor() {
6969
this.supportedLanguageMap = createConstantMap<
70-
CodeWhispererConstants.PlatformLanguageId | CodewhispererLanguage,
70+
Exclude<CodeWhispererConstants.PlatformLanguageId | CodewhispererLanguage, 'plaintext'>,
7171
CodewhispererLanguage
7272
>({
7373
c: 'c',
@@ -85,7 +85,6 @@ export class RuntimeLanguageContext {
8585
jsx: 'jsx',
8686
kotlin: 'kotlin',
8787
packer: 'tf',
88-
plaintext: 'plaintext',
8988
php: 'php',
9089
python: 'python',
9190
ruby: 'ruby',
@@ -112,6 +111,7 @@ export class RuntimeLanguageContext {
112111
systemverilog: 'systemVerilog',
113112
verilog: 'systemVerilog',
114113
vue: 'vue',
114+
abap: 'abap',
115115
})
116116
this.supportedLanguageExtensionMap = createConstantMap<string, CodewhispererLanguage>({
117117
c: 'c',
@@ -152,6 +152,8 @@ export class RuntimeLanguageContext {
152152
ps1: 'powershell',
153153
psm1: 'powershell',
154154
r: 'r',
155+
abap: 'abap',
156+
acds: 'abap',
155157
})
156158
this.languageSingleLineCommentPrefixMap = createConstantMap<CodewhispererLanguage, string>({
157159
c: '// ',
@@ -185,9 +187,14 @@ export class RuntimeLanguageContext {
185187
vue: '', // vue lacks a single-line comment prefix
186188
yaml: '# ',
187189
yml: '# ',
190+
abap: '',
188191
})
189192
}
190193

194+
public resolveLang(doc: vscode.TextDocument): CodewhispererLanguage {
195+
return this.normalizeLanguage(doc.languageId) || this.byFileExt(doc) || 'plaintext'
196+
}
197+
191198
/**
192199
* To add a new platform language id:
193200
* 1. add new platform language ID constant in the file codewhisperer/constant.ts
@@ -317,8 +324,7 @@ export class RuntimeLanguageContext {
317324
} else {
318325
const normalizedLanguageId = this.normalizeLanguage(arg.languageId)
319326
const byLanguageId = !normalizedLanguageId || normalizedLanguageId === 'plaintext' ? false : true
320-
const extension = path.extname(arg.uri.fsPath)
321-
const byFileExtension = this.isFileFormatSupported(extension.substring(1))
327+
const byFileExtension = this.byFileExt(arg) !== undefined
322328

323329
return byLanguageId || byFileExtension
324330
}
@@ -341,6 +347,17 @@ export class RuntimeLanguageContext {
341347
public getLanguageFromFileExtension(fileExtension: string) {
342348
return this.supportedLanguageExtensionMap.get(fileExtension)
343349
}
350+
351+
private byFileExt(doc: vscode.TextDocument): CodewhispererLanguage | undefined {
352+
const extension = path.extname(doc.uri.fsPath)
353+
const byExt = this.supportedLanguageExtensionMap.get(extension.substring(1))
354+
355+
if (byExt === 'plaintext') {
356+
return undefined
357+
}
358+
359+
return byExt
360+
}
344361
}
345362

346363
export const runtimeLanguageContext = new RuntimeLanguageContext()

packages/core/src/shared/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export * from './extensionUtilities'
1818
export * from './extensionStartup'
1919
export { RegionProvider } from './regions/regionProvider'
2020
export { Commands } from './vscode/commands2'
21-
export { getMachineId, getServiceEnvVarConfig, isAmazonInternalOs } from './vscode/env'
21+
export { getMachineId, getServiceEnvVarConfig, isAmazonLinux2 } from './vscode/env'
2222
export { getLogger } from './logger/logger'
2323
export { activateExtension, openUrl } from './utilities/vsCodeUtils'
2424
export { waitUntil, sleep, Timeout } from './utilities/timeoutUtils'

packages/core/src/shared/telemetry/util.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
isAutomation,
1616
isRemoteWorkspace,
1717
isCloudDesktop,
18-
isAmazonInternalOs,
18+
isAmazonLinux2,
1919
} from '../vscode/env'
2020
import { addTypeName } from '../utilities/typeConstructors'
2121
import globals, { isWeb } from '../extensionGlobals'
@@ -290,7 +290,7 @@ export async function getComputeEnvType(): Promise<EnvType> {
290290
} else if (isSageMaker()) {
291291
return web ? 'sagemaker-web' : 'sagemaker'
292292
} else if (isRemoteWorkspace()) {
293-
if (isAmazonInternalOs()) {
293+
if (isAmazonLinux2()) {
294294
if (await isCloudDesktop()) {
295295
return 'cloudDesktop-amzn'
296296
}

packages/core/src/shared/vscode/env.ts

+6-8
Original file line numberDiff line numberDiff line change
@@ -125,23 +125,21 @@ export function isRemoteWorkspace(): boolean {
125125
}
126126

127127
/**
128-
* There is Amazon Linux 2, but additionally an Amazon Linux 2 Internal.
129-
* The internal version is for Amazon employees only. And this version can
130-
* be used by either EC2 OR CloudDesktop. It is not exclusive to either.
128+
* There is Amazon Linux 2.
131129
*
132-
* Use {@link isCloudDesktop()} to know if we are specifically using it.
130+
* Use {@link isCloudDesktop()} to know if we are specifically using internal Amazon Linux 2.
133131
*
134-
* Example: `5.10.220-188.869.amzn2int.x86_64`
132+
* Example: `5.10.220-188.869.amzn2int.x86_64` or `5.10.236-227.928.amzn2.x86_64` (Cloud Dev Machine)
135133
*/
136-
export function isAmazonInternalOs() {
137-
return os.release().includes('amzn2int') && process.platform === 'linux'
134+
export function isAmazonLinux2() {
135+
return (os.release().includes('.amzn2int.') || os.release().includes('.amzn2.')) && process.platform === 'linux'
138136
}
139137

140138
/**
141139
* Returns true if we are in an internal Amazon Cloud Desktop
142140
*/
143141
export async function isCloudDesktop() {
144-
if (!isAmazonInternalOs()) {
142+
if (!isAmazonLinux2()) {
145143
return false
146144
}
147145

packages/core/src/test/shared/vscode/env.test.ts

+7-10
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@
55

66
import assert from 'assert'
77
import path from 'path'
8-
import {
9-
isCloudDesktop,
10-
getEnvVars,
11-
getServiceEnvVarConfig,
12-
isAmazonInternalOs as isAmazonInternalOS,
13-
isBeta,
14-
} from '../../../shared/vscode/env'
8+
import { isCloudDesktop, getEnvVars, getServiceEnvVarConfig, isAmazonLinux2, isBeta } from '../../../shared/vscode/env'
159
import { ChildProcess } from '../../../shared/utilities/processUtils'
1610
import * as sinon from 'sinon'
1711
import os from 'os'
@@ -103,13 +97,16 @@ describe('env', function () {
10397
assert.strictEqual(isBeta(), expected)
10498
})
10599

106-
it('isAmazonInternalOS', function () {
100+
it('isAmazonLinux2', function () {
107101
sandbox.stub(process, 'platform').value('linux')
108102
const versionStub = stubOsVersion('5.10.220-188.869.amzn2int.x86_64')
109-
assert.strictEqual(isAmazonInternalOS(), true)
103+
assert.strictEqual(isAmazonLinux2(), true)
104+
105+
versionStub.returns('5.10.236-227.928.amzn2.x86_64')
106+
assert.strictEqual(isAmazonLinux2(), true)
110107

111108
versionStub.returns('5.10.220-188.869.NOT_INTERNAL.x86_64')
112-
assert.strictEqual(isAmazonInternalOS(), false)
109+
assert.strictEqual(isAmazonLinux2(), false)
113110
})
114111

115112
it('isCloudDesktop', async function () {

packages/toolkit/.changes/3.61.0.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"date": "2025-05-14",
3+
"version": "3.61.0",
4+
"entries": []
5+
}

0 commit comments

Comments
 (0)