From 8cbb73ce02c72765a63e24a636198fe1d48c5705 Mon Sep 17 00:00:00 2001 From: Sherry Lu Date: Tue, 28 Oct 2025 16:51:09 -0700 Subject: [PATCH] feat: add configuration cache dir for users --- .../settings/CodeWhispererConfigurable.kt | 14 ++++++++++++++ .../amazonq/lsp/AmazonQLanguageClientImpl.kt | 3 ++- .../jetbrains/settings/CodeWhispererSettings.kt | 10 ++++++++++ .../toolkits/resources/MessagesBundle.properties | 2 ++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/settings/CodeWhispererConfigurable.kt b/plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/settings/CodeWhispererConfigurable.kt index 5dec4546a26..87d339951dd 100644 --- a/plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/settings/CodeWhispererConfigurable.kt +++ b/plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/settings/CodeWhispererConfigurable.kt @@ -198,6 +198,20 @@ class CodeWhispererConfigurable(private val project: Project) : }.comment(message("aws.settings.codewhisperer.project_context.tooltip")) } + row(message("aws.settings.codewhisperer.project_context_cache_dir")) { + val fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor() + fileChooserDescriptor.isForcedToUseIdeaFileChooser = true + + textFieldWithBrowseButton(fileChooserDescriptor = fileChooserDescriptor) + .bindText( + { codeWhispererSettings.getProjectContextCacheDir() }, + { codeWhispererSettings.setProjectContextCacheDir(it) } + ) + .resizableColumn() + .align(Align.FILL) + .comment(message("aws.settings.codewhisperer.project_context_cache_dir.tooltip")) + } + row(message("aws.settings.codewhisperer.project_context_index_thread")) { intTextField( range = CodeWhispererSettings.CONTEXT_INDEX_THREADS diff --git a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLanguageClientImpl.kt b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLanguageClientImpl.kt index 9a211e8b7f6..4061d61fe89 100644 --- a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLanguageClientImpl.kt +++ b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLanguageClientImpl.kt @@ -382,7 +382,8 @@ class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageC indexWorkerThreads = qSettings.getProjectContextIndexThreadCount(), enableGpuAcceleration = qSettings.isProjectContextGpu(), localIndexing = LocalIndexingConfiguration( - maxIndexSizeMB = qSettings.getProjectContextIndexMaxSize() + maxIndexSizeMB = qSettings.getProjectContextIndexMaxSize(), + indexCacheDirPath = qSettings.getProjectContextCacheDir() ) ) ) diff --git a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/settings/CodeWhispererSettings.kt b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/settings/CodeWhispererSettings.kt index 0fc7e53f5ba..915498f4975 100644 --- a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/settings/CodeWhispererSettings.kt +++ b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/settings/CodeWhispererSettings.kt @@ -94,6 +94,15 @@ class CodeWhispererSettings : PersistentStateComponentLearn more aws.settings.codewhisperer.project_context=Workspace index 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. +aws.settings.codewhisperer.project_context_cache_dir=Workspace Index Cache Dir Path +aws.settings.codewhisperer.project_context_cache_dir.tooltip=The path to the directory that contains the cache of the index of your workspace files aws.settings.codewhisperer.project_context_gpu=Workspace index uses GPU aws.settings.codewhisperer.project_context_gpu.tooltip=Enable GPU to help index your local workspace files. This setting only applies to Linux and Windows. aws.settings.codewhisperer.project_context_index_max_size=Workspace index max size