Enable SemanticTokens on the client

This will crash the extension on stable and insiders without the "--enable-proposed-api matklad.rust-analyzer" command line switch.
This commit is contained in:
Jeremy Kolb 2020-02-26 08:42:26 -05:00
parent 80f8e474a0
commit 74125d012e
2 changed files with 4 additions and 0 deletions

View file

@ -18,6 +18,7 @@
"engines": { "engines": {
"vscode": "^1.42.0" "vscode": "^1.42.0"
}, },
"enableProposedApi": true,
"scripts": { "scripts": {
"vscode:prepublish": "tsc && rollup -c", "vscode:prepublish": "tsc && rollup -c",
"package": "vsce package -o rust-analyzer.vsix", "package": "vsce package -o rust-analyzer.vsix",

View file

@ -3,6 +3,7 @@ import * as vscode from 'vscode';
import { Config } from './config'; import { Config } from './config';
import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed';
import { SemanticTokensFeature } from 'vscode-languageclient/lib/semanticTokens.proposed';
export async function createClient(config: Config, serverPath: string): Promise<lc.LanguageClient> { export async function createClient(config: Config, serverPath: string): Promise<lc.LanguageClient> {
// '.' Is the fallback if no folder is open // '.' Is the fallback if no folder is open
@ -83,5 +84,7 @@ export async function createClient(config: Config, serverPath: string): Promise<
// Here we want to just enable CallHierarchyFeature since it is available on stable. // Here we want to just enable CallHierarchyFeature since it is available on stable.
// Note that while the CallHierarchyFeature is stable the LSP protocol is not. // Note that while the CallHierarchyFeature is stable the LSP protocol is not.
res.registerFeature(new CallHierarchyFeature(res)); res.registerFeature(new CallHierarchyFeature(res));
res.registerFeature(new SemanticTokensFeature(res));
return res; return res;
} }