diff --git a/static/js/overwrite/codemirror/addon/hint/show-hint.js b/static/js/overwrite/codemirror/addon/hint/show-hint.js index 90b9f00..7ce7fd6 100644 --- a/static/js/overwrite/codemirror/addon/hint/show-hint.js +++ b/static/js/overwrite/codemirror/addon/hint/show-hint.js @@ -83,6 +83,13 @@ completion.to || data.to, "complete"); CodeMirror.signal(data, "pick", completion); this.close(); + + // 对自动完成函数(例如 hello())后光标的位置进行调整,调整到 () 中间 + var cursor = this.cm.getCursor(); + var token = this.cm.getTokenAt(cursor); + if (token && ")" === token.string) { + this.cm.setCursor(CodeMirror.Pos(cursor.line, cursor.ch - 1)); + } }, showHints: function(data) {