Skip to content

Commit

Permalink
Handle process cancellation during find usages
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecKazakova committed Jul 6, 2023
1 parent 10106a6 commit 08bca18
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.intellij.find.findUsages.FindUsagesOptions
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.ReadAction
import com.intellij.openapi.module.ModuleUtil
import com.intellij.openapi.progress.ProcessCanceledException
import com.intellij.openapi.roots.ProjectRootManager
import com.intellij.openapi.util.Computable
import com.intellij.openapi.vfs.VirtualFile
Expand All @@ -41,7 +42,13 @@ internal class SqlDelightFindUsagesHandlerFactory : FindUsagesHandlerFactory() {
override fun createFindUsagesHandler(
element: PsiElement,
forHighlightUsages: Boolean,
): FindUsagesHandler = SqlDelightIdentifierHandler(element)
): FindUsagesHandler? {
return try {
SqlDelightIdentifierHandler(element)
} catch (e: ProcessCanceledException) {
null
}
}
}

internal class SqlDelightIdentifierHandler(
Expand Down

0 comments on commit 08bca18

Please sign in to comment.