mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Simple PDE test working again.
This commit is contained in:
@@ -118,7 +118,7 @@ public class JavaEditor extends Editor {
|
||||
// setting breakpoints will flag sketch as modified, so override this here
|
||||
getSketch().setModified(false);
|
||||
|
||||
preprocService = new PreprocService(this.jmode, this.sketch);
|
||||
preprocService = new PreprocService(this.jmode, this.sketch, this);
|
||||
|
||||
// long t5 = System.currentTimeMillis();
|
||||
|
||||
|
||||
@@ -93,13 +93,15 @@ public class PreprocService {
|
||||
private volatile boolean running;
|
||||
private CompletableFuture<PreprocSketch> preprocessingTask = new CompletableFuture<>();
|
||||
|
||||
private JavaEditor editor;
|
||||
|
||||
private CompletableFuture<?> lastCallback =
|
||||
new CompletableFuture<>() {{
|
||||
complete(null); // initialization block
|
||||
}};
|
||||
|
||||
/**
|
||||
* Create a new preprocessing service to support an editor.
|
||||
* Create a new preprocessing service to support the language server.
|
||||
*/
|
||||
public PreprocService(JavaMode javaMode, Sketch sketch) {
|
||||
this.javaMode = javaMode;
|
||||
@@ -112,6 +114,21 @@ public class PreprocService {
|
||||
preprocessingThread.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new preprocessing service to support an editor.
|
||||
*/
|
||||
public PreprocService(JavaMode javaMode, Sketch sketch, JavaEditor editor) {
|
||||
this.javaMode = javaMode;
|
||||
this.sketch = sketch;
|
||||
this.editor = editor;
|
||||
|
||||
// Register listeners for first run
|
||||
whenDone(this::fireListeners);
|
||||
|
||||
preprocessingThread = new Thread(this::mainLoop, "ECS");
|
||||
preprocessingThread.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* The "main loop" for the background thread that checks for code issues.
|
||||
*/
|
||||
@@ -411,10 +428,18 @@ public class PreprocService {
|
||||
throw new RuntimeException("Unexpected sketch exception in preprocessing: " + e);
|
||||
}
|
||||
|
||||
final int endNumLines = numLines;
|
||||
|
||||
if (preprocessorResult.getPreprocessIssues().size() > 0) {
|
||||
preprocessorResult.getPreprocessIssues().stream()
|
||||
if (editor == null) {
|
||||
preprocessorResult.getPreprocessIssues().stream()
|
||||
.map((x) -> ProblemFactory.build(x, tabLineStarts))
|
||||
.forEach(result.otherProblems::add);
|
||||
} else {
|
||||
preprocessorResult.getPreprocessIssues().stream()
|
||||
.map((x) -> ProblemFactory.build(x, tabLineStarts, endNumLines, editor))
|
||||
.forEach(result.otherProblems::add);
|
||||
}
|
||||
|
||||
result.hasSyntaxErrors = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user