#run main.py in VS Code with 1 click + without it being the active file + without opening debug + ..

9 messages · Page 1 of 1 (latest)

zealous nymph
#

I want to run main.py in VS Code with 1 click + without it being the active file + without opening debug + without shortcuts. Just one simple mouse click.
I tried different solutions. The best I can get it is 2 clicks using mouse and keyboard with launch.json
The problem is the debug is being used. I just want it to run main fast, without the overhead of debug. If I run main as the active file, it runs instantly. If I run it via debug, it takes a few seconds to load.
Here is how I configured my launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Run Main",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}/main.py",
            "console": "integratedTerminal"
        }
    ]
}
orchid cipher
#

That's normal, I'd probably just Ctrl+J and then run it from the terminal

fiery heart
#

You could assign a macro to your keyboard(if it has keys for that) like focus terminal- python main.py

#

Or assign a keyboard shortcut to do that. I don't remember tho if you can do so much

#

also I found a 'run main.py ' extension . you could give it a look

solar gale
#

Why without shortcuts? Not using a mouse is the most efficient way to use a computer

orchid cipher
#

Ctrl + J -> Arrow up -> Enter

solar gale
#

Just use PyCharm CTRL+R

orchid cipher
#

just use vim tbh