Skip to content

Add option to configure the number of shake threads #230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@
"default": "off",
"description": "Traces the communication between VSCode and the languageServerHaskell service."
},
"languageServerHaskell.shakeThreads": {
"scope": "machine",
"type": ["integer", "null"],
"default": null,
"description":
"The number of Shake threads to use in ghcide or haskell-language-server. Leave empty for single threaded, or 0 for automatic."
},
"languageServerHaskell.logFile": {
"scope": "resource",
"type": "string",
Expand Down
10 changes: 9 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function activateHieNoCheck(context: ExtensionContext, folder: WorkspaceFolder,
// be absolute.
const serverPath = hieLaunchScript;

const runArgs: string[] = ['--lsp'];
let runArgs: string[] = ['--lsp'];
let debugArgs: string[] = ['--lsp'];

// ghcide does not accept -d and -l params
Expand All @@ -172,6 +172,14 @@ function activateHieNoCheck(context: ExtensionContext, folder: WorkspaceFolder,
debugArgs = debugArgs.concat(['-l', logFile]);
}
}
if (hieVariant === 'ghcide' || hieVariant === 'haskell-language-server') {
const shakeThreads: number | null = workspace.getConfiguration('languageServerHaskell', uri).shakeThreads;
if (shakeThreads !== null) {
const threadsArg = ['-j', shakeThreads.toString()];
runArgs = runArgs.concat(threadsArg);
debugArgs = debugArgs.concat(threadsArg);
}
}

// If the extension is launched in debug mode then the debug server options are used,
// otherwise the run options are used.
Expand Down