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
|
|
@ -251,7 +251,7 @@ commands.addCommand({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var keybindings = {
|
var keybindings = {
|
||||||
ace: null, // Null = use "default" keymapping
|
ace: null, // Null = use "default" keymapping
|
||||||
vim: require("ace/keyboard/vim").handler,
|
vim: require("ace/keyboard/vim").handler,
|
||||||
emacs: "ace/keyboard/emacs",
|
emacs: "ace/keyboard/emacs",
|
||||||
|
|
@ -317,7 +317,7 @@ doclist.history.index = 0;
|
||||||
doclist.cycleOpen = function(editor, dir) {
|
doclist.cycleOpen = function(editor, dir) {
|
||||||
var h = this.history;
|
var h = this.history;
|
||||||
h.index += dir;
|
h.index += dir;
|
||||||
if (h.index >= h.length)
|
if (h.index >= h.length)
|
||||||
h.index = 0;
|
h.index = 0;
|
||||||
else if (h.index <= 0)
|
else if (h.index <= 0)
|
||||||
h.index = h.length - 1;
|
h.index = h.length - 1;
|
||||||
|
|
@ -499,7 +499,7 @@ bindDropdown("split", function(value) {
|
||||||
sp.setSplits(1);
|
sp.setSplits(1);
|
||||||
} else {
|
} else {
|
||||||
var newEditor = (sp.getSplits() == 1);
|
var newEditor = (sp.getSplits() == 1);
|
||||||
sp.setOrientation(value == "below" ? sp.BELOW : sp.BESIDE);
|
sp.setOrientation(value == "below" ? sp.BELOW : sp.BESIDE);
|
||||||
sp.setSplits(2);
|
sp.setSplits(2);
|
||||||
|
|
||||||
if (newEditor) {
|
if (newEditor) {
|
||||||
|
|
@ -592,6 +592,7 @@ env.editSnippets = function() {
|
||||||
require("ace/ext/language_tools");
|
require("ace/ext/language_tools");
|
||||||
env.editor.setOptions({
|
env.editor.setOptions({
|
||||||
enableBasicAutocompletion: true,
|
enableBasicAutocompletion: true,
|
||||||
|
enableLiveAutocomplete: true,
|
||||||
enableSnippets: true
|
enableSnippets: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ var loadSnippetFile = function(id) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var onChangeAutocomplete = function(e) {
|
var doLiveAutocomplete = function(e) {
|
||||||
var editor = e.editor;
|
var editor = e.editor;
|
||||||
var session = editor.getSession();
|
var session = editor.getSession();
|
||||||
var pos = editor.getCursorPosition();
|
var pos = editor.getCursorPosition();
|
||||||
|
|
@ -174,16 +174,23 @@ require("../config").defineOptions(Editor.prototype, "editor", {
|
||||||
if (val) {
|
if (val) {
|
||||||
this.completers = completers;
|
this.completers = completers;
|
||||||
this.commands.addCommand(Autocomplete.startCommand);
|
this.commands.addCommand(Autocomplete.startCommand);
|
||||||
|
|
||||||
// On each change automatically trigger the autocomplete
|
|
||||||
this.commands.on('afterExec', onChangeAutocomplete);
|
|
||||||
} else {
|
} else {
|
||||||
this.removeListener('afterExec', onChangeAutocomplete);
|
|
||||||
this.commands.removeCommand(Autocomplete.startCommand);
|
this.commands.removeCommand(Autocomplete.startCommand);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
value: false
|
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: {
|
enableSnippets: {
|
||||||
set: function(val) {
|
set: function(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue