@@ -265,40 +265,42 @@ export async function findHaskellLanguageServer(
265
265
latestStack = await getLatestToolFromGHCup ( context , logger , 'stack' ) ;
266
266
}
267
267
if ( recGHC === undefined ) {
268
- recGHC = ! ( executableExists ( 'ghc' ) )
268
+ recGHC = ! executableExists ( 'ghc' )
269
269
? await getLatestAvailableToolFromGHCup ( context , logger , 'ghc' , 'recommended' )
270
270
: null ;
271
271
}
272
272
273
273
// download popups
274
274
const promptBeforeDownloads = workspace . getConfiguration ( 'haskell' ) . get ( 'promptBeforeDownloads' ) as boolean ;
275
275
if ( promptBeforeDownloads ) {
276
- const hlsInstalled = latestHLS
277
- ? await toolInstalled ( context , logger , 'hls' , latestHLS )
278
- : undefined ;
279
- const cabalInstalled = latestCabal
280
- ? await toolInstalled ( context , logger , 'cabal' , latestCabal )
281
- : undefined ;
282
- const stackInstalled = latestStack
283
- ? await toolInstalled ( context , logger , 'stack' , latestStack )
284
- : undefined ;
276
+ const hlsInstalled = latestHLS ? await toolInstalled ( context , logger , 'hls' , latestHLS ) : undefined ;
277
+ const cabalInstalled = latestCabal ? await toolInstalled ( context , logger , 'cabal' , latestCabal ) : undefined ;
278
+ const stackInstalled = latestStack ? await toolInstalled ( context , logger , 'stack' , latestStack ) : undefined ;
285
279
const ghcInstalled = executableExists ( 'ghc' )
286
- ? new InstalledTool ( 'ghc' , await callAsync ( `ghc${ exeExt } ` , [ '--numeric-version' ] , logger , undefined , undefined , false ) )
287
- // if recGHC is null, that means user disabled automatic handling,
288
- : ( recGHC !== null ? await toolInstalled ( context , logger , 'ghc' , recGHC ) : undefined ) ;
289
- const toInstall : InstalledTool [ ] = [ hlsInstalled , cabalInstalled , stackInstalled , ghcInstalled ]
290
- . filter ( ( tool ) => tool && ! tool . installed ) as InstalledTool [ ] ;
280
+ ? new InstalledTool (
281
+ 'ghc' ,
282
+ await callAsync ( `ghc${ exeExt } ` , [ '--numeric-version' ] , logger , undefined , undefined , false )
283
+ )
284
+ : // if recGHC is null, that means user disabled automatic handling,
285
+ recGHC !== null
286
+ ? await toolInstalled ( context , logger , 'ghc' , recGHC )
287
+ : undefined ;
288
+ const toInstall : InstalledTool [ ] = [ hlsInstalled , cabalInstalled , stackInstalled , ghcInstalled ] . filter (
289
+ ( tool ) => tool && ! tool . installed
290
+ ) as InstalledTool [ ] ;
291
291
if ( toInstall . length > 0 ) {
292
292
const decision = await window . showInformationMessage (
293
- `Need to download ${ toInstall . map ( t => t . nameWithVersion ) . join ( ', ' ) } , continue?` ,
293
+ `Need to download ${ toInstall . map ( ( t ) => t . nameWithVersion ) . join ( ', ' ) } , continue?` ,
294
294
'Yes' ,
295
295
'No' ,
296
296
"Yes, don't ask again"
297
297
) ;
298
298
if ( decision === 'Yes' ) {
299
- logger . info ( `User accepted download for ${ toInstall . map ( t => t . nameWithVersion ) . join ( ', ' ) } .` ) ;
299
+ logger . info ( `User accepted download for ${ toInstall . map ( ( t ) => t . nameWithVersion ) . join ( ', ' ) } .` ) ;
300
300
} else if ( decision === "Yes, don't ask again" ) {
301
- logger . info ( `User accepted download for ${ toInstall . map ( t => t . nameWithVersion ) . join ( ', ' ) } and won't be asked again.` ) ;
301
+ logger . info (
302
+ `User accepted download for ${ toInstall . map ( ( t ) => t . nameWithVersion ) . join ( ', ' ) } and won't be asked again.`
303
+ ) ;
302
304
workspace . getConfiguration ( 'haskell' ) . update ( 'promptBeforeDownloads' , false ) ;
303
305
} else {
304
306
toInstall . forEach ( ( tool ) => {
@@ -351,26 +353,25 @@ export async function findHaskellLanguageServer(
351
353
352
354
// more download popups
353
355
if ( promptBeforeDownloads ) {
354
- const hlsInstalled = projectHls
355
- ? await toolInstalled ( context , logger , 'hls' , projectHls )
356
- : undefined ;
357
- const ghcInstalled = projectGhc
358
- ? await toolInstalled ( context , logger , 'ghc' , projectGhc )
359
- : undefined ;
360
- const toInstall : InstalledTool [ ] = [ hlsInstalled , ghcInstalled ]
361
- . filter ( ( tool ) => tool && ! tool . installed ) as InstalledTool [ ] ;
356
+ const hlsInstalled = projectHls ? await toolInstalled ( context , logger , 'hls' , projectHls ) : undefined ;
357
+ const ghcInstalled = projectGhc ? await toolInstalled ( context , logger , 'ghc' , projectGhc ) : undefined ;
358
+ const toInstall : InstalledTool [ ] = [ hlsInstalled , ghcInstalled ] . filter (
359
+ ( tool ) => tool && ! tool . installed
360
+ ) as InstalledTool [ ] ;
362
361
if ( toInstall . length > 0 ) {
363
362
const decision = await window . showInformationMessage (
364
- `Need to download ${ toInstall . map ( t => t . nameWithVersion ) . join ( ', ' ) } , continue?` ,
363
+ `Need to download ${ toInstall . map ( ( t ) => t . nameWithVersion ) . join ( ', ' ) } , continue?` ,
365
364
{ modal : true } ,
366
365
'Yes' ,
367
366
'No' ,
368
367
"Yes, don't ask again"
369
368
) ;
370
369
if ( decision === 'Yes' ) {
371
- logger . info ( `User accepted download for ${ toInstall . map ( t => t . nameWithVersion ) . join ( ', ' ) } .` ) ;
370
+ logger . info ( `User accepted download for ${ toInstall . map ( ( t ) => t . nameWithVersion ) . join ( ', ' ) } .` ) ;
372
371
} else if ( decision === "Yes, don't ask again" ) {
373
- logger . info ( `User accepted download for ${ toInstall . map ( t => t . nameWithVersion ) . join ( ', ' ) } and won't be asked again.` ) ;
372
+ logger . info (
373
+ `User accepted download for ${ toInstall . map ( ( t ) => t . nameWithVersion ) . join ( ', ' ) } and won't be asked again.`
374
+ ) ;
374
375
workspace . getConfiguration ( 'haskell' ) . update ( 'promptBeforeDownloads' , false ) ;
375
376
} else {
376
377
toInstall . forEach ( ( tool ) => {
@@ -398,7 +399,15 @@ export async function findHaskellLanguageServer(
398
399
...( projectGhc ? [ '--ghc' , projectGhc ] : [ ] ) ,
399
400
'--install' ,
400
401
] ,
401
- `Installing project specific toolchain: ${ [ [ 'hls' , projectHls ] , [ 'GHC' , projectGhc ] , [ 'cabal' , latestCabal ] , [ 'stack' , latestStack ] ] . filter ( t => t [ 1 ] ) . map ( t => `${ t [ 0 ] } -${ t [ 1 ] } ` ) . join ( ', ' ) } ` ,
402
+ `Installing project specific toolchain: ${ [
403
+ [ 'hls' , projectHls ] ,
404
+ [ 'GHC' , projectGhc ] ,
405
+ [ 'cabal' , latestCabal ] ,
406
+ [ 'stack' , latestStack ] ,
407
+ ]
408
+ . filter ( ( t ) => t [ 1 ] )
409
+ . map ( ( t ) => `${ t [ 0 ] } -${ t [ 1 ] } ` )
410
+ . join ( ', ' ) } `,
402
411
true
403
412
) ;
404
413
0 commit comments