@@ -19,7 +19,6 @@ function getPath() {
19
19
// Make sure the cargo directory is in PATH
20
20
let { PATH } = process . env
21
21
PATH = PATH + ":" + path . join ( os . homedir ( ) , ".cargo/bin" )
22
-
23
22
return PATH
24
23
}
25
24
@@ -36,7 +35,7 @@ async function exec(command) {
36
35
} )
37
36
}
38
37
39
- function logErr ( e , logFn = console . warn ) {
38
+ function logErr ( e , logFn = console . warn ) {
40
39
const message = e && '' + e
41
40
message && logFn ( message )
42
41
}
@@ -55,8 +54,7 @@ function atomPrompt(message, options, buttons) {
55
54
return new Promise ( resolve => {
56
55
const notification = atom . notifications . addInfo (
57
56
message ,
58
- Object . assign (
59
- {
57
+ Object . assign ( {
60
58
dismissable : true ,
61
59
_src : 'ide-rust' ,
62
60
buttons : ( buttons || [ ] ) . map ( button => ( {
@@ -353,51 +351,52 @@ class RustLanguageClient extends AutoLanguageClient {
353
351
* @param {string } toolchain
354
352
*/
355
353
async _handleMissingToolchainMissingRls ( toolchain ) {
356
- const note = {
357
- description : '**Warning**: This toolchain is unavilable or missing Rls.' ,
358
- buttons : [ {
359
- text : 'Configure' ,
360
- onDidClick : ( ) => atom . workspace . open ( 'atom://config/packages/ide-rust' )
361
- } ] ,
362
- }
363
-
364
- if ( toolchain === 'nightly' ) {
365
- note . description += ' Try using a previous _dated_ nightly.'
366
- }
367
- else if ( toolchain . startsWith ( 'nightly' ) ) {
368
- note . description += ' Try using another nightly version.'
369
- }
370
-
371
- let suggestChannel = toolchain . startsWith ( 'beta' ) && 'beta' ||
372
- toolchain . startsWith ( 'stable' ) && 'stable' ||
373
- 'nightly'
374
-
375
- try {
376
- let suggestedVersion = await suggestChannelOrDated ( suggestChannel )
377
- if ( suggestedVersion ) {
378
- note . buttons . push ( {
379
- text : `Use ${ suggestedVersion } ` ,
380
- className : 'btn-success' ,
381
- onDidClick : ( ) => {
382
- clearIdeRustInfos ( )
383
- atom . config . set ( 'ide-rust.rlsToolchain' , suggestedVersion )
384
- }
385
- } )
386
- }
387
- } catch ( e ) {
388
- console . warn ( e )
389
- }
390
-
391
- atomPrompt ( `\`rustup\` missing ${ toolchain } toolchain` , note )
392
- }
354
+ const note = {
355
+ description : '**Warning**: This toolchain is unavilable or missing Rls.' ,
356
+ buttons : [ {
357
+ text : 'Configure' ,
358
+ onDidClick : ( ) => atom . workspace . open ( 'atom://config/packages/ide-rust' )
359
+ } ] ,
360
+ }
361
+
362
+ if ( toolchain === 'nightly' ) {
363
+ note . description += ' Try using a previous _dated_ nightly.'
364
+ }
365
+ else if ( toolchain . startsWith ( 'nightly' ) ) {
366
+ note . description += ' Try using another nightly version.'
367
+ }
368
+
369
+ let suggestChannel = toolchain . startsWith ( 'beta' ) && 'beta' ||
370
+ toolchain . startsWith ( 'stable' ) && 'stable' ||
371
+ 'nightly'
372
+
373
+ try {
374
+ let suggestedVersion = await suggestChannelOrDated ( suggestChannel )
375
+ if ( suggestedVersion ) {
376
+ note . buttons . push ( {
377
+ text : `Use ${ suggestedVersion } ` ,
378
+ className : 'btn-success' ,
379
+ onDidClick : ( ) => {
380
+ clearIdeRustInfos ( )
381
+ atom . config . set ( 'ide-rust.rlsToolchain' , suggestedVersion )
382
+ }
383
+ } )
384
+ }
385
+ }
386
+ catch ( e ) {
387
+ console . warn ( e )
388
+ }
389
+
390
+ atomPrompt ( `\`rustup\` missing ${ toolchain } toolchain` , note )
391
+ }
393
392
394
393
/** Takes appropriate action when missing rustup */
395
394
async _handleMissingRustup ( ) {
396
395
try {
397
396
let clicked = await atomPrompt ( "`rustup` is not available" , {
398
- description : "From https://www.rustup.rs/" ,
399
- detail : "curl https://sh.rustup.rs -sSf | sh"
400
- } , [ "Install" ] )
397
+ description : "From https://www.rustup.rs/" ,
398
+ detail : "curl https://sh.rustup.rs -sSf | sh"
399
+ } , [ "Install" ] )
401
400
402
401
if ( clicked === "Install" ) {
403
402
// Install rustup and try again
0 commit comments