Repl: notify about successfully executing lines

This commit is contained in:
Pavel V. Talanov
2015-10-22 18:15:55 +03:00
parent b5dfbcdde8
commit e10df1a05d
2 changed files with 4 additions and 1 deletions
@@ -184,6 +184,7 @@ public class ReplFromTerminal {
private ReplInterpreter.LineResultType eval(@NotNull String line) {
ReplInterpreter.LineResult lineResult = getReplInterpreter().eval(line);
if (lineResult.getType() == ReplInterpreter.LineResultType.SUCCESS) {
replWriter.notifyCommandSuccess();
if (!lineResult.isUnit()) {
replWriter.outputCommandResult(lineResult.getValue());
}
@@ -34,7 +34,8 @@ public class ReplSystemOutWrapper(private val ideMode: Boolean, standardOut: Pri
REPL_INCOMPLETE,
COMPILE_ERROR,
RUNTIME_ERROR,
INTERNAL_ERROR
INTERNAL_ERROR,
SUCCESS
}
override fun print(x: Boolean) = printWithEscaping(x.toString())
@@ -65,6 +66,7 @@ public class ReplSystemOutWrapper(private val ideMode: Boolean, standardOut: Pri
fun outputCommandResult(x: Any?) = printlnWithEscaping(x.toString(), EscapeType.REPL_RESULT)
fun notifyReadLineStart() = printlnWithEscaping("", EscapeType.READLINE_START)
fun notifyReadLineEnd() = printlnWithEscaping("", EscapeType.READLINE_END)
fun notifyCommandSuccess() = printlnWithEscaping("", EscapeType.SUCCESS)
fun notifyIncomplete() = printlnWithEscaping("", EscapeType.REPL_INCOMPLETE)
fun outputCompileError(x: String) = printlnWithEscaping(x, EscapeType.COMPILE_ERROR)
fun outputRuntimeError(x: String) = printlnWithEscaping(x, EscapeType.RUNTIME_ERROR)