Merge pull request #1730 from danyaPostfactum/autoinsert
Add autoinsert feature to the completer.
This commit is contained in:
commit
92dba7d44c
1 changed files with 5 additions and 1 deletions
|
|
@ -39,6 +39,7 @@ var lang = require("./lib/lang");
|
|||
var snippetManager = require("./snippets").snippetManager;
|
||||
|
||||
var Autocomplete = function() {
|
||||
this.autoInsert = true;
|
||||
this.keyboardHandler = new HashHandler();
|
||||
this.keyboardHandler.bindKeys(this.commands);
|
||||
|
||||
|
|
@ -248,8 +249,11 @@ var Autocomplete = function() {
|
|||
|
||||
this.completions = new FilteredList(matches);
|
||||
this.completions.setFilter(results.prefix);
|
||||
if (!this.completions.filtered.length)
|
||||
var filtered = this.completions.filtered;
|
||||
if (!filtered.length)
|
||||
return this.detach();
|
||||
if (this.autoInsert && filtered.length == 1)
|
||||
return this.insertMatch(filtered[0]);
|
||||
this.openPopup(this.editor, results.prefix, keepPopupPosition);
|
||||
}.bind(this));
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue