dccsillag / magma-nvim

Interact with Jupyter from NeoVim.
GNU General Public License v3.0
992 stars 50 forks source link

REQUEST: Variable explorer #21

Open codemeleon opened 3 years ago

codemeleon commented 3 years ago

Hi,

I would like to see a variable explorer feature in your plugin. Please check https://www.reddit.com/r/vim/comments/hl0paq/finally_figured_out_how_to_work_in_vim_with/ for more detail.

Thank you.

dccsillag commented 3 years ago

I previously thought that this would be impossible to do in a cross-language manner, since I thought it was not really part of the Jupyter protocol. However, I've just remembered that there is a section of the documentation which I had just glossed over, which is support for DAP and extensions for it: https://jupyter-client.readthedocs.io/en/stable/messaging.html#additions-to-the-dap

In particular, it looks like there is an inspectVariables and a richInspectVariables requests, which seem like exactly what we need for this.

So this is definetly possible.

pfitzn commented 1 year ago

I enthusiastically subscribe to this request.

benlubas commented 11 months ago

@codemeleon @GoodGuyPat I know that it's been a long time, I'm not sure if you would still be interested in this, but I'm willing to take a shot at implementing it.

I'm thinking just a window that opens with a list of variable names and values, hitting enter on one would pop open more information.

Is there anything that I'm missing?

pfitzn commented 11 months ago

@codemeleon @GoodGuyPat I know that it's been a long time, I'm not sure if you would still be interested in this, but I'm willing to take a shot at implementing it.

I'm thinking just a window that opens with a list of variable names and values, hitting enter on one would pop open more information.

Is there anything that I'm missing?

Hey! From my side, I am still very eager to see this happen! A panel with the output of the %whos ipython command would already be hella helpful, and the option of (as you mention) expand on the contents of those variables would be awesome.

Not sure to what extent it could be an useful base, but the Spyder plugin Variable Explorer does exactly that, and I suspect it to be where many of us are coming from with this requirement.

benlubas commented 11 months ago

So I didn't see this comment until just now, but I just spent the better part of 20 minutes looking at https://github.com/ipselium/cpyvke (the variable explorer linked in the reddit post) to see how it requests the variable info, and I got to the point where it seemed to be executing the code whos and i was so confused. and now it makes sense lol

But this is very doable now. I'm not sure if there's more variable information to gain from the method that dccsillag mentioned above, so I'm going to move forward with just the data returned from the whos command

benlubas commented 11 months ago

I have a very rough version of this working here: https://github.com/benlubas/magma-nvim/tree/variable_explorer

I'll note that's a branch off of my main branch which has a lot of other changes, so using it would require switching image providers to image.nvim.

https://github.com/dccsillag/magma-nvim/assets/56943754/a1939dd1-14d1-4788-a456-a3a9b32a0138

Current list of glaring issues that I need to fix:

Is something like this what you had in mind @GoodGuyPat ?