Rewrite auto-update

Everything now happens in main.ts, in the bootstrap family of
functions. The current flow is:

* check everything only on extension installation.
* if the user is on nightly channel, try to download the nightly
  extension and reload.
* when we install nightly extension, we persist its release id, so
  that we can check if the current release is different.
* if server binary was not downloaded by the current version of the
  extension, redownload it (we persist the version of ext that
  downloaded the server).
This commit is contained in:
Aleksey Kladov 2020-03-17 12:44:31 +01:00
parent f0a1b64d7e
commit fb6e655de8
13 changed files with 270 additions and 696 deletions

View file

@ -1,20 +1,10 @@
import * as vscode from 'vscode';
import { ensureServerBinary } from '../installation/server';
import * as vscode from "vscode";
import { spawnSync } from "child_process";
import { Ctx, Cmd } from '../ctx';
import { spawnSync } from 'child_process';
export function serverVersion(ctx: Ctx): Cmd {
return async () => {
const binaryPath = await ensureServerBinary(ctx.config, ctx.state);
if (binaryPath == null) {
throw new Error(
"Rust Analyzer Language Server is not available. " +
"Please, ensure its [proper installation](https://rust-analyzer.github.io/manual.html#installation)."
);
}
const version = spawnSync(binaryPath, ["--version"], { encoding: "utf8" }).stdout;
const version = spawnSync(ctx.serverPath, ["--version"], { encoding: "utf8" }).stdout;
vscode.window.showInformationMessage('rust-analyzer version : ' + version);
};
}