Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>WatchFileNew to Visual Studio Code? Get it now.
WatchFile

WatchFile

kibernet

| (0) | Free
Run external commands on file save/change with macro expansion (like IntelliJ File Watchers).
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

WatchFile for VSCode

Extension to run external commands when files are saved or changed.

This extension allows you to configure watchers in your settings.json and expand macros (like $FilePath$, $FileDir$) to execute dynamic commands.

Features

  • Trigger commands automatically on file save
  • Filter triggered files using simple glob patterns
  • Replace macros like $FilePath$ and $FileName$
  • View output in a dedicated Output Console
  • Configure environments and working directories dynamically

Configuration

In your settings.json (Workspace or User settings), add the watchfile.watchers array:

"watchfile.watchers": [
    {
        "name": "WatchLuaFileSave",
        "enabled": true,
        "fileNamePattern": "**/*.lua.txt",
        "program": "${workspaceRoot}\\tools\\idea_tools\\hot_reload_lua_file.bat",
        "arguments": [
            "lua_file_path",
            "$FilePath$",
            "event_name",
            "reload_lua_file"
        ],
        "workingDirectory": "$FileDir$",
        "autoSaveTrigger": true,
        "triggerOnExternalChanges": true,
        "showConsole": "always"
    }
]

Properties

  • name: Watcher name (required).
  • enabled: Disable watcher without removing it (default true).
  • fileNamePattern: A basic glob pattern to filter triggering files, like *.js or **/*.ts (default **/*).
  • program: The executable program to run (required).
  • arguments: Array of arguments for the program. Macros can be used here.
  • workingDirectory: Directory to run the command in. Defaults to $FileDir$.
  • environmentVariables: Key-value object of env variables. Values can use macros.
  • autoSaveTrigger: Trigger watcher on save (default true).
  • showConsole: When to reveal the Output Console. always, onError, never (default onError).
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft