Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code Run On Save Extension not running

I installed the Run On Save extension for VS Code. I made a Workspace setting for it, and if I change a file then resave, it does not seem to run. "I run for all files" does not show up in the console or terminal.

When I chose to edit the command configuration in my Workspace settings, it automatically edited the file with the comment "Place your settings in this file to overwrite default and user settings." so it looks like this:

// Place your settings in this file to overwrite default and user settings.
{
    "editor.mouseWheelZoom": false,
    "emeraldwalk.runonsave": {
        "commands": [
            {
                "match": ".*",
                "isAsync": true,
                "cmd": "echo 'I run for all files'"
            }
        ]
    }
}

I'm new to configuring Workspace settings, so I'm not sure if this is okay or not. I ensured that Run On Save is enabled by selecting it on the command palette.

Here is the site for the extension: https://marketplace.visualstudio.com/items?itemName=emeraldwalk.RunOnSave

like image 632
Chewie The Chorkie Avatar asked Apr 18 '17 14:04

Chewie The Chorkie


People also ask

Why are my Extensions not working in VS Code?

The solution was to go to Windows PowerShell and open Visual Studio Code, then go to the extensions and restart the Remote - WSL extension, and go back to WSL. It then started working immediately.

How use run on save VS Code?

If you don't already know how to, you can get there by going to File > Preferences > Settings or hitting Ctrl + ,(Cmd + , if you're on a Mac). Then click the Extensions tab on the left side menu, look for the extension Run On Save, and click Edit in settings. json. Run On Save settings page.

How do I enable an extension in VS Code?

You can browse and install extensions from within VS Code. Bring up the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of VS Code or the View: Extensions command (Ctrl+Shift+X). This will show you a list of the most popular VS Code extensions on the VS Code Marketplace.

How do I enable the Run button in VS Code?

To bring up the Run and Debug view, select the Run and Debug icon in the Activity Bar on the side of VS Code. You can also use the keyboard shortcut Ctrl+Shift+D.


2 Answers

In order to see the console output, you have to be in the Output tab and select the Run On Save option in the dropdown. The extension was created before the integrated terminal existed and hasn't seen a major update in a while.

enter image description here

Regarding the comment that was added to your config:

// Place your settings in this file to overwrite default and user settings.

is unrelated to this particular extension. It is just vscode letting you know the purpose of the workspace level configuration. It allows you to override a subset of your more global user / default settings. This allows you to keep reasonable default preferences but to customize certain specific things in any given workspace.

Regarding the original RunOnSave extension, feel free to file an issue here https://github.com/emeraldwalk/vscode-runonsave/issues if you have any questions or problems. I would also welcome pull requests if anyone is interested.

like image 172
bingles Avatar answered Oct 24 '22 08:10

bingles


I had the exact same issue. I removed that extension and am using this one instead:

https://marketplace.visualstudio.com/items?itemName=wk-j.save-and-run

It is a fork based on RunOnSave. This one works for me when I set its configuration in my user settings and then run the command "Save and Run: Enable".

This one uses the bulit-in powershell terminal.

HTH

like image 45
C. Suttle Avatar answered Oct 24 '22 10:10

C. Suttle