Closed Manindra29 closed 10 years ago
Made a possible fix by maintaining two CUs - one CU which is created when no syntax errors are present(can represent older code when current code has syntax errors); The other CU which always represents the latest code in the editor.
One problem I've found with the current solution is that scroll to definition doesn't work inside the current block of code, which is being edited. For ex:
void setup() {
String test;
size(640,360);
flock = new Flock();
// Add an initial set of boids into the system
for (int i = 0; i < 200; i++) {
Boid b = new Boid(width/2,height/2);
flock.addBoid(b);
}
smooth();
test = <cursor here>
}
Ctrl + Click doesn't work for any identifiers inside setup() - flock, Boid, etc. as long as code contains syntax errors. It works outside the setup() block. @shiffman, your thoughts on this? Is the solution good enough or should I try to make scroll to declaration work completely? It could be a difficult task.
Fixed for next release.
Completion doesn't appear after typing
test.
When I changed the way in which CompilationUnit(CU) is created in the 1.0.3b release, this regression bug was introduced.
Earlier, a CU was created only if there were no syntax errors. Hence we could get completions even inside block containing dirty code.
Now, the CU is created and then overwritten - in two stages - once during syntax check, and again during compilation check stage. In case of a syntax error in the current block of code, AST isn't created for the contents of the block, hence no info on
test
in the above example code. This change was done to account for some preprocessing related offset changes that get introduced during the second preprocessing step just before compile check.This is a delicate and major bug.