This commit is contained in:
Liang Ding 2014-09-09 13:53:25 +08:00
parent 373f3071cb
commit cef9652fae
4 changed files with 21 additions and 1 deletions

View File

@ -211,6 +211,9 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
glog.Warning(string(out)) glog.Warning(string(out))
} }
}() }()
} else { // 构建失败
// 解析错误信息,返回给编辑器 gutter lint
} }
channelRet := map[string]interface{}{} channelRet := map[string]interface{}{}

View File

@ -177,7 +177,7 @@ var editors = {
editor.setOption("gutters", ["CodeMirror-lint-markers", "CodeMirror-foldgutter"]); editor.setOption("gutters", ["CodeMirror-lint-markers", "CodeMirror-foldgutter"]);
if ("application/json" === data.mode) { if ("text/x-go" === data.mode || "application/json" === data.mode) {
editor.setOption("lint", true); editor.setOption("lint", true);
} }

16
static/js/lint/go-lint.js Normal file
View File

@ -0,0 +1,16 @@
(function(mod) {
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.registerHelper("lint", "go", function(text) {
var found = [];
found.push({from: CodeMirror.Pos(1, 1),
to: CodeMirror.Pos(1, 10),
message: "test commpile err"});
return found;
});
});

View File

@ -123,6 +123,7 @@
<script type="text/javascript" src="{{.Wide.StaticServer}}/static/js/lib/codemirror-4.5/mode/sql/sql.js"></script> <script type="text/javascript" src="{{.Wide.StaticServer}}/static/js/lib/codemirror-4.5/mode/sql/sql.js"></script>
<script type="text/javascript" src="{{.Wide.StaticServer}}/static/js/lint/json-lint.js?{{.Wide.StaticResourceVersion}}"></script> <script type="text/javascript" src="{{.Wide.StaticServer}}/static/js/lint/json-lint.js?{{.Wide.StaticResourceVersion}}"></script>
<script type="text/javascript" src="{{.Wide.StaticServer}}/static/js/lint/go-lint.js?{{.Wide.StaticResourceVersion}}"></script>
<script type="text/javascript" src="{{.Wide.StaticServer}}/static/js/tabs.js?{{.Wide.StaticResourceVersion}}"></script> <script type="text/javascript" src="{{.Wide.StaticServer}}/static/js/tabs.js?{{.Wide.StaticResourceVersion}}"></script>
<script type="text/javascript" src="{{.Wide.StaticServer}}/static/js/editor.js?{{.Wide.StaticResourceVersion}}"></script> <script type="text/javascript" src="{{.Wide.StaticServer}}/static/js/editor.js?{{.Wide.StaticResourceVersion}}"></script>
<script type="text/javascript" src="{{.Wide.StaticServer}}/static/js/tree.js?{{.Wide.StaticResourceVersion}}"></script> <script type="text/javascript" src="{{.Wide.StaticServer}}/static/js/tree.js?{{.Wide.StaticResourceVersion}}"></script>