aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorwxb1ank <[email protected]>2021-05-23 21:33:32 +0100
committerwxb1ank <[email protected]>2021-06-02 17:07:13 +0100
commit3ca7f61a8d736d8e56f0d413b109e6e6562c0a30 (patch)
tree8f96da409d488f83db4f9011c8013a09a972d1be /editors
parent2022cfce44f7c3d82dd354abeb2d40b570fa3ef4 (diff)
internal: use vscode.FileSystem API in main.ts
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/config.ts4
-rw-r--r--editors/code/src/main.ts6
2 files changed, 5 insertions, 5 deletions
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index d3d6e631a..7200a26f7 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -31,10 +31,10 @@ export class Config {
31 enableProposedApi: boolean | undefined; 31 enableProposedApi: boolean | undefined;
32 } = vscode.extensions.getExtension(this.extensionId)!.packageJSON; 32 } = vscode.extensions.getExtension(this.extensionId)!.packageJSON;
33 33
34 readonly globalStoragePath: string; 34 readonly globalStorageUri: vscode.Uri;
35 35
36 constructor(ctx: vscode.ExtensionContext) { 36 constructor(ctx: vscode.ExtensionContext) {
37 this.globalStoragePath = ctx.globalStorageUri.fsPath; 37 this.globalStorageUri = ctx.globalStorageUri;
38 vscode.workspace.onDidChangeConfiguration(this.onDidChangeConfiguration, this, ctx.subscriptions); 38 vscode.workspace.onDidChangeConfiguration(this.onDidChangeConfiguration, this, ctx.subscriptions);
39 this.refreshLogging(); 39 this.refreshLogging();
40 } 40 }
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 74ee28d24..fb9d38a14 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -160,7 +160,7 @@ export async function deactivate() {
160} 160}
161 161
162async function bootstrap(config: Config, state: PersistentState): Promise<string> { 162async function bootstrap(config: Config, state: PersistentState): Promise<string> {
163 await fs.mkdir(config.globalStoragePath, { recursive: true }); 163 await vscode.workspace.fs.createDirectory(config.globalStorageUri);
164 164
165 if (!config.currentExtensionIsNightly) { 165 if (!config.currentExtensionIsNightly) {
166 await state.updateNightlyReleaseId(undefined); 166 await state.updateNightlyReleaseId(undefined);
@@ -222,7 +222,7 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi
222 const artifact = latestNightlyRelease.assets.find(artifact => artifact.name === "rust-analyzer.vsix"); 222 const artifact = latestNightlyRelease.assets.find(artifact => artifact.name === "rust-analyzer.vsix");
223 assert(!!artifact, `Bad release: ${JSON.stringify(latestNightlyRelease)}`); 223 assert(!!artifact, `Bad release: ${JSON.stringify(latestNightlyRelease)}`);
224 224
225 const dest = path.join(config.globalStoragePath, "rust-analyzer.vsix"); 225 const dest = path.join(config.globalStorageUri.path, "rust-analyzer.vsix");
226 226
227 await downloadWithRetryDialog(state, async () => { 227 await downloadWithRetryDialog(state, async () => {
228 await download({ 228 await download({
@@ -334,7 +334,7 @@ async function getServer(config: Config, state: PersistentState): Promise<string
334 platform = "x86_64-unknown-linux-musl"; 334 platform = "x86_64-unknown-linux-musl";
335 } 335 }
336 const ext = platform.indexOf("-windows-") !== -1 ? ".exe" : ""; 336 const ext = platform.indexOf("-windows-") !== -1 ? ".exe" : "";
337 const dest = path.join(config.globalStoragePath, `rust-analyzer-${platform}${ext}`); 337 const dest = path.join(config.globalStorageUri.path, `rust-analyzer-${platform}${ext}`);
338 const exists = await fs.stat(dest).then(() => true, () => false); 338 const exists = await fs.stat(dest).then(() => true, () => false);
339 if (!exists) { 339 if (!exists) {
340 await state.updateServerVersion(undefined); 340 await state.updateServerVersion(undefined);