diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2019-03-05 21:15:24 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-09-17 16:43:10 +0200 |
commit | 2e03fc91b6962f93b3a84bc69b3ec52377de7e17 (patch) | |
tree | 7c5094eb773cbb3c21c663825928314d6e02b610 | |
parent | 0f3cc46f70252127074c040d9e7e1d2233a7c22d (diff) | |
download | vala-wip/issue/764.tar.gz |
vala: Output multiline source-referencewip/issue/764
Fixes https://gitlab.gnome.org/GNOME/vala/issues/764
-rw-r--r-- | vala/valareport.vala | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/vala/valareport.vala b/vala/valareport.vala index 0aad89f15..8e480f03d 100644 --- a/vala/valareport.vala +++ b/vala/valareport.vala @@ -233,19 +233,29 @@ public class Vala.Report { */ private void report_source (SourceReference source) { if (source.begin.line != source.end.line) { - // FIXME Cannot report multi-line issues currently + int idx; + for (idx = source.begin.line - 2; idx < source.end.line + 2; ++idx) { + string offending_line = source.file.get_source_line (idx); + if (source.begin.line <= idx <= source.end.line) { + stderr.puts (caret_color_start); + stderr.printf (" >"); + stderr.puts (caret_color_end); + } + stderr.printf (" %s\n", offending_line); + } return; } string offending_line = source.file.get_source_line (source.begin.line); if (offending_line != null) { - stderr.printf ("%s\n", offending_line); + stderr.printf (" %s\n", offending_line); int idx; /* We loop in this manner so that we don't fall over on differing * tab widths. This means we get the ^s in the right places. */ + stderr.printf (" "); for (idx = 1; idx < source.begin.column; ++idx) { if (offending_line[idx - 1] == '\t') { stderr.printf ("\t"); |