From d70d013da1a5ad7e13650ceae995c4c441383e4e Mon Sep 17 00:00:00 2001 From: dgelessus <dgelessus@users.noreply.github.com> Date: Thu, 12 Jul 2018 13:01:26 +0200 Subject: [PATCH] Provide source code to error highlighter in :dot --- src/main/java/de/prob2/jupyter/commands/DotCommand.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/prob2/jupyter/commands/DotCommand.java b/src/main/java/de/prob2/jupyter/commands/DotCommand.java index ac43f77..53ee692 100644 --- a/src/main/java/de/prob2/jupyter/commands/DotCommand.java +++ b/src/main/java/de/prob2/jupyter/commands/DotCommand.java @@ -99,7 +99,13 @@ public final class DotCommand implements Command { throw new UncheckedIOException("Failed to create temp file", e); } final GetSvgForVisualizationCommand cmd2 = new GetSvgForVisualizationCommand(trace.getCurrentState(), item, outPath.toFile(), args); - trace.getStateSpace().execute(cmd2); + // Provide source code (if any) to error highlighter + final Runnable execute = () -> trace.getStateSpace().execute(cmd2); + if (split.size() > 1) { + CommandUtils.withSourceCode(split.get(1), execute); + } else { + execute.run(); + } final String svg; try (final Stream<String> lines = Files.lines(outPath)) { svg = lines.collect(Collectors.joining("\n")); -- GitLab