Notify On File
You can show a status bar item and/or an Information Notification when a file is created, changed or deleted.
The extension use the vscode.FileSystemWatcher
. Here you can find more information on the used configuration properties.
The current version only supports 1 file watcher.
Configuration
The extension has the following settings:
notify-on-file.notify
: An object with the following properties:
path
: (Optional) directory where you want to eatch for file changes. Can contain variables. If undefined the globPattern
will be watched for in all open workspaces. (default: undefined)
globPattern
: A glob pattern that controls for which files the watcher should report events. (default: *.js
)
onCreate
: An array with action objects for a create event.
onChange
: An array with action objects for a change event.
onDelete
: An array with action objects for a delete event.
Action Objects
An action object describes what should happen if that event is triggered.
The possible action objects are:
showStatusBarItem
: create or update a status bar item with a given id
The object has the following properties:
removeStatusBarItem
: remove the status bar item with a given id
The object has the following properties:
removeStatusBarItem
: (string) the value for this property is the id
of the status bar item.
notify
: show an Information Notification
The object has the following properties:
notify
: (string) the text to shown in the Information Notification. Can contain variables. The file variables use the URI of the file that has the event triggered.
Example
"notify-on-file.notify": {
"path": "${workspaceFolder}",
"globPattern": ".vscode/build.txt",
"onCreate": [
{ "showStatusBarItem": "build",
"backgroundColor": "statusBarItem.warningBackground",
"text": "$(watch) Building Application",
"tooltip": "Time to get a drink"
}
],
"onDelete": [
{ "removeStatusBarItem": "build" }
{ "notify": "Build finished" }
]
}
Variables
You can use the following variables in certain strings:
${env:name}
: get the value for environment variable name
${pathSeparator}
: the character used by the operating system to separate components in file paths
${userHome}
: the path of the user's home folder
${workspaceFolder}
: the path of the workspace folder opened in VS Code containing the current file.
${workspaceFolder:name}
: the path of the workspace folder with the specified name opened in VS Code
${workspaceFolderBasename}
: the name of the workspace folder opened in VS Code containing the current file without any slashes
${file}
: the current opened file (the file system path)
${relativeFile}
: the current opened file relative to workspaceFolder
${relativeFileDirname}
: the current opened file's dirname relative to workspaceFolder
${fileBasename}
: the current opened file's basename
${fileBasenameNoExtension}
: the current opened file's basename with no file extension
${fileExtname}
: the current opened file's extension
${fileDirname}
: the current opened file's dirname