Skip to content

Commit 747698b

Browse files
committed
more
1 parent 506439b commit 747698b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/project/ProjectContextController.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import kotlinx.coroutines.Dispatchers
1919
import kotlinx.coroutines.Job
2020
import kotlinx.coroutines.TimeoutCancellationException
2121
import kotlinx.coroutines.launch
22+
import kotlinx.coroutines.withContext
2223
import software.aws.toolkits.core.utils.getLogger
2324
import software.aws.toolkits.core.utils.warn
2425
import software.aws.toolkits.jetbrains.utils.pluginAwareExecuteOnPooledThread
@@ -52,16 +53,16 @@ class ProjectContextController(private val project: Project, private val cs: Cor
5253

5354
fun getProjectContextIndexComplete() = projectContextProvider.isIndexComplete.get()
5455

55-
suspend fun queryChat(prompt: String, timeout: Long?): List<RelevantDocument> {
56+
suspend fun queryChat(prompt: String, timeout: Long?): List<RelevantDocument> = withContext(Dispatchers.IO) {
5657
try {
57-
return projectContextProvider.query(prompt, timeout)
58+
projectContextProvider.query(prompt, timeout)
5859
} catch (e: Exception) {
5960
logger.warn { "error while querying for project context $e.message" }
60-
return emptyList()
61+
emptyList()
6162
}
6263
}
6364

64-
suspend fun queryInline(query: String, filePath: String): List<InlineBm25Chunk> =
65+
suspend fun queryInline(query: String, filePath: String): List<InlineBm25Chunk> = withContext(Dispatchers.IO) {
6566
try {
6667
projectContextProvider.queryInline(query, filePath, InlineContextTarget.CODEMAP)
6768
} catch (e: Exception) {
@@ -72,6 +73,7 @@ class ProjectContextController(private val project: Project, private val cs: Cor
7273
logger.warn { logStr }
7374
emptyList()
7475
}
76+
}
7577

7678
@RequiresBackgroundThread
7779
fun updateIndex(filePaths: List<String>, mode: IndexUpdateMode) {

0 commit comments

Comments
 (0)