smart kwarg completion

change order of completion element so that the ones ending with '='
	will be at the beginning of the list. When you complete inside a
	fonction call, you then have kwargs first add configuration in the left
	pannel
Matthias BUSSONNIER 15 years ago
parent 2637d3c0e4
commit 7600221d1c

@ -119,6 +119,10 @@ span.section_row_buttons a {
float: right;
}
#smartcompleter_span {
float: right;
}
.checkbox_label {
font-size: 85%;
float: right;

@ -179,6 +179,19 @@ var IPython = (function (IPython) {
CodeCell.prototype.finish_completing = function (matched_text, matches) {
// console.log("Got matches", matched_text, matches);
var newm = new Array();
if(this.notebook.smart_completer)
{
kwargs = new Array();
other = new Array();
for(var i=0;i<matches.length; ++i){
if(matches[i].substr(-1) === '='){
kwargs.push(matches[i]);
}else{other.push(matches[i]);}
}
newm = kwargs.concat(other);
matches=newm;
}
if (!this.is_completing || matches.length === 0) {return;}
var that = this;

@ -28,6 +28,7 @@ var IPython = (function (IPython) {
this.create_elements();
this.bind_events();
this.set_tooltipontab(true);
this.set_smartcompleter(true);
this.set_timebeforetooltip(1200);
};
@ -633,6 +634,11 @@ var IPython = (function (IPython) {
this.tooltip_on_tab = state;
};
Notebook.prototype.set_smartcompleter = function (state) {
console.log("Smart completion (kwargs first) changed to to : "+state);
this.smart_completer = state;
};
Notebook.prototype.set_autoindent = function (state) {
var cells = this.cells();
len = cells.length;

@ -262,6 +262,12 @@
</span>
<span class="checkbox_label" id="tooltipontab_label">Tooltip on tab:</span>
</div>
<div class="section_row">
<span id="smartcompleter_span">
<input type="checkbox" id="smartcompleter" checked="true"></input>
</span>
<span class="checkbox_label" id="smartcompleter_label">Smart completer:</span>
</div>
<div class="section_row">
<span id="tooltipontab_span">
<input type="text" id="timebeforetooltip" value="1200"></input>

Loading…
Cancel
Save