aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/installation/language_server.ts
diff options
context:
space:
mode:
authorVeetaha <[email protected]>2020-02-08 22:27:04 +0000
committerVeetaha <[email protected]>2020-02-08 22:27:04 +0000
commit539daf4454e3f11424a469e8fba26cacb325176a (patch)
tree28f37d3adbfedc75b9d4cf25d50ab20469f48cf3 /editors/code/src/installation/language_server.ts
parentbdd88c2fad272f96a8212e5230010f7c02b4d15d (diff)
vscode: refactor platform artifact name query to switch statement, move BinarySource union variants into a namespace
Diffstat (limited to 'editors/code/src/installation/language_server.ts')
-rw-r--r--editors/code/src/installation/language_server.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/editors/code/src/installation/language_server.ts b/editors/code/src/installation/language_server.ts
index b75d3a00a..522d59eb5 100644
--- a/editors/code/src/installation/language_server.ts
+++ b/editors/code/src/installation/language_server.ts
@@ -5,12 +5,12 @@ import * as path from "path";
5import { strict as assert } from "assert"; 5import { strict as assert } from "assert";
6import { promises as fs } from "fs"; 6import { promises as fs } from "fs";
7 7
8import { BinarySource, BinarySourceType, GithubBinarySource } from "./interfaces"; 8import { BinarySource } from "./interfaces";
9import { fetchLatestArtifactMetadata } from "./fetch_latest_artifact_metadata"; 9import { fetchLatestArtifactMetadata } from "./fetch_latest_artifact_metadata";
10import { downloadFile } from "./download_file"; 10import { downloadFile } from "./download_file";
11 11
12export async function downloadLatestLanguageServer( 12export async function downloadLatestLanguageServer(
13 {file: artifactFileName, dir: installationDir, repo}: GithubBinarySource 13 {file: artifactFileName, dir: installationDir, repo}: BinarySource.GithubRelease
14) { 14) {
15 const binaryMetadata = await fetchLatestArtifactMetadata(repo, artifactFileName); 15 const binaryMetadata = await fetchLatestArtifactMetadata(repo, artifactFileName);
16 16
@@ -67,7 +67,7 @@ export async function ensureLanguageServerBinary(
67 } 67 }
68 68
69 switch (langServerSource.type) { 69 switch (langServerSource.type) {
70 case BinarySourceType.ExplicitPath: { 70 case BinarySource.Type.ExplicitPath: {
71 if (isBinaryAvailable(langServerSource.path)) { 71 if (isBinaryAvailable(langServerSource.path)) {
72 return langServerSource.path; 72 return langServerSource.path;
73 } 73 }
@@ -78,7 +78,7 @@ export async function ensureLanguageServerBinary(
78 ); 78 );
79 return null; 79 return null;
80 } 80 }
81 case BinarySourceType.GithubBinary: { 81 case BinarySource.Type.GithubRelease: {
82 const bundledBinaryPath = path.join(langServerSource.dir, langServerSource.file); 82 const bundledBinaryPath = path.join(langServerSource.dir, langServerSource.file);
83 83
84 if (!isBinaryAvailable(bundledBinaryPath)) { 84 if (!isBinaryAvailable(bundledBinaryPath)) {
@@ -106,7 +106,7 @@ export async function ensureLanguageServerBinary(
106 ); 106 );
107 107
108 vscode.window.showInformationMessage( 108 vscode.window.showInformationMessage(
109 "Rust analyzer language server was successfully installed" 109 "Rust analyzer language server was successfully installed 🦀"
110 ); 110 );
111 } 111 }
112 return bundledBinaryPath; 112 return bundledBinaryPath;