##// END OF EJS Templates
Closes #3788
Jessica B. Hamrick -
Show More
@@ -167,7 +167,9 b' var IPython = (function (IPython) {'
167 // triger on keypress (!) otherwise inconsistent event.which depending on plateform
167 // triger on keypress (!) otherwise inconsistent event.which depending on plateform
168 // browser and keyboard layout !
168 // browser and keyboard layout !
169 // Pressing '(' , request tooltip, don't forget to reappend it
169 // Pressing '(' , request tooltip, don't forget to reappend it
170 IPython.tooltip.pending(that);
170 // The second argument says to hide the tooltip if the docstring
171 // is actually empty
172 IPython.tooltip.pending(that, true);
171 } else if (event.which === key.UPARROW && event.type === 'keydown') {
173 } else if (event.which === key.UPARROW && event.type === 'keydown') {
172 // If we are not at the top, let CM handle the up arrow and
174 // If we are not at the top, let CM handle the up arrow and
173 // prevent the global keydown handler from handling it.
175 // prevent the global keydown handler from handling it.
@@ -39,6 +39,9 b' var IPython = (function (IPython) {'
39 // 'sticky ?'
39 // 'sticky ?'
40 this._sticky = false;
40 this._sticky = false;
41
41
42 // display tooltip if the docstring is empty?
43 this._hide_if_no_docstring = false;
44
42 // contain the button in the upper right corner
45 // contain the button in the upper right corner
43 this.buttons = $('<div/>').addClass('tooltipbuttons');
46 this.buttons = $('<div/>').addClass('tooltipbuttons');
44
47
@@ -178,10 +181,10 b' var IPython = (function (IPython) {'
178 }
181 }
179
182
180 // will trigger tooltip after timeout
183 // will trigger tooltip after timeout
181 Tooltip.prototype.pending = function (cell) {
184 Tooltip.prototype.pending = function (cell, hide_if_no_docstring) {
182 var that = this;
185 var that = this;
183 this._tooltip_timeout = setTimeout(function () {
186 this._tooltip_timeout = setTimeout(function () {
184 that.request(cell)
187 that.request(cell, hide_if_no_docstring)
185 }, that.time_before_tooltip);
188 }, that.time_before_tooltip);
186 }
189 }
187
190
@@ -212,7 +215,7 b' var IPython = (function (IPython) {'
212 }
215 }
213
216
214 // make an imediate completion request
217 // make an imediate completion request
215 Tooltip.prototype.request = function (cell) {
218 Tooltip.prototype.request = function (cell, hide_if_no_docstring) {
216 // request(codecell)
219 // request(codecell)
217 // Deal with extracting the text from the cell and counting
220 // Deal with extracting the text from the cell and counting
218 // call in a row
221 // call in a row
@@ -224,6 +227,8 b' var IPython = (function (IPython) {'
224 ch: 0
227 ch: 0
225 }, cursor).trim();
228 }, cursor).trim();
226
229
230 this._hide_if_no_docstring = hide_if_no_docstring;
231
227 if(editor.somethingSelected()){
232 if(editor.somethingSelected()){
228 text = editor.getSelection();
233 text = editor.getSelection();
229 }
234 }
@@ -312,8 +317,6 b' var IPython = (function (IPython) {'
312 this.arrow.animate({
317 this.arrow.animate({
313 'left': posarrowleft + 'px'
318 'left': posarrowleft + 'px'
314 });
319 });
315 this.tooltip.fadeIn('fast');
316 this._hidden = false;
317
320
318 // build docstring
321 // build docstring
319 var defstring = reply.call_def;
322 var defstring = reply.call_def;
@@ -331,10 +334,15 b' var IPython = (function (IPython) {'
331 if (docstring == null) {
334 if (docstring == null) {
332 docstring = reply.docstring;
335 docstring = reply.docstring;
333 }
336 }
334 if (docstring == null) {
337
338 if (docstring == null && this._hide_if_no_docstring) {
339 return;
340 } else {
335 docstring = "<empty docstring>";
341 docstring = "<empty docstring>";
336 }
342 }
337
343
344 this.tooltip.fadeIn('fast');
345 this._hidden = false;
338 this.text.children().remove();
346 this.text.children().remove();
339
347
340 var pre = $('<pre/>').html(utils.fixConsole(docstring));
348 var pre = $('<pre/>').html(utils.fixConsole(docstring));
General Comments 0
You need to be logged in to leave comments. Login now