@@ -71,44 +71,48 @@ export async function ensureLanguageServerBinary(
71
71
if ( isBinaryAvailable ( langServerSource . path ) ) {
72
72
return langServerSource . path ;
73
73
}
74
+
74
75
vscode . window . showErrorMessage (
75
76
`Unable to run ${ langServerSource . path } binary. ` +
76
- " To use the pre-built language server, set ` rust-analyzer.raLspServerPath` " +
77
+ ` To use the pre-built language server, set " rust-analyzer.raLspServerPath" ` +
77
78
"value to `null` or remove it from the settings to use it by default."
78
79
) ;
79
80
return null ;
80
81
}
81
82
case BinarySource . Type . GithubRelease : {
82
83
const prebuiltBinaryPath = path . join ( langServerSource . dir , langServerSource . file ) ;
83
84
84
- if ( ! isBinaryAvailable ( prebuiltBinaryPath ) ) {
85
- const userResponse = await vscode . window . showInformationMessage (
86
- "Language server binary for rust-analyzer was not found. " +
87
- "Do you want to download it now?" ,
88
- "Download now" , "Cancel"
89
- ) ;
90
- if ( userResponse !== "Download now" ) return null ;
91
-
92
- try {
93
- await downloadLatestLanguageServer ( langServerSource ) ;
94
- } catch ( err ) {
95
- await vscode . window . showErrorMessage (
96
- `Failed to download language server from ${ langServerSource . repo . name } ` +
97
- `GitHub repository: ${ err . message } `
98
- ) ;
99
- return null ;
100
- }
101
-
102
-
103
- assert (
104
- isBinaryAvailable ( prebuiltBinaryPath ) ,
105
- "Downloaded language server binary is not functional"
106
- ) ;
85
+ if ( isBinaryAvailable ( prebuiltBinaryPath ) ) {
86
+ return prebuiltBinaryPath ;
87
+ }
107
88
108
- vscode . window . showInformationMessage (
109
- "Rust analyzer language server was successfully installed 🦀"
89
+ const userResponse = await vscode . window . showInformationMessage (
90
+ "Language server binary for rust-analyzer was not found. " +
91
+ "Do you want to download it now?" ,
92
+ "Download now" , "Cancel"
93
+ ) ;
94
+ if ( userResponse !== "Download now" ) return null ;
95
+
96
+ try {
97
+ await downloadLatestLanguageServer ( langServerSource ) ;
98
+ } catch ( err ) {
99
+ await vscode . window . showErrorMessage (
100
+ `Failed to download language server from ${ langServerSource . repo . name } ` +
101
+ `GitHub repository: ${ err . message } `
110
102
) ;
103
+ return null ;
111
104
}
105
+
106
+
107
+ assert (
108
+ isBinaryAvailable ( prebuiltBinaryPath ) ,
109
+ "Downloaded language server binary is not functional"
110
+ ) ;
111
+
112
+ vscode . window . showInformationMessage (
113
+ "Rust analyzer language server was successfully installed 🦀"
114
+ ) ;
115
+
112
116
return prebuiltBinaryPath ;
113
117
}
114
118
}
0 commit comments