autocomplete enhance

This commit is contained in:
Liang Ding 2014-12-04 17:59:52 +08:00
parent c0bbfffc16
commit 938b82a42d
1 changed files with 7 additions and 0 deletions

View File

@ -83,6 +83,13 @@
completion.to || data.to, "complete"); completion.to || data.to, "complete");
CodeMirror.signal(data, "pick", completion); CodeMirror.signal(data, "pick", completion);
this.close(); 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) { showHints: function(data) {