Skip to content

Commit e137edf

Browse files
committed
feat: added dev override for registry URL
1 parent 999b24a commit e137edf

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

packages/amazonq/src/lsp/activation.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,29 @@ import vscode from 'vscode'
77
import { startLanguageServer } from './client'
88
import { AmazonQLspInstaller, getBundledResourcePaths } from './lspInstaller'
99
import { lspSetupStage, ToolkitError, messages, getLogger } from 'aws-core-vscode/shared'
10+
import { getAmazonQLspConfig } from './config'
1011

1112
export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
13+
const config = getAmazonQLspConfig()
14+
const registryUrl = config.registryUrl
15+
1216
try {
1317
await lspSetupStage('all', async () => {
1418
const installResult = await new AmazonQLspInstaller().resolve()
15-
await lspSetupStage('launch', async () => await startLanguageServer(ctx, installResult.resourcePaths))
19+
await lspSetupStage(
20+
'launch',
21+
async () => await startLanguageServer(ctx, installResult.resourcePaths, registryUrl)
22+
)
1623
})
1724
} catch (err) {
1825
const e = err as ToolkitError
1926
getLogger('amazonqLsp').warn(`Failed to start downloaded LSP, falling back to bundled LSP: ${e.message}`)
2027
try {
2128
await lspSetupStage('all', async () => {
22-
await lspSetupStage('launch', async () => await startLanguageServer(ctx, getBundledResourcePaths(ctx)))
29+
await lspSetupStage(
30+
'launch',
31+
async () => await startLanguageServer(ctx, getBundledResourcePaths(ctx), registryUrl)
32+
)
2333
})
2434
} catch (error) {
2535
void messages.showViewLogsMessage(

packages/amazonq/src/lsp/client.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ export function hasGlibcPatch(): boolean {
8383

8484
export async function startLanguageServer(
8585
extensionContext: vscode.ExtensionContext,
86-
resourcePaths: AmazonQResourcePaths
86+
resourcePaths: AmazonQResourcePaths,
87+
registryUrl?: string
8788
) {
8889
const toDispose = extensionContext.subscriptions
8990

@@ -188,6 +189,7 @@ export async function startLanguageServer(
188189
codeReviewInChat: codeReviewInChat,
189190
// feature flag for displaying findings found not through CodeReview in the Code Issues Panel
190191
displayFindings: true,
192+
registryUrl: registryUrl,
191193
},
192194
window: {
193195
notifications: true,

packages/amazonq/src/lsp/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212

1313
export interface ExtendedAmazonQLSPConfig extends BaseLspInstaller.LspConfig {
1414
ui?: string
15+
registryUrl?: string
1516
}
1617

1718
// Taken from language server runtimes since they are not exported:
@@ -44,10 +45,12 @@ export const defaultAmazonQLspConfig: ExtendedAmazonQLSPConfig = {
4445
}
4546

4647
export function getAmazonQLspConfig(): ExtendedAmazonQLSPConfig {
48+
const registryConfig = DevSettings.instance.get('amazonqRegistry', {})
4749
return {
4850
...defaultAmazonQLspConfig,
4951
...(DevSettings.instance.getServiceConfig('amazonqLsp', {}) as ExtendedAmazonQLSPConfig),
5052
...getServiceEnvVarConfig('amazonqLsp', Object.keys(defaultAmazonQLspConfig)),
53+
registryUrl: (registryConfig as any)?.registryUrl,
5154
}
5255
}
5356
/**

packages/core/src/shared/settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,7 @@ const devSettings = {
778778
codewhispererService: Record(String, String),
779779
amazonqLsp: Record(String, String),
780780
amazonqWorkspaceLsp: Record(String, String),
781+
amazonqRegistry: Record(String, String),
781782
ssoCacheDirectory: String,
782783
autofillStartUrl: String,
783784
webAuth: Boolean,

0 commit comments

Comments
 (0)