Skip to content

Commit 6c57f85

Browse files
committed
Improve plugin initialization
1 parent 1d1a579 commit 6c57f85

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
"haskell.manageHLS": {
167167
"scope": "resource",
168168
"type": "string",
169-
"default": null,
169+
"default": "PATH",
170170
"description": "How to manage/find HLS installations.",
171171
"enum": [
172172
"GHCup",

src/hlsBinaries.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export { IEnvVars };
3030
export type ReleaseMetadata = Map<string, Map<string, Map<string, string[]>>>;
3131

3232
type ManageHLS = 'GHCup' | 'PATH';
33-
let manageHLS = workspace.getConfiguration('haskell').get('manageHLS') as ManageHLS | null;
33+
let manageHLS = workspace.getConfiguration('haskell').get('manageHLS') as ManageHLS;
3434

3535
// On Windows the executable needs to be stored somewhere with an .exe extension
3636
const exeExt = process.platform === 'win32' ? '.exe' : '';
@@ -239,7 +239,7 @@ export async function findHaskellLanguageServer(
239239
fs.mkdirSync(storagePath);
240240
}
241241

242-
if (!manageHLS) {
242+
if (!context.globalState.get("pluginInitialized") as boolean | null) {
243243
// plugin needs initialization
244244
const promptMessage = 'How do you want the extension to manage/discover HLS and the relevant toolchain?';
245245

@@ -256,6 +256,7 @@ export async function findHaskellLanguageServer(
256256
manageHLS = 'PATH';
257257
}
258258
workspace.getConfiguration('haskell').update('manageHLS', manageHLS, ConfigurationTarget.Global);
259+
context.globalState.update("pluginInitialized", true);
259260
}
260261

261262
if (manageHLS === 'PATH' || manageHLS === null) {

0 commit comments

Comments
 (0)