Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Ignore IDE runs of the compiler during an invalidated state #4016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import app.cash.sqldelight.intellij.run.window.SqlDelightToolWindowFactory
import app.cash.sqldelight.intellij.util.GeneratedVirtualFile
import com.alecstrong.sql.psi.core.SqlFileBase
import com.alecstrong.sql.psi.core.SqlParserUtil
import com.alecstrong.sql.psi.core.psi.InvalidElementDetectedException
import com.intellij.icons.AllIcons
import com.intellij.ide.impl.ProjectUtil
import com.intellij.ide.projectView.ProjectView
Expand Down Expand Up @@ -146,7 +147,13 @@ class ProjectService(val project: Project) : SqlDelightProjectService, Disposabl
with(ApplicationManager.getApplication()) {
invokeLater {
runWriteAction {
SqlDelightCompiler.writeDatabaseInterface(module, file, module.name, fileAppender)
try {
SqlDelightCompiler.writeDatabaseInterface(module, file, module.name, fileAppender)
} catch (e: InvalidElementDetectedException) {
// Since this is an IDE step, it's possible it happens during some element invalidation.
// In those cases its okay to ignore this time and wait until the next attempt at
// codegen.
}
}
}
}
Expand Down