aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/installation
diff options
context:
space:
mode:
authorVeetaha <[email protected]>2020-02-14 22:42:32 +0000
committerVeetaha <[email protected]>2020-02-14 22:42:32 +0000
commit80d5ba68da2785280cf154d5d812915b99fc0e87 (patch)
treee40a833dd72df793cb3d81d298e4c5a2564ff552 /editors/code/src/installation
parentf61134e1980580050f34701db3441081a5519e4c (diff)
vscode: renamed langServer to server
Diffstat (limited to 'editors/code/src/installation')
-rw-r--r--editors/code/src/installation/server.ts (renamed from editors/code/src/installation/lang_server.ts)24
1 files changed, 12 insertions, 12 deletions
diff --git a/editors/code/src/installation/lang_server.ts b/editors/code/src/installation/server.ts
index ccb936bf5..406e2299c 100644
--- a/editors/code/src/installation/lang_server.ts
+++ b/editors/code/src/installation/server.ts
@@ -10,7 +10,7 @@ import { BinarySource } from "./interfaces";
10import { fetchLatestArtifactReleaseInfo } from "./fetch_latest_artifact_release_info"; 10import { fetchLatestArtifactReleaseInfo } from "./fetch_latest_artifact_release_info";
11import { downloadFile } from "./download_file"; 11import { downloadFile } from "./download_file";
12 12
13export async function downloadLatestLangServer( 13export async function downloadLatestServer(
14 {file: artifactFileName, dir: installationDir, repo}: BinarySource.GithubRelease 14 {file: artifactFileName, dir: installationDir, repo}: BinarySource.GithubRelease
15) { 15) {
16 const { releaseName, downloadUrl } = (await fetchLatestArtifactReleaseInfo( 16 const { releaseName, downloadUrl } = (await fetchLatestArtifactReleaseInfo(
@@ -53,11 +53,11 @@ export async function downloadLatestLangServer(
53 ); 53 );
54 console.timeEnd("Downloading ra_lsp_server"); 54 console.timeEnd("Downloading ra_lsp_server");
55} 55}
56export async function ensureLangServerBinary( 56export async function ensureServerBinary(
57 langServerSource: null | BinarySource 57 serverSource: null | BinarySource
58): Promise<null | string> { 58): Promise<null | string> {
59 59
60 if (!langServerSource) { 60 if (!serverSource) {
61 vscode.window.showErrorMessage( 61 vscode.window.showErrorMessage(
62 "Unfortunately we don't ship binaries for your platform yet. " + 62 "Unfortunately we don't ship binaries for your platform yet. " +
63 "You need to manually clone rust-analyzer repository and " + 63 "You need to manually clone rust-analyzer repository and " +
@@ -69,21 +69,21 @@ export async function ensureLangServerBinary(
69 return null; 69 return null;
70 } 70 }
71 71
72 switch (langServerSource.type) { 72 switch (serverSource.type) {
73 case BinarySource.Type.ExplicitPath: { 73 case BinarySource.Type.ExplicitPath: {
74 if (isBinaryAvailable(langServerSource.path)) { 74 if (isBinaryAvailable(serverSource.path)) {
75 return langServerSource.path; 75 return serverSource.path;
76 } 76 }
77 77
78 vscode.window.showErrorMessage( 78 vscode.window.showErrorMessage(
79 `Unable to run ${langServerSource.path} binary. ` + 79 `Unable to run ${serverSource.path} binary. ` +
80 `To use the pre-built language server, set "rust-analyzer.raLspServerPath" ` + 80 `To use the pre-built language server, set "rust-analyzer.raLspServerPath" ` +
81 "value to `null` or remove it from the settings to use it by default." 81 "value to `null` or remove it from the settings to use it by default."
82 ); 82 );
83 return null; 83 return null;
84 } 84 }
85 case BinarySource.Type.GithubRelease: { 85 case BinarySource.Type.GithubRelease: {
86 const prebuiltBinaryPath = path.join(langServerSource.dir, langServerSource.file); 86 const prebuiltBinaryPath = path.join(serverSource.dir, serverSource.file);
87 87
88 if (isBinaryAvailable(prebuiltBinaryPath)) { 88 if (isBinaryAvailable(prebuiltBinaryPath)) {
89 return prebuiltBinaryPath; 89 return prebuiltBinaryPath;
@@ -97,10 +97,10 @@ export async function ensureLangServerBinary(
97 if (userResponse !== "Download now") return null; 97 if (userResponse !== "Download now") return null;
98 98
99 try { 99 try {
100 await downloadLatestLangServer(langServerSource); 100 await downloadLatestServer(serverSource);
101 } catch (err) { 101 } catch (err) {
102 vscode.window.showErrorMessage( 102 vscode.window.showErrorMessage(
103 `Failed to download language server from ${langServerSource.repo.name} ` + 103 `Failed to download language server from ${serverSource.repo.name} ` +
104 `GitHub repository: ${err.message}` 104 `GitHub repository: ${err.message}`
105 ); 105 );
106 106
@@ -122,7 +122,7 @@ export async function ensureLangServerBinary(
122 122
123 if (!isBinaryAvailable(prebuiltBinaryPath)) assert(false, 123 if (!isBinaryAvailable(prebuiltBinaryPath)) assert(false,
124 `Downloaded language server binary is not functional.` + 124 `Downloaded language server binary is not functional.` +
125 `Downloaded from: ${JSON.stringify(langServerSource)}` 125 `Downloaded from: ${JSON.stringify(serverSource)}`
126 ); 126 );
127 127
128 128