Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Workspace CommandNew to Visual Studio Code? Get it now.
Workspace Command

Workspace Command

Manuel Padilla

|
207 installs
| (0) | Free
🔧 Command on all your files in a workspace with one click. Based on vscode-Workspace-formatter from Jan Schaffranek. 🔧
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

VSCode Workspace Command

🔧 Execute custom commands on files in your workspace with one click. 🔧

This extension allows you to define include and exclude patterns to manage which files and directories should be targeted.
You can also select specific directories to execute commands on with the context menu, and configure available commands to use.

Acknowledgments

This extension is inspired by and based on vscode-Workspace-formatter by Jan Schaffranek. The original extension focused on formatting documents, while VSCode Workspace Command extends the concept to executing any command available in the settings.

Example

ExampleGif

How to use: Execute Commands on the Whole Workspace

  1. Open the command palette (F1)
  2. Run the command: Workspace Command: Run on Workspace With ... or Run on Workspace (Default)
  3. The selected command will be executed w.r.t the include/exclude patterns

How to use: Execute Commands on Selected Directories

  1. Select any folder in the context menu, by right-clicking
  2. Run the context-menu command: Command on Directory With ... or Command on Directory (Default)
  3. The selected command will be executed w.r.t the include/exclude patterns

Extension Features

For including/excluding files, glob patterns are used.
For more information about glob patterns, see here.

Include Patterns for File Selection

You can add glob patterns to include specific file names.
By default, there is no include filter.

Example for including only TypeScript files:

"Workspace_Command.includePattern": ["*.ts"]

Exclude Folders for Selection

You can add glob patterns to exclude folder and file names.
Per default, all folders and files starting with a "." are excluded, also all directories that are called build.

For example, if you want to skip processing for javascript files in your workspace, you could add the following glob pattern:

"Workspace_Command.excludePattern": ["*.js"]

Configurable Commands

You can configure a list of available commands in settings, and optionally set a default command.

Example setting a list of commands:

"Workspace_Command.availableCommands": ["editor.action.formatDocument", "editor.action.organizeImports"]

Extension Settings

  • ⚙️ Glob pattern to include for file selection (defaults to ["*"])
  • ⚙️ Glob pattern to exclude from file selection (defaults to ["/build", "/.*", "**/.vscode"])
  • ⚙️ List of available commands to execute on each file
  • ⚙️ Default command to execute without prompting (can be left empty)
  • ⚙️ Whether to save the currently processed file (defaults to true)
  • ⚙️ Whether to close the currently processed file after executing the command (defaults to true)

Release Notes

Refer to the CHANGELOG.

License

Copyright (C) 2024 Manuel Padilla.
Licensed under the MIT License.

Supporting the Work

Feel free to make a donation, such that i have more time to work on my VSCode extensions.

PayPal QR Code

Or use the Link: https://www.paypal.com/donate/?hosted_button_id=Z8TBF8H6Y3KXC

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft