Reputation: 3562
In PyCharm, there's a handy button next to if __name__...
statements that runs a script,
with configurations for the run in a run configurations menu.
One of the options is to "Run with Python Console":
This is really handy, because I can run my in-progress script in the console without ponderously highlighting and ctrl-entering. I'm then in the console, with everything I just did in memory, and I can go and continue writing my code using the REPL to check how things are working along the way.
In VScode, when I hit the run button
It just runs the script from the terminal. I can see any output that it prints, but it doesn't drop me into a REPL interface like I'm accustomed with PyCharm.
Is this sort of functionality attainable with VSCode?
Upvotes: 2
Views: 1908
Reputation: 33
I've been looking for exactly the same functionality. Following two other stackoverflow posts you can get the desired behaivor -> executing in an REPL ipython terminal (original links at the end of the post):
edit the terminal launchArgs in settings.json (Preference: Open Settings JSON; or Preference -> Settings -> Search launchArgs -> edit in json):
"python.terminal.launchArgs": [
"-i",
"-m",
"IPython",
"--no-autoindent",
]
Reference Links:
Upvotes: 2
Reputation: 8421
VSCode without this functionality, but it has some similar functionalities:
Ctrl+A
-> rightclick -> Run Selection/Line in Python Terminal
.Run Current File in Interactive Window
Upvotes: 2