From ef674daa2815b719c732bb3a334814d374717b66 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 15 Oct 2015 20:31:14 +0200 Subject: [PATCH] Render errors from other files correctly. --- index.html | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index af7f40ba15..11ef8dfe61 100644 --- a/index.html +++ b/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,18 +663,27 @@ var $pre = $("
").text(message);
 				var $error = $('
').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; - sourceAnnotations[sourceAnnotations.length] = { - row: errLine, - column: errCol, - text: message, - type: type - }; - editor.getSession().setAnnotations(sourceAnnotations); + 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, + text: message, + 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); });