MCPcopy
hub / github.com/PowerShell/vscode-powershell / restartOnExtensionFileChanges

Function restartOnExtensionFileChanges

src/extension.ts:268–280  ·  view source on GitHub ↗

Restarts the extension host when extension file changes are detected. Useful for development.

(context: vscode.ExtensionContext)

Source from the content-addressed store, hash-verified

266
267/** Restarts the extension host when extension file changes are detected. Useful for development. */
268function 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
282export async function deactivate(): Promise<void> {
283 // Clean up all extension features

Callers 1

activateFunction · 0.85

Calls 1

Tested by

no test coverage detected