|
576 | 576 | " class=\"linejump\">" + text + "</a>";
|
577 | 577 | }
|
578 | 578 |
|
| 579 | + //Similarly to jumpToLine, except this one acts on eg. "<anon>:2:31" |
| 580 | + function jumpToPoint(text, r1,c1) { |
| 581 | + return "<a onclick=\"javascript:editGo("+r1+","+c1+")\"" + |
| 582 | + " onmouseover=\"javascript:editShowPoint("+r1+","+c1+")\"" + |
| 583 | + " onmouseout=\"javascript:editRestore()\"" + |
| 584 | + " class=\"linejump\">" + text + "</a>"; |
| 585 | + } |
| 586 | + |
579 | 587 | function formatCompilerOutput(text) {
|
580 |
| - return ansi2html(text).replace(/\[(E\d\d\d\d)\]/g, function(text, code) { |
581 |
| - return "[<a href=https://doc.rust-lang.org/error-index.html#" + code + ">" + code + "</a>]"; |
| 588 | + return ansi2html(text).replace(/\[(--explain )?(E\d\d\d\d)\]/g, function(text, prefix, code) { |
| 589 | + return "[<a href=https://doc.rust-lang.org/error-index.html#" + code + ">" + prefix + code + "</a>]"; |
582 | 590 | }).replace(/run `rustc --explain (E\d\d\d\d)` to see a detailed explanation/g, function(text, code) {
|
583 | 591 | return "see the <a href=https://doc.rust-lang.org/error-index.html#" + code + ">detailed explanation for " + code + "</a>";
|
584 | 592 | }).replace(/<anon>:(\d+)$/mg, jumpToLine) // panicked at 'foo', $&
|
585 | 593 | .replace(/^<anon>:(\d+):(\d+):\s+(\d+):(\d+)/mg, jumpToRegion)
|
586 |
| - .replace(/^<anon>:(\d+)/mg, jumpToLine); |
| 594 | + .replace(/^<anon>:(\d+)/mg, jumpToLine) |
| 595 | + .replace(/<anon>:(\d+):(\d+)/mg, jumpToPoint); // new errors |
587 | 596 | }
|
588 | 597 |
|
589 | 598 | addEventListener("DOMContentLoaded", function() {
|
@@ -830,3 +839,14 @@ function editShowLine(r1) {
|
830 | 839 | es.moveCursorLineEnd();
|
831 | 840 | es.selectTo(r1-1, 0);
|
832 | 841 | }
|
| 842 | + |
| 843 | +function editShowPoint(r1,c1) { |
| 844 | + var e = editorGet(); |
| 845 | + var es = e.selection; |
| 846 | + old_range = es.getRange(); |
| 847 | + es.clearSelection(); |
| 848 | + e.scrollToLine(r1, true, true); |
| 849 | + es.moveCursorTo(r1-1, 0); |
| 850 | + es.moveCursorLineEnd(); |
| 851 | + es.selectTo(r1-1, c1-1); |
| 852 | +} |
0 commit comments