diff --git a/.github/PERF_ISSUE.md b/.github/PERF_ISSUE.md index ca027b5432..86e6c3a40f 100644 --- a/.github/PERF_ISSUE.md +++ b/.github/PERF_ISSUE.md @@ -1,6 +1,8 @@ # Performance Issue Reporting -Performance issues are hard to track down, and a good report is necessary for fixing them. +Performance issues are hard to track down, and a good report is crucial for fixing them. + +Although you can use the command `Vetur: Restart VLS (Vue Language Server)` to restart VLS and temporarily avoid performance issues, we would appreciate it if you can file a report to help us fix the issue. In addition to the normal issues, please include a profile in performance-related issues and below information: diff --git a/CHANGELOG.md b/CHANGELOG.md index b0247fc0c4..166870699a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - 🙌 Fix collapse code missing end mark. Thanks to contribution from [@yoyo930021](https://github.com/yoyo930021). #2303 and #2352. - 🙌 Reduce recreate ts program when no need for ts perf. Thanks to contribution from [@yoyo930021](https://github.com/yoyo930021). #2192 and #2328. - 🙌 Display VTI errors. Thanks to contribution from [@yoyo930021](https://github.com/yoyo930021). #2324 and #2330. +- 🙌 Add restart vue language service command. Thanks to contribution from [@yoyo930021](https://github.com/yoyo930021). #2331. ### 0.28.0 | 2020-09-23 | [VSIX](https://marketplace.visualstudio.com/_apis/public/gallery/publishers/octref/vsextensions/vetur/0.28.0/vspackage) diff --git a/README.md b/README.md index 1d40f6aba0..fa2d069e62 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ Thanks to the following companies for supporting Vetur's development: - No multi root suppport yet ([#424](https://github.com/vuejs/vetur/issues/424)) - Cannot handle tsconfig from non-top-level folder ([#815](https://github.com/vuejs/vetur/issues/815)) +- You can restart Vue language service when Vetur slow ([#2192](https://github.com/vuejs/vetur/issues/2192)) ## Roadmap diff --git a/client/vueMain.ts b/client/vueMain.ts index 8edc7f0478..77a398b0fd 100644 --- a/client/vueMain.ts +++ b/client/vueMain.ts @@ -53,11 +53,16 @@ export async function activate(context: vscode.ExtensionContext) { .then(() => { registerCustomClientNotificationHandlers(client); registerCustomLSPCommands(context, client); + registerRestartVLSCommand(context, client); }) .catch(e => { console.log('Client initialization failed'); }); + return displayInitProgress(promise); +} + +async function displayInitProgress(promise: Promise) { return vscode.window.withProgress( { title: 'Vetur initialization', @@ -67,6 +72,19 @@ export async function activate(context: vscode.ExtensionContext) { ); } +function registerRestartVLSCommand(context: vscode.ExtensionContext, client: LanguageClient) { + context.subscriptions.push( + vscode.commands.registerCommand('vetur.restartVLS', () => + displayInitProgress( + client + .stop() + .then(() => client.start()) + .then(() => client.onReady()) + ) + ) + ); +} + function registerCustomClientNotificationHandlers(client: LanguageClient) { client.onNotification('$/displayInfo', (msg: string) => { vscode.window.showInformationMessage(msg); diff --git a/docs/FAQ.md b/docs/FAQ.md index 68febd7910..2606eb701b 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -110,3 +110,9 @@ Now you'll find `vetur-{version}.vsix`, you can install it by editor command "In You can enable `Vetur: Use Workspace Dependencies` setting so that it uses the same version of TypeScript in your workspace. NB: It will use `typescript.tsdk` setting as the path to look for if defined, defaulting to `node_modules/typescript`. This enables tools like Yarn PnP to set their own custom resolver. + +## Vetur is slow + +You can run the command `Vetur: Restart VLS (Vue Language Server)` to restart VLS. + +However, we'd appreciate it if you can file a [performance issue report with a profile](https://github.com/vuejs/vetur/blob/master/.github/PERF_ISSUE.md) to help us fix the issue. \ No newline at end of file diff --git a/package.json b/package.json index 86bc4da02f..06916c965a 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,10 @@ "main": "./dist/client/vueMain", "contributes": { "commands": [ + { + "command": "vetur.restartVLS", + "title": "Vetur: Restart VLS (Vue Language Server)" + }, { "command": "vetur.generateGrammar", "title": "Vetur: Generate grammar from `vetur.grammar.customBlocks`"