[IPython-dev] Questions on implementing some notebook frontend extensions

MinRK benjaminrk at gmail.com
Sat Mar 7 15:17:50 EST 2015

On Fri, Mar 6, 2015 at 11:50 PM, Andrew Gibiansky <
andrew.gibiansky at gmail.com> wrote:

> Hey all,
> I have a few frontend modifications I'd like to make for the IHaskell
> kernel, and I'd love to get some pointers on where to start and how
> feasible these are. I have some ideas, but since you are much more familiar
> with the client-side JS than I am, I'd like to hear if you think these are
> possible and/or reasonable, and perhaps how you would approach them (no
> detailed response required, maybe just something like "Use the CodeMirror
> api" or "we have some undocumented capabilities for this in IPython" or
> "wait until CodeMirror 5" or "impossible").
> The extensions are:
> 1. Get some info about an identifier from the kernel when I hover my mouse
> over that identifier, and display it as a popup.
> Idea: Use CodeMirror API and IPython comms to communicate with kernel.

I think CM.coorsChar is the relevant API.

You might not need to use comms for this one, if `inspect_request` is the
right action. If the output should be distinguished from inspection via
other means, then a custom comm would be appropriate.

> 2. Add a keyboard shortcut to automatically reformat a cell, and have this
> actually change the contents of whichever cell is currently selected,
> provided it is a Haskell cell.
> Idea: Use the IPython API to add a keyboard shortcut, use comms to
> communicate with backend to do reformatting, use IPython API to get
> currently selected cell and send contents to kernel via comm, and  use
>  IPython APIs to change the contents of a cell.

Sounds right to me.

> If you have any suggestions for better routes, words of caution, I'd love
> to hear them.
> (As an aside, one reason I am asking like this rather than just going
> ahead and trying it and seeing how far I get is that some of these may be
> tackled by some other contributors to IHaskell; I would like to make sure I
> am not sending them off on a wild goose chase with a method that is
> overcomplicated or unlikely to work before giving them instructions.)

I see no geese here to chase.

> Thanks!
> Andrew
> PS. IHaskell `master` now supports IPython 3.0. There's still a bit of
> work to be done before I'm ready to make a Jupyter-ready *release*, but it
> is no more than a week or two out. So far, I've really enjoyed working with
> IPython 3; the interface is great, the kernel interface is well thought out
> (if perhaps missing a few things I want, but there's always room for
> extension, I hope :) ), and all in all it's been very good.

Great to hear that 3.0 is working out for you. Can you describe the missing
things? It may be a while before there's another revision, but it's good to
keep track of what shortcomings kernel authors find, so we can make the
right adjustments in the future.


> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20150307/b88c506d/attachment.html>

More information about the IPython-dev mailing list