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 provider = ScratchFileLanguageProvider.get(psiFile.language) ?: return
|
||||||
|
|
||||||
val handler = provider.getOutputHandler()
|
val handler = provider.getOutputHandler()
|
||||||
|
handler.onStart(scratchFile)
|
||||||
|
|
||||||
log.printDebugMessage("Run Action: isMakeBeforeRun = $isMakeBeforeRun, isRepl = $isRepl")
|
log.printDebugMessage("Run Action: isMakeBeforeRun = $isMakeBeforeRun, isRepl = $isRepl")
|
||||||
|
|
||||||
@@ -88,14 +89,16 @@ class RunScratchAction(private val scratchPanel: ScratchTopPanel) : AnAction(
|
|||||||
|
|
||||||
if (isMakeBeforeRun) {
|
if (isMakeBeforeRun) {
|
||||||
CompilerManager.getInstance(project).make(module) { aborted, errors, _, _ ->
|
CompilerManager.getInstance(project).make(module) { aborted, errors, _, _ ->
|
||||||
if (!aborted && errors == 0) {
|
if (aborted || errors > 0) {
|
||||||
if (DumbService.isDumb(project)) {
|
handler.error(scratchFile, "There were compilation errors in module ${module.name}")
|
||||||
DumbService.getInstance(project).smartInvokeLater {
|
}
|
||||||
executeScratch()
|
|
||||||
}
|
if (DumbService.isDumb(project)) {
|
||||||
} else {
|
DumbService.getInstance(project).smartInvokeLater {
|
||||||
executeScratch()
|
executeScratch()
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
executeScratch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -52,8 +52,6 @@ import java.io.File
|
|||||||
|
|
||||||
class KtCompilingExecutor(file: ScratchFile) : ScratchExecutor(file) {
|
class KtCompilingExecutor(file: ScratchFile) : ScratchExecutor(file) {
|
||||||
override fun execute() {
|
override fun execute() {
|
||||||
handlers.forEach { it.onStart(file) }
|
|
||||||
|
|
||||||
val module = file.getModule() ?: return error("Module should be selected")
|
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")
|
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
|
private lateinit var osProcessHandler: OSProcessHandler
|
||||||
|
|
||||||
override fun execute() {
|
override fun execute() {
|
||||||
handlers.forEach { it.onStart(file) }
|
|
||||||
|
|
||||||
val module = file.getModule() ?: return error(file, "Module should be selected")
|
val module = file.getModule() ?: return error(file, "Module should be selected")
|
||||||
val cmdLine = KotlinConsoleKeeper.createCommandLine(module)
|
val cmdLine = KotlinConsoleKeeper.createCommandLine(module)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user