Skip to content

Commit

Permalink
Merge pull request #3898 from Hannah-Sten/read-exceptions
Browse files Browse the repository at this point in the history
Fix read action in RootFile
  • Loading branch information
PHPirates authored Feb 7, 2025
2 parents 0f7612f + 501138e commit 717b7ba
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Improve log parsing of 'undefined control sequence' error
* Fix a parsing issue when a verbatim command is followed by a space
* Make language injection id check case insensitive
* Fix exceptions #3843, #3853, #3852, #3846 and #3866
* Fix exceptions #3843, #3853, #3852, #3846, #3873, #3885 and #3866

## [0.10.0] - 2025-01-27

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package nl.hannahsten.texifyidea.index.file

import com.intellij.openapi.application.runInEdt
import com.intellij.openapi.application.runReadAction
import com.intellij.openapi.project.DumbService
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope
Expand Down Expand Up @@ -42,8 +41,8 @@ object LatexExternalPackageInclusionCache {
runInEdt {
runInBackgroundBlocking(project, "Retrieving LaTeX package inclusions...") { indicator ->
try {
runReadAction { FileBasedIndex.getInstance().getAllKeys(LatexExternalPackageInclusionIndex.Cache.id, project) }.forEach { indexKey ->
runReadAction {
DumbService.getInstance(project).tryRunReadActionInSmartMode({ FileBasedIndex.getInstance().getAllKeys(LatexExternalPackageInclusionIndex.Cache.id, project) }, indicator.text)?.forEach { indexKey ->
DumbService.getInstance(project).tryRunReadActionInSmartMode({
FileBasedIndex.getInstance().processValues(
LatexExternalPackageInclusionIndex.Cache.id, indexKey, null, { file, _ ->
indicator.checkCanceled()
Expand All @@ -53,7 +52,7 @@ object LatexExternalPackageInclusionCache {
},
GlobalSearchScope.everythingScope(project)
)
}
}, indicator.text)
}

// Do some DFS for indirect inclusions
Expand Down
2 changes: 1 addition & 1 deletion src/nl/hannahsten/texifyidea/util/files/RootFile.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ suspend fun PsiFile.findRootFilesWithoutCache(fileset: Set<PsiFile>): Set<PsiFil

if (magicComment.contains(DefaultMagicKeys.ROOT)) {
val path = magicComment.value(DefaultMagicKeys.ROOT) ?: ""
this.findFile(path, supportsAnyExtension = true)?.let { roots.add(it) }
smartReadAction(project) { this.findFile(path, supportsAnyExtension = true) }?.let { roots.add(it) }
}

if (smartReadAction(project) { this.isRoot() }) {
Expand Down

0 comments on commit 717b7ba

Please sign in to comment.