Skip to content

Commit 8cbb73c

Browse files
committed
feat: add configuration cache dir for users
1 parent e8ed448 commit 8cbb73c

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/settings/CodeWhispererConfigurable.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,20 @@ class CodeWhispererConfigurable(private val project: Project) :
198198
}.comment(message("aws.settings.codewhisperer.project_context.tooltip"))
199199
}
200200

201+
row(message("aws.settings.codewhisperer.project_context_cache_dir")) {
202+
val fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor()
203+
fileChooserDescriptor.isForcedToUseIdeaFileChooser = true
204+
205+
textFieldWithBrowseButton(fileChooserDescriptor = fileChooserDescriptor)
206+
.bindText(
207+
{ codeWhispererSettings.getProjectContextCacheDir() },
208+
{ codeWhispererSettings.setProjectContextCacheDir(it) }
209+
)
210+
.resizableColumn()
211+
.align(Align.FILL)
212+
.comment(message("aws.settings.codewhisperer.project_context_cache_dir.tooltip"))
213+
}
214+
201215
row(message("aws.settings.codewhisperer.project_context_index_thread")) {
202216
intTextField(
203217
range = CodeWhispererSettings.CONTEXT_INDEX_THREADS

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLanguageClientImpl.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageC
382382
indexWorkerThreads = qSettings.getProjectContextIndexThreadCount(),
383383
enableGpuAcceleration = qSettings.isProjectContextGpu(),
384384
localIndexing = LocalIndexingConfiguration(
385-
maxIndexSizeMB = qSettings.getProjectContextIndexMaxSize()
385+
maxIndexSizeMB = qSettings.getProjectContextIndexMaxSize(),
386+
indexCacheDirPath = qSettings.getProjectContextCacheDir()
386387
)
387388
)
388389
)

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/settings/CodeWhispererSettings.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ class CodeWhispererSettings : PersistentStateComponent<CodeWhispererConfiguratio
9494
state.value[CodeWhispererConfigurationType.IsProjectContextGpu] = value
9595
}
9696

97+
fun getProjectContextCacheDir(): String = state.stringValue.getOrDefault(
98+
CodeWhispererStringConfigurationType.ProjectContextCacheDir,
99+
""
100+
)
101+
102+
fun setProjectContextCacheDir(value: String) {
103+
state.stringValue[CodeWhispererStringConfigurationType.ProjectContextCacheDir] = value
104+
}
105+
97106
fun getProjectContextIndexThreadCount(): Int = state.intValue.getOrDefault(
98107
CodeWhispererIntConfigurationType.ProjectContextIndexThreadCount,
99108
0
@@ -196,6 +205,7 @@ enum class CodeWhispererConfigurationType {
196205

197206
enum class CodeWhispererStringConfigurationType {
198207
IgnoredCodeReviewIssues,
208+
ProjectContextCacheDir,
199209
}
200210

201211
enum class CodeWhispererIntConfigurationType {

plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ aws.settings.codewhisperer.include_code_with_reference=Include suggestions with
294294
aws.settings.codewhisperer.include_code_with_reference.tooltip=When checked, Amazon Q will include suggestions with code references. If you authenticate through IAM Identity Center, this setting is controlled by your Amazon Q Developer Pro administrator. <a href="https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/code-reference.html">Learn more<a/>
295295
aws.settings.codewhisperer.project_context=Workspace index
296296
aws.settings.codewhisperer.project_context.tooltip=When you add @workspace to your questions 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 below.
297+
aws.settings.codewhisperer.project_context_cache_dir=Workspace Index Cache Dir Path
298+
aws.settings.codewhisperer.project_context_cache_dir.tooltip=The path to the directory that contains the cache of the index of your workspace files
297299
aws.settings.codewhisperer.project_context_gpu=Workspace index uses GPU
298300
aws.settings.codewhisperer.project_context_gpu.tooltip=Enable GPU to help index your local workspace files. This setting only applies to Linux and Windows.
299301
aws.settings.codewhisperer.project_context_index_max_size=Workspace index max size

0 commit comments

Comments
 (0)