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