hoangKnLai / vscode-ipython

VSCode Extension integrating Editor with IPython console.
MIT License
18 stars 5 forks source link

Wrap "run cell" in a method? #19

Closed ma-sadeghi closed 1 year ago

ma-sadeghi commented 2 years ago

Currently, if I run a cell, the entire contents of the cell, which might be tens of lines of code gets pasted in the console. It'd be nice if you could wrap the call in a method like runcell(cell_id, file), which would show up instead in the console. This is how it's done in Spyder and I really like it as it keeps the console clean. Here's a screenshot from Spyder:

image

hoangKnLai commented 2 years ago

TL;DR: to do what you're asking I think there needs to be a IPython API in typescript and/or javascript before an attempt to integrate it with VSCode. The API piece likely can only be done well by the IPython team.

The long version: I would like this too and tried to do something similar with the %load command in the previous major release. The %load command tends to have issue with autoindentation and empty newline between code blocks. Hence, the motivation toward the recent changes to self handle the code loading to the terminal instead of %load.

I also did look into IPython REPL and how Spyder uses it and here are what I found:

VSCode is typescript and I'm no typescript expert. All I found and attempted so far:

hoangKnLai commented 1 year ago

Updated to include a Send Command option that uses file instead of clipboard. The file is similar in which is shows a dozen lines or so of the bottom of the code block and nothing more. See if this is ok enough to close this issue?