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

Fix invalid client/registerCapability request #2436

Merged
merged 3 commits into from
Nov 6, 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: 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
2 changes: 1 addition & 1 deletion client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
22 changes: 9 additions & 13 deletions server/src/services/vls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import {
CompletionTriggerKind,
ExecuteCommandParams,
ApplyWorkspaceEditRequest,
FoldingRangeParams,
CancellationTokenSource
FoldingRangeParams
} from 'vscode-languageserver';
import {
ColorInformation,
Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand All @@ -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(
Expand All @@ -119,7 +118,7 @@ export class VLS {
params.initializationOptions?.globalSnippetDir
);

this.setupConfigure(config);
this.configure(config);
this.setupConfigListeners();
this.setupLSPHandlers();
this.setupCustomLSPHandlers();
Expand All @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down