Skip to content

Commit

Permalink
Merge pull request vuejs#2436 from rchl/fix/register-cap
Browse files Browse the repository at this point in the history
Fix invalid client/registerCapability request
  • Loading branch information
octref authored Nov 6, 2020
2 parents befd17e + 90194c3 commit 1efe1ef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 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
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

0 comments on commit 1efe1ef

Please sign in to comment.