Restarts the extension host when extension file changes are detected. Useful for development.
(context: vscode.ExtensionContext)
| 266 | |
| 267 | /** Restarts the extension host when extension file changes are detected. Useful for development. */ |
| 268 | function restartOnExtensionFileChanges(context: vscode.ExtensionContext): void { |
| 269 | const watcher = vscode.workspace.createFileSystemWatcher( |
| 270 | new vscode.RelativePattern(context.extensionPath, "dist/*.js"), |
| 271 | ); |
| 272 | |
| 273 | context.subscriptions.push(watcher); |
| 274 | watcher.onDidChange(({ fsPath }) => { |
| 275 | vscode.window.showInformationMessage( |
| 276 | `${fsPath.split(context.extensionPath, 2)[1]} changed. Reloading Extension Host...`, |
| 277 | ); |
| 278 | vscode.commands.executeCommand("workbench.action.restartExtensionHost"); |
| 279 | }); |
| 280 | } |
| 281 | |
| 282 | export async function deactivate(): Promise<void> { |
| 283 | // Clean up all extension features |
no test coverage detected