@@ -147,20 +147,15 @@ export async function downloadHaskellLanguageServer(context: ExtensionContext, l
147
147
const localWrapper = [ 'haskell-language-server-wrapper' ] . find ( executableExists ) ;
148
148
const downloadedWrapper = path . join (
149
149
storagePath ,
150
- process . platform === 'win32' ? '' : 'bin' ,
151
- `haskell-language-server-wrapper${ exeExt } `
152
- ) ;
153
- const downloadedLegacyWrapper = path . join (
154
- storagePath ,
150
+ '.ghcup' ,
151
+ 'bin' ,
155
152
`haskell-language-server-wrapper${ exeExt } `
156
153
) ;
157
154
let wrapper : string | undefined ;
158
- if ( localWrapper ) {
155
+ if ( localWrapper ) { // first try PATH
159
156
wrapper = localWrapper ;
160
- } else if ( executableExists ( downloadedWrapper ) ) {
157
+ } else if ( executableExists ( downloadedWrapper ) ) { // then try internal ghcup
161
158
wrapper = downloadedWrapper ;
162
- } else if ( executableExists ( downloadedLegacyWrapper ) ) {
163
- wrapper = downloadedLegacyWrapper ;
164
159
}
165
160
166
161
const ghcup = path . join ( storagePath , 'ghcup' ) ;
@@ -184,7 +179,7 @@ export async function downloadHaskellLanguageServer(context: ExtensionContext, l
184
179
}
185
180
await callAsync (
186
181
ghcup ,
187
- [ '--no-verbose' , 'install' , 'hls' , '--isolate' , storagePath , '--force ', 'latest' ] ,
182
+ [ '--no-verbose' , 'install' , 'hls' , '--set ' , 'latest' ] ,
188
183
storagePath ,
189
184
logger ,
190
185
`Installing latest HLS` ,
@@ -221,12 +216,19 @@ export async function downloadHaskellLanguageServer(context: ExtensionContext, l
221
216
222
217
// there's a new version
223
218
// delete old HLS
224
- await fs . rm ( path . join ( storagePath , 'bin' ) , { recursive : true , force : true } , ( ) => { } ) ;
225
- await fs . rm ( path . join ( storagePath , 'lib' ) , { recursive : true , force : true } , ( ) => { } ) ;
219
+ await callAsync (
220
+ ghcup ,
221
+ [ '--no-verbose' , 'rm' , 'hls' , version ] ,
222
+ storagePath ,
223
+ logger ,
224
+ `Removing old HLS ${ version } ` ,
225
+ false ,
226
+ { GHCUP_INSTALL_BASE_PREFIX : storagePath }
227
+ ) ;
226
228
// install new hls
227
229
await callAsync (
228
230
ghcup ,
229
- [ '--no-verbose' , 'install' , 'hls' , '--isolate' , storagePath , '--force ', latest_hls_version ] ,
231
+ [ '--no-verbose' , 'install' , 'hls' , '--set ' , latest_hls_version ] ,
230
232
storagePath ,
231
233
logger ,
232
234
`Upgrading HLS to ${ latest_hls_version } ` ,
@@ -307,7 +309,7 @@ export async function downloadGHCup(context: ExtensionContext, logger: Logger):
307
309
const ghcup = path . join ( storagePath , 'ghcup' ) ;
308
310
// ghcup exists, just upgrade
309
311
if ( fs . existsSync ( path . join ( storagePath , 'ghcup' ) ) ) {
310
- const args = [ 'upgrade' , '-i' ] ;
312
+ const args = [ '--no-verbose' , ' upgrade', '-i' ] ;
311
313
await callAsync ( ghcup , args , storagePath , logger , undefined , false , { GHCUP_INSTALL_BASE_PREFIX : storagePath } ) ;
312
314
} else {
313
315
// needs to download ghcup
0 commit comments