Code Runner for Visual Studio Code

Download: Code Runner for Visual Studio Code

I have been developing WordPress as well as writing the best language of the world for over 1 year. Sometimes, I write or get a small piece of PHP code and want to run it immediately to see whether it works as expected or how it works. Unfortunately, I always forget whether it is php -f or php -r to run a php file or php code snippet. I need to Google it and then open a shell and then type the command and then copy/paste the code snippet and then run it. Therefore, I decide to write this extension.😁

Current version supports JavaScript, PHP, Perl, Python, Ruby and Go. And more language support is coming soon. (Update: In v0.0.2, Lua and Groovy are supported. In v0.0.3, powershell, bat/cmd and bash/sh are supported. For more updates, please see the Change Log.)

The most useful point of this extension is that you could select some lines of code and then kick off the run immediately. To implement this, I just need to create a temp file with the selected code, then call the corresponding interpreter to run the file. All languages should work well without any special handling, except PHP and Python. 😦 Yes, you know. For PHP, the PHP file need to start with <?php. But how about the selected php code snippet? They may not have the <?php at the beginning. No problem, just add it if there’s no <?php to resolve this. And for Python? 🙂 Currently, I haven’t dealt with it because I do not want to do too much special handling for its amazing code style. But if users really want the full support for Python, I may consider supporting it as well.



14 thoughts on “Code Runner for Visual Studio Code

  1. You can add Powershell and BAT/CMD files:

    // Set the executor of each language.
    “code-runner.executorMap”: {
    “powershell”: “powershell.exe”,
    “bat”: ” ”


    1. Hi Jahan, first, you need to install scriptcs. Then there will be three ways to run C# script:
      #1 use shortcut Ctrl+Alt+J, or press F1 and then select/type Run By Language, then type the language csharp. You could refer to below gif which is to run pyhton

      #2 Set default language as csharp, then use shortcut Ctrl+Alt+N, or press F1 and then select/type Run Code

          "code-runner.defaultLanguage": "csharp"

      #3 If you have installed C# extension, you could open a .cs or .csx file, then use shortcut Ctrl+Alt+N, or press F1 and then select/type Run Code


  2. can someone help me, i have installed the extension, but i still can’t run my C languange program. it said [Running] cd “c:UsersDIMASDesktop” && gcc test.c -o test && “c:UsersDIMASDesktop”test
    ‘gcc’ is not recognized as an internal or external command,
    operable program or batch file.

    [Done] exited with code=1 in 0.123 seconds

    i had no idea what i will do with the setting, so i’m still not adding anything to my preference settings yet. Can someone help me ?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s