Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add restart vue language service command #2331

Merged
merged 5 commits into from
Oct 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/PERF_ISSUE.md
Original file line number Diff line number Diff line change
@@ -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:

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
yoyo930021 marked this conversation as resolved.
Show resolved Hide resolved

## Roadmap

Expand Down
18 changes: 18 additions & 0 deletions client/vueMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>) {
return vscode.window.withProgress(
{
title: 'Vetur initialization',
Expand All @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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`"
Expand Down