##// END OF EJS Templates
smart kwarg completion...
Matthias BUSSONNIER -
Show More
@@ -119,6 +119,10 b' span.section_row_buttons a {'
119 float: right;
119 float: right;
120 }
120 }
121
121
122 #smartcompleter_span {
123 float: right;
124 }
125
122 .checkbox_label {
126 .checkbox_label {
123 font-size: 85%;
127 font-size: 85%;
124 float: right;
128 float: right;
@@ -179,6 +179,19 b' var IPython = (function (IPython) {'
179
179
180 CodeCell.prototype.finish_completing = function (matched_text, matches) {
180 CodeCell.prototype.finish_completing = function (matched_text, matches) {
181 // console.log("Got matches", matched_text, matches);
181 // console.log("Got matches", matched_text, matches);
182 var newm = new Array();
183 if(this.notebook.smart_completer)
184 {
185 kwargs = new Array();
186 other = new Array();
187 for(var i=0;i<matches.length; ++i){
188 if(matches[i].substr(-1) === '='){
189 kwargs.push(matches[i]);
190 }else{other.push(matches[i]);}
191 }
192 newm = kwargs.concat(other);
193 matches=newm;
194 }
182 if (!this.is_completing || matches.length === 0) {return;}
195 if (!this.is_completing || matches.length === 0) {return;}
183
196
184 var that = this;
197 var that = this;
@@ -28,6 +28,7 b' var IPython = (function (IPython) {'
28 this.create_elements();
28 this.create_elements();
29 this.bind_events();
29 this.bind_events();
30 this.set_tooltipontab(true);
30 this.set_tooltipontab(true);
31 this.set_smartcompleter(true);
31 this.set_timebeforetooltip(1200);
32 this.set_timebeforetooltip(1200);
32 };
33 };
33
34
@@ -633,6 +634,11 b' var IPython = (function (IPython) {'
633 this.tooltip_on_tab = state;
634 this.tooltip_on_tab = state;
634 };
635 };
635
636
637 Notebook.prototype.set_smartcompleter = function (state) {
638 console.log("Smart completion (kwargs first) changed to to : "+state);
639 this.smart_completer = state;
640 };
641
636 Notebook.prototype.set_autoindent = function (state) {
642 Notebook.prototype.set_autoindent = function (state) {
637 var cells = this.cells();
643 var cells = this.cells();
638 len = cells.length;
644 len = cells.length;
@@ -140,6 +140,8 b' var IPython = (function (IPython) {'
140 this.content.find('#timebeforetooltip').attr('title', 'Time before a tooltip auto-appear when "(" is pressed (negative value supress tooltip)');
140 this.content.find('#timebeforetooltip').attr('title', 'Time before a tooltip auto-appear when "(" is pressed (negative value supress tooltip)');
141 this.content.find('#timebeforetooltip_label').attr('title', 'Time before a tooltip auto-appear when "(" is pressed (negative value supress tooltip)');
141 this.content.find('#timebeforetooltip_label').attr('title', 'Time before a tooltip auto-appear when "(" is pressed (negative value supress tooltip)');
142
142
143 this.content.find('#smartcompleter').attr('title', 'When inside function call, completer try to propose kwargs first');
144 this.content.find('#smartcompleter_label').attr('title', 'When inside function call, completer try to propose kwargs first');
143 };
145 };
144
146
145
147
@@ -153,6 +155,10 b' var IPython = (function (IPython) {'
153 var state = $('#timebeforetooltip').prop('value');
155 var state = $('#timebeforetooltip').prop('value');
154 IPython.notebook.set_timebeforetooltip(state);
156 IPython.notebook.set_timebeforetooltip(state);
155 });
157 });
158 this.content.find('#smartcompleter').change(function () {
159 var state = $('#smartcompleter').prop('checked');
160 IPython.notebook.set_smartcompleter(state);
161 });
156 };
162 };
157
163
158 // CellSection
164 // CellSection
@@ -263,6 +263,12 b''
263 <span class="checkbox_label" id="tooltipontab_label">Tooltip on tab:</span>
263 <span class="checkbox_label" id="tooltipontab_label">Tooltip on tab:</span>
264 </div>
264 </div>
265 <div class="section_row">
265 <div class="section_row">
266 <span id="smartcompleter_span">
267 <input type="checkbox" id="smartcompleter" checked="true"></input>
268 </span>
269 <span class="checkbox_label" id="smartcompleter_label">Smart completer:</span>
270 </div>
271 <div class="section_row">
266 <span id="tooltipontab_span">
272 <span id="tooltipontab_span">
267 <input type="text" id="timebeforetooltip" value="1200"></input>
273 <input type="text" id="timebeforetooltip" value="1200"></input>
268 </span>
274 </span>
General Comments 0
You need to be logged in to leave comments. Login now