Hydrogen: Improve toggle-inspector

Created on 20 Jul 2016  路  13Comments  路  Source: nteract/hydrogen

I like the Inspector a lot, and I think it would be great if it just showed up automatically, or if at least there was a keybinding to allow me to toggle it for a specific function without the need to go on the Internet and lose my flow.

All 13 comments

In the latest release we changed the behaviour of the inspector.

You can define a custom keyboard shortcut for yourself by adding

'atom-text-editor':
  'cmd-ctrl-i': 'hydrogen:toggle-inspector',

to your Atom keymaps file.

https://github.com/jupyter/jupyter_client/issues/51 will allow us to incorporate the introspection result in the autocompletion in the future.

@matthew-brett mentioned a similar behavior on slack.

We could update the Inspector on every cursor movement (or keyboard stroke) if it is open.
@rgbkrk @n-riesco Would this amount of inspect requests be OK?

Spyder also has an inspector. Does anyone know how they are handling the updating?

It depends on if inspect has a side effect on the object. I think for the Python kernel it's likely not too bad. Worth exploring to see!

Aha - yes - doing automatic inspection could trigger all sorts of nasty stuff, such as on-the-fly attribute creation and so on. How about a double click and / or a by-default keyboard shortcut?

Another issue with automatic inspection is that it may be an expensive operation (it's up to the kernel to decide how to honour detail_level). For example, IPython with detail_level set to 0 truncates the representation of large arrays. IJavascript, on the other hand, doesn't.

Several other of my colleagues say that the most sought-after feature hydrogen is lacking is the object inspector similar to the one Spyder has. In essence; showing the content of all variables at all times in a scrollable list.

@Trollgeir Have you tried the add watch functionality?

I have occasionally used the watch functionality, but this requires double declaration of variables (one in the code, one in the watch). It would be handy if there would be a functionality that does this automatically, unless I misunderstood some parts of the functionality?

What would others think about a PR that implements introspection as a tooltip? I'm thinking of something similar to the tooltip shown in @lgeiger's ide-python package. It could be turned off in the settings if desired (i.e. if introspection takes too long).

image

@kylebarron that looks like it could be a really nice enhancement! Since the original issue is not so specific to this, I think we should close and move your last comment to discuss in a new issue. Make sure to mention Lukas again when you open, I'd love to get his thoughts.

Will do. Wasn't sure whether to comment or add a new issue.

@BenRussert up to you whether to close this issue.

On the original topic, I am closing as I think automatically triggering inspect requests and rendering them would cause performance issues and possibly other side effects. Convieniently , one could develop a hydrogen plugin using kernel middleware to handle inspect requests and responses in a custom way.

You can also trigger inspect as needed with a keyboard shortcut, user customized if desired.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ethan92429 picture ethan92429  路  3Comments

HaoranXue picture HaoranXue  路  4Comments

homocomputeris picture homocomputeris  路  4Comments

neurotronix picture neurotronix  路  4Comments

danbri picture danbri  路  4Comments