-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1527 from lf-lang/clem.cleanup-error-rendering
Refactor error reporter
- Loading branch information
Showing
102 changed files
with
1,463 additions
and
1,642 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.lflang; | ||
|
||
import java.nio.file.Path; | ||
import org.eclipse.emf.ecore.EObject; | ||
import org.eclipse.lsp4j.DiagnosticSeverity; | ||
import org.lflang.generator.Range; | ||
|
||
/** Simple implementation of the ErrorReport interface that simply prints to standard out. */ | ||
public class DefaultMessageReporter extends MessageReporterBase implements MessageReporter { | ||
|
||
private void println(String s) { | ||
System.out.println(s); | ||
} | ||
|
||
@Override | ||
protected void report(Path path, Range range, DiagnosticSeverity severity, String message) { | ||
reportWithoutPosition(severity, message); | ||
} | ||
|
||
@Override | ||
protected void reportOnNode(EObject node, DiagnosticSeverity severity, String message) { | ||
reportWithoutPosition(severity, message); | ||
} | ||
|
||
@Override | ||
protected void reportWithoutPosition(DiagnosticSeverity severity, String message) { | ||
switch (severity) { | ||
case Error -> println("ERROR: " + message); | ||
case Warning -> println("WARNING: " + message); | ||
case Information, Hint -> println("INFO: " + message); | ||
} | ||
} | ||
} |
Oops, something went wrong.