Skip to content

Commit

Permalink
Fix invalid client/registerCapability request
Browse files Browse the repository at this point in the history
The documentSelector is a list of DocumentFilter and can not contain
a string as that is invalid per the LSP spec [1].

The types provided by https://github.com/microsoft/vscode-languageserver-node
are wrong: microsoft/vscode-languageserver-node#685

It would be an option to send registrationOptions in proper format but
it's not necessary to specify the documentSelector since vetur only runs
in vue files. So skipping it entirely is equivalent.

[1] https://microsoft.github.io/language-server-protocol/specification#documentFilter

Resolves vuejs#2388
  • Loading branch information
rchl committed Nov 5, 2020
1 parent 1851d1c commit c736932
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### 0.29.1

- Fix invalid `client/registerCapability` request. Thanks to contribution from [@rchl](https://github.com/rchl) #2388

### 0.29.0 | 2020-11-02 | [VSIX](https://marketplace.visualstudio.com/_apis/public/gallery/publishers/octref/vsextensions/vetur/0.29.0/vspackage)

- Fix "Duplicate identifier" errors when using multiple keydown events with modifiers. #1745.
Expand Down
4 changes: 1 addition & 3 deletions server/src/services/vls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,7 @@ export class VLS {
private async setupDynamicFormatters(settings: VLSFullConfig) {
if (settings.vetur.format.enable) {
if (!this.documentFormatterRegistration) {
this.documentFormatterRegistration = await this.lspConnection.client.register(DocumentFormattingRequest.type, {
documentSelector: ['vue']
});
this.documentFormatterRegistration = await this.lspConnection.client.register(DocumentFormattingRequest.type);
}
} else {
if (this.documentFormatterRegistration) {
Expand Down

0 comments on commit c736932

Please sign in to comment.