Skip to content

Commit 382a94e

Browse files
committed
feat(amazonq): Pass project configuration to LSP client
1 parent f4b1634 commit 382a94e

File tree

5 files changed

+49
-3
lines changed

5 files changed

+49
-3
lines changed

packages/amazonq/package.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,25 @@
181181
"amazonQ.workspaceIndexMaxSize": {
182182
"type": "number",
183183
"markdownDescription": "%AWS.configuration.description.amazonq.workspaceIndexMaxSize%",
184-
"default": 250,
184+
"default": 2048,
185+
"scope": "application"
186+
},
187+
"amazonQ.workspaceIndexMaxFileSize": {
188+
"type": "number",
189+
"markdownDescription": "%AWS.configuration.description.amazonq.workspaceIndexMaxFileSize%",
190+
"default": 10,
191+
"scope": "application"
192+
},
193+
"amazonQ.workspaceIndexCacheDirPath": {
194+
"type": "string",
195+
"markdownDescription": "%AWS.configuration.description.amazonq.workspaceIndexCacheDirPath%",
196+
"default": null,
197+
"scope": "application"
198+
},
199+
"amazonQ.workspaceIndexIgnoreFilePatterns": {
200+
"type": "array",
201+
"markdownDescription": "%AWS.configuration.description.amazonq.workspaceIndexIgnoreFilePatterns%",
202+
"default": [],
185203
"scope": "application"
186204
},
187205
"amazonQ.ignoredSecurityIssues": {

packages/amazonq/src/lsp/client.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ export async function startLanguageServer(
9595
enableLocalIndexing: CodeWhispererSettings.instance.isLocalIndexEnabled(),
9696
enableGpuAcceleration: CodeWhispererSettings.instance.isLocalIndexGPUEnabled(),
9797
indexWorkerThreads: CodeWhispererSettings.instance.getIndexWorkerThreads(),
98+
localIndexing: {
99+
ignoreFilePatterns: CodeWhispererSettings.instance.getIndexIgnoreFilePatterns(),
100+
maxFileSizeMB: CodeWhispererSettings.instance.getMaxIndexFileSize(),
101+
maxIndexSizeMB: CodeWhispererSettings.instance.getMaxIndexSize(),
102+
indexCacheDirPath: CodeWhispererSettings.instance.getIndexCacheDirPath(),
103+
},
98104
},
99105
},
100106
]

packages/core/package.nls.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@
9393
"AWS.configuration.description.amazonq.workspaceIndex": "When you add @workspace to your question in Amazon Q chat, Amazon Q will index your workspace files locally to use as context for its response. Extra CPU usage is expected while indexing a workspace. This will not impact Amazon Q features or your IDE, but you may manage CPU usage by setting the number of local threads in 'Local Workspace Index Threads'.",
9494
"AWS.configuration.description.amazonq.workspaceIndexWorkerThreads": "Number of worker threads of Amazon Q local index process. '0' will use the system default worker threads for balance performance. You may increase this number to more quickly index your workspace, but only up to your hardware's number of CPU cores. Please restart VS Code or reload the VS Code window after changing worker threads.",
9595
"AWS.configuration.description.amazonq.workspaceIndexUseGPU": "Enable GPU to help index your local workspace files. Only applies to Linux and Windows.",
96-
"AWS.configuration.description.amazonq.workspaceIndexMaxSize": "The maximum size of local workspace files to be indexed in MB",
96+
"AWS.configuration.description.amazonq.workspaceIndexMaxSize": "The maximum size of local workspace to be indexed in MB",
97+
"AWS.configuration.description.amazonq.workspaceIndexMaxFileSize": "The maximum size of local workspace files to be indexed in MB",
98+
"AWS.configuration.description.amazonq.workspaceIndexIgnoreFilePatterns": "File patterns to ignore when indexing your workspace files",
99+
"AWS.configuration.description.amazonq.workspaceIndexCacheDirPath": "The path to the directory that contains the cache of the index of your workspace files",
97100
"AWS.configuration.description.amazonq.ignoredSecurityIssues": "Specifies a list of code issue identifiers that Amazon Q should ignore when reviewing your workspace. Each item in the array should be a unique string identifier for a specific code issue. This allows you to suppress notifications for known issues that you've assessed and determined to be false positives or not applicable to your project. Use this setting with caution, as it may cause you to miss important security alerts.",
98101
"AWS.command.apig.copyUrl": "Copy URL",
99102
"AWS.command.apig.invokeRemoteRestApi": "Invoke in the cloud",

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ const description = {
1313
workspaceIndexWorkerThreads: Number,
1414
workspaceIndexUseGPU: Boolean,
1515
workspaceIndexMaxSize: Number,
16+
workspaceIndexMaxFileSize: Number,
17+
workspaceIndexCacheDirPath: String,
18+
workspaceIndexIgnoreFilePatterns: ArrayConstructor(String),
1619
allowFeatureDevelopmentToRunCodeAndTests: Object,
1720
ignoredSecurityIssues: ArrayConstructor(String),
1821
}
@@ -55,7 +58,20 @@ export class CodeWhispererSettings extends fromExtensionManifest('amazonQ', desc
5558

5659
public getMaxIndexSize(): number {
5760
// minimal 1MB
58-
return Math.max(this.get('workspaceIndexMaxSize', 250), 1)
61+
return Math.max(this.get('workspaceIndexMaxSize', 2048), 1)
62+
}
63+
64+
public getMaxIndexFileSize(): number {
65+
// minimal 1MB
66+
return Math.max(this.get('workspaceIndexMaxFileSize', 10), 1)
67+
}
68+
69+
public getIndexCacheDirPath(): string {
70+
return this.get('workspaceIndexCacheDirPath', undefined)
71+
}
72+
73+
public getIndexIgnoreFilePatterns(): string[] {
74+
return this.get('workspaceIndexIgnoreFilePatterns', [])
5975
}
6076

6177
public getAutoBuildSetting(): { [key: string]: boolean } {

packages/core/src/shared/settings-amazonq.gen.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ export const amazonqSettings = {
3232
"amazonQ.workspaceIndexWorkerThreads": {},
3333
"amazonQ.workspaceIndexUseGPU": {},
3434
"amazonQ.workspaceIndexMaxSize": {},
35+
"amazonQ.workspaceIndexMaxFileSize": {},
36+
"amazonQ.workspaceIndexCacheDirPath": {},
37+
"amazonQ.workspaceIndexIgnoreFilePatterns": {},
3538
"amazonQ.ignoredSecurityIssues": {}
3639
}
3740

0 commit comments

Comments
 (0)