Add "enableLiveAutocomplete" option
This makes live autocomplete optional and is not tied to “enableBasicAutocomplete” anymore This also renames “onChangeAutocomplete” to “doLiveAutocomplete”
This commit is contained in:
parent
cbbbf1c539
commit
f7be399bd2
2 changed files with 16 additions and 8 deletions
|
|
@ -115,7 +115,7 @@ var loadSnippetFile = function(id) {
|
|||
});
|
||||
};
|
||||
|
||||
var onChangeAutocomplete = function(e) {
|
||||
var doLiveAutocomplete = function(e) {
|
||||
var editor = e.editor;
|
||||
var session = editor.getSession();
|
||||
var pos = editor.getCursorPosition();
|
||||
|
|
@ -174,16 +174,23 @@ require("../config").defineOptions(Editor.prototype, "editor", {
|
|||
if (val) {
|
||||
this.completers = completers;
|
||||
this.commands.addCommand(Autocomplete.startCommand);
|
||||
|
||||
// On each change automatically trigger the autocomplete
|
||||
this.commands.on('afterExec', onChangeAutocomplete);
|
||||
} else {
|
||||
this.removeListener('afterExec', onChangeAutocomplete);
|
||||
this.commands.removeCommand(Autocomplete.startCommand);
|
||||
}
|
||||
},
|
||||
value: false
|
||||
},
|
||||
enableLiveAutocomplete: {
|
||||
set: function(val) {
|
||||
if (val) {
|
||||
// On each change automatically trigger the autocomplete
|
||||
this.commands.on('afterExec', doLiveAutocomplete);
|
||||
} else {
|
||||
this.removeListener('afterExec', doLiveAutocomplete);
|
||||
}
|
||||
},
|
||||
value: false
|
||||
},
|
||||
enableSnippets: {
|
||||
set: function(val) {
|
||||
if (val) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue