gofmt
This commit is contained in:
parent
10ddfa6251
commit
f56c57109c
|
@ -74,7 +74,7 @@ func WSHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func FmtHandler(w http.ResponseWriter, r *http.Request) {
|
func GoFmtHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
data := map[string]interface{}{"succ": true}
|
data := map[string]interface{}{"succ": true}
|
||||||
defer util.RetJSON(w, r, data)
|
defer util.RetJSON(w, r, data)
|
||||||
|
|
||||||
|
|
2
main.go
2
main.go
|
@ -88,7 +88,7 @@ func main() {
|
||||||
|
|
||||||
// 编辑器
|
// 编辑器
|
||||||
http.HandleFunc("/editor/ws", editor.WSHandler)
|
http.HandleFunc("/editor/ws", editor.WSHandler)
|
||||||
http.HandleFunc("/fmt", editor.FmtHandler)
|
http.HandleFunc("/go/fmt", editor.GoFmtHandler)
|
||||||
http.HandleFunc("/autocomplete", editor.AutocompleteHandler)
|
http.HandleFunc("/autocomplete", editor.AutocompleteHandler)
|
||||||
|
|
||||||
// Shell
|
// Shell
|
||||||
|
|
|
@ -127,9 +127,12 @@ var wide = {
|
||||||
"cursorLine": wide.curEditor.getCursor().line,
|
"cursorLine": wide.curEditor.getCursor().line,
|
||||||
"cursorCh": wide.curEditor.getCursor().ch
|
"cursorCh": wide.curEditor.getCursor().ch
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: HTML/XML/JSON 格式化处理
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: '/fmt',
|
url: '/go/fmt',
|
||||||
data: JSON.stringify(request),
|
data: JSON.stringify(request),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
|
Loading…
Reference in New Issue