mirror of
https://github.com/processing/processing4.git
synced 2026-01-27 10:21:26 +01:00
Closes #714.
Depending on how the Problem is made, the error may be given relative to start of line or start of tab. Flag indicates to users of Problems which one they are working with.
This commit is contained in:
@@ -82,7 +82,7 @@ public class JavaProblem implements Problem {
|
||||
}
|
||||
|
||||
|
||||
public void setPDEOffsets(int startOffset, int stopOffset){
|
||||
public void setPDEOffsets(int startOffset, int stopOffset) {
|
||||
this.startOffset = startOffset;
|
||||
this.stopOffset = stopOffset;
|
||||
}
|
||||
@@ -139,6 +139,9 @@ public class JavaProblem implements Problem {
|
||||
importSuggestions = a;
|
||||
}
|
||||
|
||||
public boolean isLineOffset() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@@ -53,7 +53,8 @@ public class ProblemFactory {
|
||||
localLine,
|
||||
message,
|
||||
lineStart,
|
||||
lineStop
|
||||
lineStop,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
@@ -83,8 +84,9 @@ public class ProblemFactory {
|
||||
tab,
|
||||
localLine,
|
||||
message,
|
||||
localLine,
|
||||
localLine + col
|
||||
0,
|
||||
col,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ public class SyntaxProblem extends JavaProblem {
|
||||
private final String message;
|
||||
private final int startOffset;
|
||||
private final int stopOffset;
|
||||
private final boolean lineFlag;
|
||||
|
||||
/**
|
||||
* Create a new syntax problem.
|
||||
@@ -18,12 +19,14 @@ public class SyntaxProblem extends JavaProblem {
|
||||
* @param newLineNumber The line number within the tab at which the offending code can be found.
|
||||
* @param newMessage Human readable message describing the issue.
|
||||
* @param newStartOffset The character index at which the issue starts. This is relative to start
|
||||
* of tab / file not relative to start of line.
|
||||
* of tab / file not relative to start of line if newIsLineOffset is true else it is line
|
||||
* offset.
|
||||
* @param newStopOffset The character index at which the issue ends. This is relative to start
|
||||
* * of tab / file not relative to start of line.
|
||||
* of tab / file not relative to start of line if newIsLineOffset is true else it is line
|
||||
* offset.
|
||||
*/
|
||||
public SyntaxProblem(int newTabIndex, int newLineNumber, String newMessage, int newStartOffset,
|
||||
int newStopOffset) {
|
||||
int newStopOffset, boolean newIsLineOffset) {
|
||||
|
||||
super(newMessage, JavaProblem.ERROR, newLineNumber, newLineNumber);
|
||||
|
||||
@@ -32,6 +35,7 @@ public class SyntaxProblem extends JavaProblem {
|
||||
message = newMessage;
|
||||
startOffset = newStartOffset;
|
||||
stopOffset = newStopOffset;
|
||||
lineFlag = newIsLineOffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,4 +73,8 @@ public class SyntaxProblem extends JavaProblem {
|
||||
return stopOffset;
|
||||
}
|
||||
|
||||
public boolean isLineOffset() {
|
||||
return lineFlag;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user