diff --git a/output/outputs.go b/output/outputs.go index 33dd159..ff93f09 100644 --- a/output/outputs.go +++ b/output/outputs.go @@ -438,7 +438,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) { } lint := &Lint{ - File: file, + File: filepath.Join(curDir,file), LineNo: lineNo - 1, Severity: lintSeverityError, Msg: msg, diff --git a/static/js/editors.js b/static/js/editors.js index cf32371..897ac22 100644 --- a/static/js/editors.js +++ b/static/js/editors.js @@ -17,6 +17,13 @@ var editors = { data: [], tabs: {}, + getEditorByPath: function (path) { + for (var i = 0, ii = editors.data.length; i < ii; i++) { + if (editors.data[i].editor.options.path === path) { + return editors.data[i].editor; + } + } + }, close: function () { $(".edit-panel .tabs > div[data-index=" + $(".edit-panel .frame").data("index") + "]").find(".ico-close").click(); }, diff --git a/static/js/wide.js b/static/js/wide.js index da5bef0..ce2331e 100644 --- a/static/js/wide.js +++ b/static/js/wide.js @@ -17,7 +17,7 @@ var wide = { curNode: undefined, curEditor: undefined, - curProcessId: undefined, // 当前正在运行的进程 id(pid) + curProcessId: undefined, // curent running process id (pid) _initDialog: function () { $(".dialog-prompt > input").keyup(function (event) { var $okBtn = $(this).closest(".dialog-main").find(".dialog-footer > button:eq(0)"); @@ -379,20 +379,27 @@ var wide = { bottomGroup.fillOutput($('.bottom-window-group .output > div').html() + data.output); if (data.lints) { // has build error + var files = {}; + for (var i = 0; i < data.lints.length; i++) { var lint = data.lints[i]; goLintFound.push({from: CodeMirror.Pos(lint.lineNo, 0), to: CodeMirror.Pos(lint.lineNo, 0), message: lint.msg, severity: lint.severity}); + + files[lint.file] = lint.file; } $(".toolbars .ico-stop").removeClass("ico-stop") .addClass("ico-buildrun").attr("title", config.label.build_n_run); - } - // trigger gutter lint - CodeMirror.signal(wide.curEditor, "change", wide.curEditor); + // trigger gutter lint + for (var path in files) { + var editor = editors.getEditorByPath(path); + CodeMirror.signal(editor, "change", editor); + } + } break; }