From 8c27bd1e58fbbc8a99154134ce007aee03937d58 Mon Sep 17 00:00:00 2001 From: Aseem Sharma Date: Tue, 16 Jun 2026 15:35:06 -0700 Subject: [PATCH] fix(amazonq): restrict aws.dev.amazonqLsp to machine scope Declare the aws.dev.amazonqLsp developer setting in the extension manifest with "scope": "machine" so it is only configurable at the user/machine level and not via workspace settings. Adds a test asserting the scope declaration. --- packages/amazonq/package.json | 6 ++++++ .../test/unit/amazonq/lsp/config.test.ts | 20 +++++++++++++++++++ .../core/src/shared/settings-amazonq.gen.ts | 3 ++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/packages/amazonq/package.json b/packages/amazonq/package.json index b626b3adb3..ef0e75a61c 100644 --- a/packages/amazonq/package.json +++ b/packages/amazonq/package.json @@ -195,6 +195,12 @@ "type": "boolean", "markdownDescription": "%AWS.configuration.description.amazonq.proxy.enableProxyAndCertificateAutoDiscovery%", "default": true + }, + "aws.dev.amazonqLsp": { + "type": "object", + "scope": "machine", + "default": {}, + "markdownDescription": "Developer use only" } } }, diff --git a/packages/amazonq/test/unit/amazonq/lsp/config.test.ts b/packages/amazonq/test/unit/amazonq/lsp/config.test.ts index c31e873e18..879f6acc22 100644 --- a/packages/amazonq/test/unit/amazonq/lsp/config.test.ts +++ b/packages/amazonq/test/unit/amazonq/lsp/config.test.ts @@ -225,3 +225,23 @@ describe('pushConfigUpdate', () => { ) }) }) + +describe('aws.dev.amazonqLsp configuration scope', () => { + // The `aws.dev.amazonqLsp` developer setting must be declared with `machine` scope + // so that it is only configurable at the user/machine level and not by a workspace. + // eslint-disable-next-line @typescript-eslint/no-var-requires + const pkg = require('../../../../package.json') + + it('is declared in contributes.configuration', () => { + const properties = pkg.contributes.configuration.properties + assert.ok( + properties['aws.dev.amazonqLsp'], + 'aws.dev.amazonqLsp must be declared in package.json contributes.configuration' + ) + }) + + it('uses machine scope so it is not workspace-configurable', () => { + const entry = pkg.contributes.configuration.properties['aws.dev.amazonqLsp'] + assert.strictEqual(entry.scope, 'machine', 'aws.dev.amazonqLsp must be machine-scoped') + }) +}) diff --git a/packages/core/src/shared/settings-amazonq.gen.ts b/packages/core/src/shared/settings-amazonq.gen.ts index fcc13d94fd..0bcf5e95c2 100644 --- a/packages/core/src/shared/settings-amazonq.gen.ts +++ b/packages/core/src/shared/settings-amazonq.gen.ts @@ -33,7 +33,8 @@ export const amazonqSettings = { "amazonQ.workspaceIndexIgnoreFilePatterns": {}, "amazonQ.ignoredSecurityIssues": {}, "amazonQ.proxy.certificateAuthority": {}, - "amazonQ.proxy.enableProxyAndCertificateAutoDiscovery": {} + "amazonQ.proxy.enableProxyAndCertificateAutoDiscovery": {}, + "aws.dev.amazonqLsp": {} } export default amazonqSettings