"private": true,
"icon": "icon.png",
"//": "The real version is in release.yaml, this one just needs to be bigger",
- "version": "0.2.0-dev",
+ "version": "0.2.20200211-dev",
"publisher": "matklad",
"repository": {
"url": "https://github.com/rust-analyzer/rust-analyzer.git",
// It might be a good idea to test if the uri points to a file.
const workspaceFolderPath = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath ?? '.';
- const serverPath = await ensureServerBinary(config.serverBinarySource);
+ const serverPath = await ensureServerBinary(config.serverSource);
if (!serverPath) return null;
const run: lc.Executable = {
]
.map(opt => `${Config.rootSection}.${opt}`);
+ private static readonly extensionVersion: string = (() => {
+ const packageJsonVersion = vscode
+ .extensions
+ .getExtension("matklad.rust-analyzer")!
+ .packageJSON
+ .version as string; // n.n.YYYYMMDD
+
+ const realVersionRegexp = /^\d+\.\d+\.(\d{4})(\d{2})(\d{2})/;
+ const [, yyyy, mm, dd] = packageJsonVersion.match(realVersionRegexp)!;
+
+ return `${yyyy}-${mm}-${dd}`;
+ })();
+
private cfg!: vscode.WorkspaceConfiguration;
constructor(private readonly ctx: vscode.ExtensionContext) {
}
}
- get serverBinarySource(): null | BinarySource {
+ get serverSource(): null | BinarySource {
const serverPath = RA_LSP_DEBUG ?? this.cfg.get<null | string>("raLspServerPath");
if (serverPath) {
type: BinarySource.Type.GithubRelease,
dir: this.ctx.globalStoragePath,
file: prebuiltBinaryName,
+ storage: this.ctx.globalState,
+ version: Config.extensionVersion,
repo: {
name: "rust-analyzer",
owner: "rust-analyzer",
this.pushCleanup(d);
}
+ get globalState(): vscode.Memento {
+ return this.extCtx.globalState;
+ }
+
get subscriptions(): Disposable[] {
return this.extCtx.subscriptions;
}
+import * as vscode from "vscode";
+
export interface GithubRepo {
name: string;
owner: string;
* and in local `.dir`.
*/
file: string;
+
+ /**
+ * Tag of github release that denotes a version required by this extension.
+ */
+ version: string;
+
+ /**
+ * Object that provides `get()/update()` operations to store metadata
+ * about the actual binary, e.g. its actual version.
+ */
+ storage: vscode.Memento;
}
}