0

I recently installed the extension Code Runner in VS Code. I was testing it out in an untitled file and everything was working perfectly. However, when I saved the file and tried using Code Runner I start experiencing problems. It will run once and give the expected output, but any attempts at running it afterwards always produces the expected output from the first time. It works fine only in unsaved files. I thought no configurations were needed for this extension, but it seems like that is where the problem might lie. Any help is greatly appreciated. Thanks.

I have tried uninstalling the extension and then reinstalling along with restarting my computer. Below is just an example of how it is acting.

The file I have it saved in currently is C:\projects\Eleoquent Javascript Exercises\exercises.js

console.log(9) // prints out 9
console.log(5) // still prints out 9 
RCE11
  • 29
  • 8

3 Answers3

0

If anyone else if having this problem, I have found the simple solution! All you have to do is save your file before running. So simple not sure why it took so long to figure out. There is even a user setting that auto saves before running. Hope this helps someone out in the future.

RCE11
  • 29
  • 8
0
  1. file > preferences > settings
  2. Search for "code-runner: run in terminal" in the search setting field
  3. Enable code-runner: run in terminal
  4. Enjoy working with vscode
Hamidreza
  • 139
  • 1
  • 12
0

As RCE suggested above. I used Autosave user setting and that helped me.enter image description here