about summary refs log tree commit diff
path: root/editors/code/src/client.ts
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2022-04-29 13:34:03 +0200
committerLukas Wirth <lukastw97@gmail.com>2022-05-01 19:57:09 +0200
commitd6dba1c97ca6c9a529e7dfbb17320e3e59713aef (patch)
treed2e084224baf6d1c7096b7b8035778c27d979380 /editors/code/src/client.ts
parent1f11b70c3bcbdd1481d00344ccf4da9cdca2a572 (diff)
downloadrust-d6dba1c97ca6c9a529e7dfbb17320e3e59713aef.tar.gz
rust-d6dba1c97ca6c9a529e7dfbb17320e3e59713aef.zip
auto update old configurations to newer ones
Diffstat (limited to 'editors/code/src/client.ts')
-rw-r--r--editors/code/src/client.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts
index f7520f6c436..99b72635d18 100644
--- a/editors/code/src/client.ts
+++ b/editors/code/src/client.ts
@@ -5,6 +5,7 @@ import * as Is from 'vscode-languageclient/lib/common/utils/is';
 import { assert } from './util';
 import { WorkspaceEdit } from 'vscode';
 import { Workspace } from './ctx';
+import { updateConfig } from './config';
 
 export interface Env {
     [name: string]: string;
@@ -24,7 +25,7 @@ function renderHoverActions(actions: ra.CommandLinkGroup[]): vscode.MarkdownStri
     return result;
 }
 
-export function createClient(serverPath: string, workspace: Workspace, extraEnv: Env): lc.LanguageClient {
+export async function createClient(serverPath: string, workspace: Workspace, extraEnv: Env): Promise<lc.LanguageClient> {
     // '.' Is the fallback if no folder is open
     // TODO?: Workspace folders support Uri's (eg: file://test.txt).
     // It might be a good idea to test if the uri points to a file.
@@ -45,6 +46,10 @@ export function createClient(serverPath: string, workspace: Workspace, extraEnv:
     );
 
     let initializationOptions = vscode.workspace.getConfiguration("rust-analyzer");
+
+    // Update outdated user configs
+    await updateConfig(initializationOptions);
+
     if (workspace.kind === "Detached Files") {
         initializationOptions = { "detachedFiles": workspace.files.map(file => file.uri.fsPath), ...initializationOptions };
     }