Render errors from other files correctly.

pull/1/head
chriseth 9 years ago
parent 929cbdbfd5
commit ef674daa28
  1. 19
      index.html

@ -655,7 +655,7 @@
var detailsOpen = {};
function errortype(message) {
return message.match(/^[0-9:]* Warning: /) ? 'warning' : 'error';
return message.match(/^.*:[0-9]*:[0-9]* Warning: /) ? 'warning' : 'error';
}
var renderError = function(message) {
@ -663,10 +663,12 @@
var $pre = $("<pre />").text(message);
var $error = $('<div class="sol ' + type + '"><div class="close"><i class="fa fa-close"></i></div></div>').prepend($pre);
$('#output').append( $error );
var err = message.match(/^:([0-9]*):([0-9]*)/);
if (err && err.length) {
var errLine = parseInt(err[1], 10) - 1;
var errCol = err[2] ? parseInt(err[2], 10) : 0;
var err = message.match(/^([^:]*):([0-9]*):(([0-9]*):)? /);
if (err) {
var errFile = err[1];
var errLine = parseInt(err[2], 10) - 1;
var errCol = err[4] ? parseInt(err[4], 10) : 0;
if (errFile == '' || errFile == fileNameFromKey(SOL_CACHE_FILE)) {
sourceAnnotations[sourceAnnotations.length] = {
row: errLine,
column: errCol,
@ -674,7 +676,14 @@
type: type
};
editor.getSession().setAnnotations(sourceAnnotations);
}
$error.click(function(ev){
if (errFile != '' && errFile != fileNameFromKey(SOL_CACHE_FILE) && getFiles().indexOf(fileKey(errFile)) !== -1) {
// Switch to file
SOL_CACHE_FILE = fileKey(errFile);
updateFiles();
//@TODO could show some error icon in files with errors
}
editor.focus();
editor.gotoLine(errLine + 1, errCol - 1, true);
});

Loading…
Cancel
Save