Style fixes

This commit is contained in:
Kirill Bulatov
2020-03-21 00:01:47 +02:00
parent 332799d914
commit 8a23bec2cd
4 changed files with 31 additions and 20 deletions

View File

@@ -5,7 +5,7 @@ import { Config } from './config';
import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed';
import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed';
export function configToOptions(config: Config): object {
export function configToServerOptions(config: Config): object {
return {
publishDecorations: !config.highlightingSemanticTokens,
lruCapacity: config.lruCapacity,
@@ -50,7 +50,7 @@ export async function createClient(config: Config, serverPath: string): Promise<
const clientOptions: lc.LanguageClientOptions = {
documentSelector: [{ scheme: 'file', language: 'rust' }],
initializationOptions: configToOptions(config),
initializationOptions: configToServerOptions(config),
traceOutputChannel,
middleware: {
// Workaround for https://github.com/microsoft/vscode-languageserver-node/issues/576

View File

@@ -2,7 +2,7 @@ import * as vscode from 'vscode';
import * as lc from 'vscode-languageclient';
import { Config } from './config';
import { createClient, configToOptions } from './client';
import { createClient, configToServerOptions } from './client';
import { isRustEditor, RustEditor } from './util';
export class Ctx {
@@ -20,7 +20,7 @@ export class Ctx {
const res = new Ctx(config, extCtx, client, serverPath);
res.pushCleanup(client.start());
await client.onReady();
client.onRequest('workspace/configuration', _ => [configToOptions(config)]);
client.onRequest('workspace/configuration', _ => [configToServerOptions(config)]);
return res;
}

View File

@@ -18,6 +18,8 @@ export function activateInlayHints(ctx: Ctx) {
return this.dispose();
}
if (!this.updater) this.updater = new HintsUpdater(ctx);
this.updater.syncCacheAndRenderHints();
},
dispose() {
this.updater?.dispose();
@@ -124,7 +126,7 @@ class HintsUpdater implements Disposable {
this.syncCacheAndRenderHints();
}
private syncCacheAndRenderHints() {
public syncCacheAndRenderHints() {
// FIXME: make inlayHints request pass an array of files?
this.sourceFiles.forEach((file, uri) => this.fetchHints(file).then(hints => {
if (!hints) return;