mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-19 07:54:46 +00:00
fix: threading issues
This commit is contained in:
parent
cbf8d62b28
commit
a7ee551226
2 changed files with 17 additions and 10 deletions
|
|
@ -18,6 +18,8 @@ import ee.carlrobert.codegpt.ui.textarea.lookup.LookupActionItem
|
|||
import ee.carlrobert.codegpt.ui.textarea.lookup.LookupUtil
|
||||
import ee.carlrobert.codegpt.ui.textarea.lookup.action.files.FileActionItem
|
||||
import ee.carlrobert.codegpt.ui.textarea.lookup.action.files.IncludeOpenFilesActionItem
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class FilesGroupItem(
|
||||
private val project: Project,
|
||||
|
|
@ -28,13 +30,16 @@ class FilesGroupItem(
|
|||
override val icon = AllIcons.FileTypes.Any_type
|
||||
|
||||
override suspend fun updateLookupList(lookup: LookupImpl, searchText: String) {
|
||||
project.service<ProjectFileIndex>().iterateContent {
|
||||
if (!it.isDirectory && !containsTag(it)) {
|
||||
runInEdt {
|
||||
LookupUtil.addLookupItem(lookup, FileActionItem(project, it))
|
||||
withContext(Dispatchers.Default) {
|
||||
project.service<ProjectFileIndex>().iterateContent {
|
||||
if (!it.isDirectory && !containsTag(it)) {
|
||||
val actionItem = FileActionItem(project, it)
|
||||
runInEdt {
|
||||
LookupUtil.addLookupItem(lookup, actionItem)
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,13 +25,15 @@ class FoldersGroupItem(
|
|||
override val icon = AllIcons.Nodes.Folder
|
||||
|
||||
override suspend fun updateLookupList(lookup: LookupImpl, searchText: String) {
|
||||
project.service<ProjectFileIndex>().iterateContent {
|
||||
if (it.isDirectory && !it.name.startsWith(".") && !tagManager.containsTag(it)) {
|
||||
runInEdt {
|
||||
LookupUtil.addLookupItem(lookup, FolderActionItem(project, it))
|
||||
withContext(Dispatchers.Default) {
|
||||
project.service<ProjectFileIndex>().iterateContent {
|
||||
if (it.isDirectory && !it.name.startsWith(".") && !tagManager.containsTag(it)) {
|
||||
runInEdt {
|
||||
LookupUtil.addLookupItem(lookup, FolderActionItem(project, it))
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue