From 6c70fff38a8a284039f89eecbf4ee31d3eb81ed2 Mon Sep 17 00:00:00 2001 From: yoyo930021 Date: Sat, 26 Sep 2020 11:11:38 +0800 Subject: [PATCH 1/5] Add restart vue language service command --- client/vueMain.ts | 14 ++++++++++++++ package.json | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/client/vueMain.ts b/client/vueMain.ts index 8edc7f0478..1e2b60ecbb 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); + registerRestartServerCommand(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,15 @@ export async function activate(context: vscode.ExtensionContext) { ); } +function registerRestartServerCommand (context: vscode.ExtensionContext, client: LanguageClient) { + context.subscriptions.push( + vscode.commands.registerCommand( + 'vetur.restartVLSServer', + () => 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/package.json b/package.json index 86bc4da02f..4e75f1f951 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,10 @@ "main": "./dist/client/vueMain", "contributes": { "commands": [ + { + "command": "vetur.restartVLSServer", + "title": "Vetur: Restart vue language server" + }, { "command": "vetur.generateGrammar", "title": "Vetur: Generate grammar from `vetur.grammar.customBlocks`" From ff02f1fd44b82172740b3e0ba4bdd610dba6dec9 Mon Sep 17 00:00:00 2001 From: yoyo930021 Date: Sat, 26 Sep 2020 11:14:44 +0800 Subject: [PATCH 2/5] README --- README.md | 1 + 1 file changed, 1 insertion(+) 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 From 09dcdb44bca33c7528365ff82c8193d8480fe968 Mon Sep 17 00:00:00 2001 From: yoyo930021 Date: Sat, 26 Sep 2020 11:16:02 +0800 Subject: [PATCH 3/5] CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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) From 64bd3ae51563af477b64f0f6bcaf897ad597767a Mon Sep 17 00:00:00 2001 From: yoyo930021 Date: Sat, 10 Oct 2020 16:07:56 +0800 Subject: [PATCH 4/5] Add restart action in bug report checklist --- .github/ISSUE_TEMPLATE/bug_report.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 4587bed56f..73dfc14501 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -9,6 +9,7 @@ assignees: '' +- [ ] I have restart VSCode or restart Vue language server. - [ ] I have searched through existing issues - [ ] I have read through [docs](https://vuejs.github.io/vetur) - [ ] I have read [FAQ](https://github.com/vuejs/vetur/blob/master/docs/FAQ.md) From a4e221ff8215683bd00a9ba79db2f8bafb38a1b4 Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Thu, 29 Oct 2020 20:36:11 +0800 Subject: [PATCH 5/5] Clean up --- .github/ISSUE_TEMPLATE/bug_report.md | 1 - .github/PERF_ISSUE.md | 4 +++- client/vueMain.ts | 16 ++++++++++------ docs/FAQ.md | 6 ++++++ package.json | 4 ++-- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 73dfc14501..4587bed56f 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -9,7 +9,6 @@ assignees: '' -- [ ] I have restart VSCode or restart Vue language server. - [ ] I have searched through existing issues - [ ] I have read through [docs](https://vuejs.github.io/vetur) - [ ] I have read [FAQ](https://github.com/vuejs/vetur/blob/master/docs/FAQ.md) 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/client/vueMain.ts b/client/vueMain.ts index 1e2b60ecbb..77a398b0fd 100644 --- a/client/vueMain.ts +++ b/client/vueMain.ts @@ -53,7 +53,7 @@ export async function activate(context: vscode.ExtensionContext) { .then(() => { registerCustomClientNotificationHandlers(client); registerCustomLSPCommands(context, client); - registerRestartServerCommand(context, client); + registerRestartVLSCommand(context, client); }) .catch(e => { console.log('Client initialization failed'); @@ -62,7 +62,7 @@ export async function activate(context: vscode.ExtensionContext) { return displayInitProgress(promise); } -async function displayInitProgress (promise: Promise) { +async function displayInitProgress(promise: Promise) { return vscode.window.withProgress( { title: 'Vetur initialization', @@ -72,11 +72,15 @@ async function displayInitProgress (promise: Promise) { ); } -function registerRestartServerCommand (context: vscode.ExtensionContext, client: LanguageClient) { +function registerRestartVLSCommand(context: vscode.ExtensionContext, client: LanguageClient) { context.subscriptions.push( - vscode.commands.registerCommand( - 'vetur.restartVLSServer', - () => displayInitProgress(client.stop().then(() => client.start()).then(() => client.onReady())) + vscode.commands.registerCommand('vetur.restartVLS', () => + displayInitProgress( + client + .stop() + .then(() => client.start()) + .then(() => client.onReady()) + ) ) ); } 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 4e75f1f951..06916c965a 100644 --- a/package.json +++ b/package.json @@ -68,8 +68,8 @@ "contributes": { "commands": [ { - "command": "vetur.restartVLSServer", - "title": "Vetur: Restart vue language server" + "command": "vetur.restartVLS", + "title": "Vetur: Restart VLS (Vue Language Server)" }, { "command": "vetur.generateGrammar",