diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index d3446f36e3..cb9c0371d3 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -390,6 +390,11 @@ } }, "commands": [ + { + "command": "vue.action.restartServer", + "title": "Restart Vue and TS servers", + "category": "Vue" + }, { "command": "vue.action.doctor", "title": "Doctor", diff --git a/extensions/vscode/src/common.ts b/extensions/vscode/src/common.ts index 598bc4eb59..8c41e9dcdc 100644 --- a/extensions/vscode/src/common.ts +++ b/extensions/vscode/src/common.ts @@ -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'); + } })); } }