Skip to content

Commit

Permalink
feat(vscode): re-add restart server command (#4174)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Mar 28, 2024
1 parent f7fb0f9 commit a169328
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions extensions/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,11 @@
}
},
"commands": [
{
"command": "vue.action.restartServer",
"title": "Restart Vue and TS servers",
"category": "Vue"
},
{
"command": "vue.action.doctor",
"title": "Doctor",
Expand Down
8 changes: 6 additions & 2 deletions extensions/vscode/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,21 @@ async function doActivate(context: vscode.ExtensionContext, createLc: CreateLang
);
}
else if (e.affectsConfiguration('vue')) {
vscode.commands.executeCommand('vue.action.restartServer');
vscode.commands.executeCommand('vue.action.restartServer', false);
}
}));
}

async function activateRestartRequest() {
context.subscriptions.push(vscode.commands.registerCommand('vue.action.restartServer', async () => {
context.subscriptions.push(vscode.commands.registerCommand('vue.action.restartServer', async (restartTsServer: boolean = true) => {
await client.stop();
outputChannel.clear();
client.clientOptions.initializationOptions = await getInitializationOptions(context);
await client.start();
nameCasing.activate(context, client, selectors);
if (restartTsServer) {
await vscode.commands.executeCommand('typescript.restartTsServer');
}
}));
}
}
Expand Down

0 comments on commit a169328

Please sign in to comment.