Skip to content

Commit 1bab3ce

Browse files
authored
Fix read access without read lock while building supplemental context (#4896)
1 parent 26e28f6 commit 1bab3ce

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Fix \"read access\" error that may occur when Amazon Q Inline Suggestion is building context (#4888) (#4848)"
4+
}

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/util/CodeWhispererFileContextProvider.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package software.aws.toolkits.jetbrains.services.codewhisperer.util
55

66
import com.intellij.ide.actions.CopyContentRootPathProvider
7+
import com.intellij.openapi.application.readAction
78
import com.intellij.openapi.application.runReadAction
89
import com.intellij.openapi.components.service
910
import com.intellij.openapi.editor.Editor
@@ -111,7 +112,7 @@ class DefaultCodeWhispererFileContextProvider(private val project: Project) : Fi
111112
*/
112113
override suspend fun extractSupplementalFileContext(psiFile: PsiFile, targetContext: FileContextInfo, timeout: Long): SupplementalContextInfo? {
113114
val startFetchingTimestamp = System.currentTimeMillis()
114-
val isTst = isTestFile(psiFile)
115+
val isTst = readAction { isTestFile(psiFile) }
115116
return try {
116117
withTimeout(timeout) {
117118
val language = targetContext.programmingLanguage

0 commit comments

Comments
 (0)