0

I'm using VSC for JavaScript. Question: surely there's an easy way to run a "Hello World" macro from editor with a single keystroke? Currently I have to:

  1. Toggle to console with custom keyboard shortcut
  2. Enter filename (e.g. "HelloWorld.js" or up arrow)
  3. "Enter" key to run
  4. Toggle back to editor with custom keyboard shortcut

Learning JavaScript/NodeJS, coding background is Excel VBA (long story...). I'm used to VBA Macro Editor where you do all above by hitting F5 VBA Editor (or step through with F8). Code runs on spreadsheet or 'Immediate Window' below - see photo. Can do similar on online editors like Repl.it with "Run" button Repl.it.

How do you do this in VSC?

2

1 Answer 1

0

The easiest solution to your problem is using an extension called Code Runner. I have used this for C++ in VSC and works equally well in literally every programming language.It gives you your console output in the terminal itself (As in here) Funnily enough I,also use F5 for running code and you can do the same by-

  • Typing F1 and typing Run code and changing its settings like here and you are done
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.