tweak completer
This commit is contained in:
parent
100022564c
commit
57f6fbd768
2 changed files with 5 additions and 8 deletions
|
|
@ -40,7 +40,7 @@ var dom = require("./lib/dom");
|
|||
var snippetManager = require("./snippets").snippetManager;
|
||||
|
||||
var Autocomplete = function() {
|
||||
this.autoInsert = true;
|
||||
this.autoInsert = false;
|
||||
this.autoSelect = true;
|
||||
this.exactMatch = false;
|
||||
this.gatherCompletionsId = 0;
|
||||
|
|
@ -408,10 +408,10 @@ Autocomplete.startCommand = {
|
|||
exec: function(editor) {
|
||||
if (!editor.completer)
|
||||
editor.completer = new Autocomplete();
|
||||
editor.completer.autoInsert =
|
||||
editor.completer.autoInsert = false;
|
||||
editor.completer.autoSelect = true;
|
||||
editor.completer.showPopup(editor);
|
||||
// needed for firefox on mac
|
||||
// prevent ctrl-space opening context menu on firefox on mac
|
||||
editor.completer.cancelContextMenu();
|
||||
},
|
||||
bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ var loadSnippetFile = function(id) {
|
|||
function getCompletionPrefix(editor) {
|
||||
var pos = editor.getCursorPosition();
|
||||
var line = editor.session.getLine(pos.row);
|
||||
var prefix = util.retrievePrecedingIdentifier(line, pos.column);
|
||||
var prefix;
|
||||
// Try to find custom prefixes on the completers
|
||||
editor.completers.forEach(function(completer) {
|
||||
if (completer.identifierRegexps) {
|
||||
|
|
@ -150,7 +150,7 @@ function getCompletionPrefix(editor) {
|
|||
});
|
||||
}
|
||||
});
|
||||
return prefix;
|
||||
return prefix || util.retrievePrecedingIdentifier(line, pos.column);
|
||||
}
|
||||
|
||||
var doLiveAutocomplete = function(e) {
|
||||
|
|
@ -158,8 +158,6 @@ var doLiveAutocomplete = function(e) {
|
|||
var text = e.args || "";
|
||||
var hasCompleter = editor.completer && editor.completer.activated;
|
||||
|
||||
|
||||
|
||||
// We don't want to autocomplete with no prefix
|
||||
if (e.command.name === "backspace") {
|
||||
if (hasCompleter && !getCompletionPrefix(editor))
|
||||
|
|
@ -174,7 +172,6 @@ var doLiveAutocomplete = function(e) {
|
|||
editor.completer = new Autocomplete();
|
||||
}
|
||||
// Disable autoInsert
|
||||
editor.completer.autoSelect = false;
|
||||
editor.completer.autoInsert = false;
|
||||
editor.completer.showPopup(editor);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue