Index: lib/src/report.dart |
diff --git a/lib/src/report.dart b/lib/src/report.dart |
index e6a256566ab076a1bdaa04da604f29b7a3e9f914..61ab5ce3ba66829f65550bc0434c990be67c743c 100644 |
--- a/lib/src/report.dart |
+++ b/lib/src/report.dart |
@@ -18,14 +18,6 @@ import 'summary.dart'; |
final _checkerLogger = new Logger('dev_compiler.checker'); |
-SourceSpanWithContext _toSpan(AnalysisContext context, AnalysisError error) { |
- var source = error.source; |
- var lineInfo = context.computeLineInfo(source); |
- var content = context.getContents(source).data; |
- var start = error.offset; |
- var end = start + error.length; |
- return createSpanHelper(lineInfo, start, end, source, content); |
-} |
/// Simple reporter that logs checker messages as they are seen. |
class LogReporter implements AnalysisErrorListener { |
final AnalysisContext _context; |
@@ -43,11 +35,16 @@ class LogReporter implements AnalysisErrorListener { |
level = Level.SEVERE; |
} |
- var color = useColors ? colorOf(level.name) : null; |
- |
// TODO(jmesserly): figure out what to do with the error's name. |
- var text = '[${errorCodeName(error.errorCode)}] ' + error.message; |
- text = _toSpan(_context, error).message(text, color: color); |
+ var lineInfo = _context.computeLineInfo(error.source); |
+ var location = lineInfo.getLocation(error.offset); |
+ |
+ // [warning] 'foo' is not a... (/Users/.../tmp/foo.dart, line 1, col 2) |
+ var text = new StringBuffer() |
+ ..write('[${errorCodeName(error.errorCode)}] ') |
+ ..write(error.message) |
+ ..write(' (${path.prettyUri(error.source.uri)}') |
+ ..write(', line ${location.lineNumber}, col ${location.columnNumber})'); |
// TODO(jmesserly): just print these instead of sending through logger? |
_checkerLogger.log(level, text); |
@@ -101,6 +98,17 @@ class SummaryReporter implements AnalysisErrorListener { |
code.errorSeverity.displayName, span, error.message)); |
} |
+ // TODO(jmesserly): fix to not depend on SourceSpan. This will be really slow |
+ // because it will reload source text from disk, for every single message... |
+ SourceSpanWithContext _toSpan(AnalysisContext context, AnalysisError error) { |
+ var source = error.source; |
+ var lineInfo = context.computeLineInfo(source); |
+ var content = context.getContents(source).data; |
+ var start = error.offset; |
+ var end = start + error.length; |
+ return createSpanHelper(lineInfo, start, end, source, content); |
+ } |
+ |
void clearLibrary(Uri uri) { |
(_getIndividualSummary(uri) as LibrarySummary).clear(); |
} |