diff --git a/CHANGELOG.md b/CHANGELOG.md index 285e9b2b62..ff1e9c29d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/client/client.ts b/client/client.ts index 671dc8eef9..eb4b12c066 100644 --- a/client/client.ts +++ b/client/client.ts @@ -12,7 +12,7 @@ import { existsSync } from 'fs'; export function initializeLanguageClient(vlsModulePath: string, globalSnippetDir: string): LanguageClient { const debugOptions = { execArgv: ['--nolazy', '--inspect=6005'] }; - const documentSelector = ['vue']; + const documentSelector = [{ language: 'vue' }]; const config = vscode.workspace.getConfiguration(); let serverPath; diff --git a/server/src/services/vls.ts b/server/src/services/vls.ts index 06225dca71..91b76d3e3f 100644 --- a/server/src/services/vls.ts +++ b/server/src/services/vls.ts @@ -21,8 +21,7 @@ import { CompletionTriggerKind, ExecuteCommandParams, ApplyWorkspaceEditRequest, - FoldingRangeParams, - CancellationTokenSource + FoldingRangeParams } from 'vscode-languageserver'; import { ColorInformation, @@ -84,7 +83,7 @@ export class VLS { private documentFormatterRegistration: Disposable | undefined; - private config: VLSConfig; + private config: VLSFullConfig; constructor(private lspConnection: Connection) { this.documentService = new DocumentService(this.lspConnection); @@ -95,7 +94,7 @@ export class VLS { } async init(params: InitializeParams) { - const config: VLSFullConfig = this.getFullConfig(params.initializationOptions?.config); + const config = this.getFullConfig(params.initializationOptions?.config); const workspacePath = params.rootPath; if (!workspacePath) { @@ -107,7 +106,7 @@ export class VLS { this.workspacePath = workspacePath; - await this.vueInfoService.init(this.languageModes); + this.vueInfoService.init(this.languageModes); await this.dependencyService.init(workspacePath, config.vetur.useWorkspaceDependencies, config.typescript.tsdk); await this.languageModes.init( @@ -119,7 +118,7 @@ export class VLS { params.initializationOptions?.globalSnippetDir ); - this.setupConfigure(config); + this.configure(config); this.setupConfigListeners(); this.setupLSPHandlers(); this.setupCustomLSPHandlers(); @@ -138,14 +137,11 @@ export class VLS { return config ? _.merge(getDefaultVLSConfig(), config) : getDefaultVLSConfig(); } - public setupConfigure(config: VLSFullConfig) { - this.configure(config); - this.setupDynamicFormatters(config); - } - private setupConfigListeners() { this.lspConnection.onDidChangeConfiguration(async ({ settings }: DidChangeConfigurationParams) => { - await this.setupConfigure(this.getFullConfig(settings)); + const config = this.getFullConfig(settings); + this.configure(config); + this.setupDynamicFormatters(config); }); this.documentService.getAllDocuments().forEach(this.triggerValidation); @@ -191,7 +187,7 @@ export class VLS { if (settings.vetur.format.enable) { if (!this.documentFormatterRegistration) { this.documentFormatterRegistration = await this.lspConnection.client.register(DocumentFormattingRequest.type, { - documentSelector: ['vue'] + documentSelector: [{ language: 'vue' }] }); } } else {