From 89afb1a841c83d41ca3da72217c377932cdf5e93 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Feb 2020 14:11:01 +0100 Subject: Remove two stage constuction --- editors/code/src/main.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'editors/code/src/main.ts') diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index 947d5eb90..0ad7ef1bb 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts @@ -6,13 +6,14 @@ import { activateStatusDisplay } from './status_display'; import { Ctx } from './ctx'; import { activateHighlighting } from './highlighting'; import { ensureServerBinary } from './installation/server'; +import { Config } from './config'; let ctx: Ctx | undefined; export async function activate(context: vscode.ExtensionContext) { - ctx = new Ctx(context); + const config = new Config(context) - const serverPath = await ensureServerBinary(ctx.config.serverSource); + const serverPath = await ensureServerBinary(config.serverSource); if (serverPath == null) { throw new Error( "Rust Analyzer Language Server is not available. " + @@ -24,11 +25,7 @@ export async function activate(context: vscode.ExtensionContext) { // registers its `onDidChangeDocument` handler before us. // // This a horribly, horribly wrong way to deal with this problem. - try { - await ctx.startServer(serverPath); - } catch (e) { - vscode.window.showErrorMessage(e.message); - } + ctx = await Ctx.create(config, context, serverPath); // Commands which invokes manually via command palette, shortcut, etc. ctx.registerCommand('reload', (ctx) => { -- cgit v1.2.3