Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"command" to go to a specific cell (by cell number and line number) #112

Open
IndianBoy42 opened this issue May 21, 2024 · 4 comments
Open

Comments

@IndianBoy42
Copy link

I am trying to write my neovim plugin that opens euporie in a separate terminal but edits the notebook in neovim.

I need a good way to synchronize the cursor position in the editor with the selected cell in euporie and make sure when I hit the "run cell" binding in neovim it runs the correct cell in euporie

it would be nice to be able to send for example c-g # and it selects the cell by number

@IndianBoy42
Copy link
Author

An equivalent to run a specific numbered cell would be nice as well

@phromo
Copy link

phromo commented May 22, 2024

I desired something similar, but my initial idea was to run euporie-console in a separate terminal and just send cell contents from my editor to the console. I figured there are two ways to send contents to the console:

    1. Send as keypresses to the terminal. This will "echo" the text in the cell. (( ECHO=ON ))
    1. Connecting to the running kernel in a hidden terminal (or process) and send the input there. Euporie-console will actually show the output only (( ECHO=OFF ))

I actually came here today because I wanted a nicer UX for (2) -- currently the output is appended to the current Out [nn], I want a new Out on each eval.

@joouha if you are willing to describe some thoughts on a "editor integration" epic, I would be happy to code some improvements and add docs. But would be nice to know if this a direction you would accept a PR for.

@IndianBoy42 do you believe sending cells to euporie-console would solve your usecase as well? This mimics the UI of vscode or atom+hydrogen pretty well in that you have a two-pane setup, you edit your notebook in the editor and eval in the second pane. You also use the second pane (euporie-console) to fiddle/debug. To me having the entire notebook open twice seems unnecessary, do you agree?

@IndianBoy42
Copy link
Author

TBH i am currently split on whether the console or notebook view in a separate terminal is better. So in my free time I'm implementing both haha. I have the console version working oka. I kinda like the idea of connecting to the running kernel so the input is not shown, another way to achieve that may be to have euporie support folding/collapsing the input, because sometimes I might actually want to go back in the history and see what code was run for some output.

The main reason i'd have notebook view, or something like it, is to keep the order of the output the same as the code in the notebook and not have multiple copies of the output of the same cell. a notebook view but folding the code cells so mostly only the output is visible could be nice to eliminate the redundancy

@joouha
Copy link
Owner

joouha commented Oct 10, 2024

@phromo

I like your second idea - I believe this is how the Jupyter protocol has been designed to work.

I've recently made a few improvements to make the console work better with multiple kernel clients. It will now display inputs & outputs from other connected clients, with the option to disable the display or remote inputs / outputs.

You could use this to connect euporie to an existing kernel just for displaying output, so if you can send code to a kernel from neovim, euporie-console can be used to display the output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants