Run scratch if there are some compilation error during make
This commit is contained in:
@@ -46,6 +46,7 @@ class RunScratchAction(private val scratchPanel: ScratchTopPanel) : AnAction(
|
||||
val provider = ScratchFileLanguageProvider.get(psiFile.language) ?: return
|
||||
|
||||
val handler = provider.getOutputHandler()
|
||||
handler.onStart(scratchFile)
|
||||
|
||||
log.printDebugMessage("Run Action: isMakeBeforeRun = $isMakeBeforeRun, isRepl = $isRepl")
|
||||
|
||||
@@ -88,14 +89,16 @@ class RunScratchAction(private val scratchPanel: ScratchTopPanel) : AnAction(
|
||||
|
||||
if (isMakeBeforeRun) {
|
||||
CompilerManager.getInstance(project).make(module) { aborted, errors, _, _ ->
|
||||
if (!aborted && errors == 0) {
|
||||
if (DumbService.isDumb(project)) {
|
||||
DumbService.getInstance(project).smartInvokeLater {
|
||||
executeScratch()
|
||||
}
|
||||
} else {
|
||||
if (aborted || errors > 0) {
|
||||
handler.error(scratchFile, "There were compilation errors in module ${module.name}")
|
||||
}
|
||||
|
||||
if (DumbService.isDumb(project)) {
|
||||
DumbService.getInstance(project).smartInvokeLater {
|
||||
executeScratch()
|
||||
}
|
||||
} else {
|
||||
executeScratch()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -52,8 +52,6 @@ import java.io.File
|
||||
|
||||
class KtCompilingExecutor(file: ScratchFile) : ScratchExecutor(file) {
|
||||
override fun execute() {
|
||||
handlers.forEach { it.onStart(file) }
|
||||
|
||||
val module = file.getModule() ?: return error("Module should be selected")
|
||||
val psiFile = file.getPsiFile() as? KtFile ?: return error("Couldn't find KtFile for current editor")
|
||||
|
||||
|
||||
@@ -41,8 +41,6 @@ class KtScratchReplExecutor(file: ScratchFile) : ScratchExecutor(file) {
|
||||
private lateinit var osProcessHandler: OSProcessHandler
|
||||
|
||||
override fun execute() {
|
||||
handlers.forEach { it.onStart(file) }
|
||||
|
||||
val module = file.getModule() ?: return error(file, "Module should be selected")
|
||||
val cmdLine = KotlinConsoleKeeper.createCommandLine(module)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user