In VS Code, how do you stop code that is running via the Code Runner extension?
Asked Answered
A

7

14

I'm running a python flask server locally by clicking the run button in VS Code (provided by the Code Runner extension).

How do I stop the server without closing and restarting VS Code?

Alkene answered 24/9, 2019 at 1:2 Comment(0)
S
33

From the Code Runner extension marketplace page, you have the following options:

To stop the running code:

  • use shortcut Ctrl + Alt + M
  • or press F1 and then select/type Stop Code Run
  • or right click the Output Channel and then click Stop Code Run in context menu

YMMV with the Ctrl + Alt + M shortcut, which does not work for me for some reason.

Shephard answered 24/9, 2019 at 1:14 Comment(2)
Works perfectly. But I am using code runner for dart, When i run the code in terminal it uses the entire path of the file, while the terminal is already opened in the project directory. This is causing the process to be slow. Is there a way to just use the path with respect to the project directory?Legitimate
That's a good question, and one I don't yet know the answer to. I would suggest that you create a new question and ask it there so that it gets more visibility and has more chance to help others.Shephard
C
1

Mihai Chelaru has already answered the question, but I just wanted to let everyone know that by changing from Ctrl + Alt + M to e.g. Ctrl + Alt + B, the code run does stop.

Carleencarlen answered 3/1, 2021 at 22:14 Comment(4)
Was it also not working with Ctrl + Alt + M for you? Do you know why this happens?Shephard
@MihaiChelaru Yes, it wasn't working for me with Ctrl + Alt + M. I haven't investigated the issue, so I don't know why that happens.Carleencarlen
@Carleencarlen I changed the bindings to ctrl + alt + B for coderunner stop code and it still isn't working.Precipitous
@Precipitous Strange. Unfortunately, I can't help. Maybe ask a new question or something?Carleencarlen
K
1

For accepting input, you should enable the setting shown below, otherwise it will show code is running.

Open VS Code Settings UI and type 'code runner'. Scroll down a little bit, find this 'code-runner: run in terminal' and enable it. Then restart VsCode.

enter image description here

Karlmarxstadt answered 20/2, 2021 at 14:12 Comment(0)
N
0

You can use these methods to solve your problem:

  1. Press Ctr+Alt+M to clear your previous output and then run the code again.

  2. You can go to the bottom left of your VS Code page and click on Settings (a gear icon) and select Settings. Then type "code runner" and select the first option "Clear the previous output." That's it.

Napoleonnapoleonic answered 27/1, 2021 at 16:39 Comment(0)
B
0

If ctrl+alt+m is not working for you, click on the red square symbol beside the symbol for running the code at the upper-right side of the screen, then save and run again.

Beverlybevers answered 16/5 at 21:28 Comment(0)
D
-1

Use Ctrl+Alt+M or F1 and then select/type Stop Code Run

Other useful Code Runner Commands you can use can be found here: CodeRunner

Dryclean answered 29/6, 2021 at 19:56 Comment(0)
H
-1

see if ctrl+alt+M is not working for me, and if you are using coderunner in your computer then see at the top right side there red color square icon symbolizing coderunner just click on that the code will stop running

Herzberg answered 21/6 at 11:58 Comment(1)
This is just repeating other answers.Communalize

© 2022 - 2024 — McMap. All rights reserved.