Skip to content
Snippets Groups Projects
Commit 768cd6fd authored by dgelessus's avatar dgelessus
Browse files

Fix error highlighting being applied to external files

At the moment error highlighting is only supported for the
machine/formula in the current cell.
parent f76431f2
Branches
Tags
No related merge requests found
......@@ -124,6 +124,7 @@ public final class ProBKernel extends BaseKernel {
private static final @NotNull Logger LOGGER = LoggerFactory.getLogger(ProBKernel.class);
public static final String LOAD_CELL_MACHINE_NAME = "(machine from Jupyter cell)";
private static final @NotNull Pattern COMMAND_PATTERN = Pattern.compile("\\s*(\\:[^\\s]*)(?:\\h*(.*))?", Pattern.DOTALL);
private static final @NotNull Pattern MACHINE_CODE_PATTERN = Pattern.compile("MACHINE\\W.*", Pattern.DOTALL);
private static final @NotNull Pattern BSYMB_COMMAND_PATTERN = Pattern.compile("\\\\([a-z]+)");
......@@ -617,7 +618,7 @@ public final class ProBKernel extends BaseKernel {
}
private @NotNull List<@NotNull String> formatErrorSource(final @NotNull List<@NotNull String> sourceLines, final @NotNull ErrorItem.Location location) {
if (sourceLines.isEmpty()) {
if (sourceLines.isEmpty() || (!location.getFilename().isEmpty() && !Paths.get(location.getFilename()).getFileName().toString().equals(LOAD_CELL_MACHINE_NAME + ".mch"))) {
return Collections.singletonList(this.errorStyler.primary("// Source code not known"));
}
......
......@@ -80,7 +80,7 @@ public final class LoadCellCommand implements Command {
this.proBKernelProvider.get().switchMachine(Paths.get(""), stateSpace -> {
stateSpace.changePreferences(preferences);
CommandUtils.withSourceCode(body, () ->
this.classicalBFactory.create("(machine from Jupyter cell)", body).loadIntoStateSpace(stateSpace)
this.classicalBFactory.create(ProBKernel.LOAD_CELL_MACHINE_NAME, body).loadIntoStateSpace(stateSpace)
);
return new Trace(stateSpace);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment