Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Script runNew to Visual Studio Code? Get it now.
Script run

Script run

Can Nguyen

|
13 installs
| (0) | Free
Run a command/script from the editor window
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Script runner for Visual Studio Code

By default, this extension display a "Run script" button above every function call script('Script name', whatever) in any files end with .script.{js,ts,tsx,jsx} The function name, button(s) and command(s) can be customized. For example to add button(s) for function foo, add the following settings to either .vscode/settings.json, extension settings or User settings. The "foo" is required, while other "foo-*" are to add more command buttons

{
  "fbc.scriptrunner.functions": {
    "foo": {
      "command": "npx tsx {filePath} {scriptName}",
      "title": "Run with tsx"
    },
    "foo-whatever-1": {
      "command": "npx ts-node {filePath} {scriptName}",
      "title": "Run with ts-node"
    },
    "foo-whatever-2": {
      "command": "echo 'Hello, world'",
      "title": "Hello"
    },
  }
}

Example of usage:

result

And the corresponding configuration file (.vscode/settings.json): configuration

Configuration

.vscode/settings.json

You can use the following configurations to customize the behavior of the Script runner extension.

{
  "fbc.scriptrunner.filePattern": {
    "type": "string",
    "default": "**/*.script.{js,ts,tsx,jsx}",
    "description": "Glob pattern to match test files (e.g., **/*.script.{js,ts,tsx,jsx})"
  },
  "fbc.scriptrunner.functions": {
    "type": "object",
    "additionalProperties": {
      "type": "object",
      "properties": {
        "command": {
          "type": "string",
          "description": "Command to execute. Supported variables: {filePath} {scriptName}",
          "default": "npx tsx {filePath} {scriptName}"
        },
        "title": {
          "type": "string",
          "description": "Title to display",
          "default": "Run script"
        }
      }
    },
    "default": {
      "script": {
        "command": "npx tsx {filePath} {scriptName}",
        "title": "Run script"
      }
    }
  }
}
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft