Skip to content

Commit

Permalink
[simplehint util] Support completeSingle option
Browse files Browse the repository at this point in the history
To turn off the behavior where it'll always complete when only
a single option is left.
  • Loading branch information
marijnh committed Oct 4, 2012
1 parent 49d9652 commit 6f8f652
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/util/simple-hint.js
Expand Up @@ -25,7 +25,10 @@
editor.replaceRange(str, result.from, result.to);
}
// When there is only one completion, use it directly.
if (completions.length == 1) {insert(completions[0]); return true;}
if (options.completeSingle && completions.length == 1) {
insert(completions[0]);
return true;
}

// Build the select widget
var complete = document.createElement("div");
Expand Down Expand Up @@ -92,6 +95,7 @@
};
CodeMirror.simpleHint.defaults = {
closeOnBackspace: true,
closeOnTokenChange: false
closeOnTokenChange: false,
completeSingle: true
};
})();

0 comments on commit 6f8f652

Please sign in to comment.