Skip to content

Commit 52a3b2c

Browse files
committed
Check exe for all language server impls
1 parent 3def99c commit 52a3b2c

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

src/extension.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,33 @@ async function activateHie(context: ExtensionContext, document: TextDocument) {
6868
}
6969

7070
try {
71+
const hieVariant = workspace.getConfiguration('languageServerHaskell', uri).hieVariant;
7172
const hieExecutablePath = workspace.getConfiguration('languageServerHaskell', uri).hieExecutablePath;
7273
// Check if hie is installed.
73-
const exeName = 'hie';
74+
let exeName = 'hie';
75+
switch (hieVariant) {
76+
case 'haskell-ide-engine':
77+
break;
78+
case 'haskell-language-server':
79+
case 'ghcide':
80+
exeName = hieVariant;
81+
break;
82+
}
7483
if (!await isHieInstalled(exeName) && hieExecutablePath === '') {
7584
// TODO: Once haskell-ide-engine is on hackage/stackage, enable an option to install it via cabal/stack.
85+
let hieProjectUrl = '/haskell/haskell-ide-engine';
86+
switch (hieVariant) {
87+
case 'haskell-ide-engine':
88+
break;
89+
case 'haskell-language-server':
90+
hieProjectUrl = '/haskell/haskell-language-server';
91+
break;
92+
case 'ghcide':
93+
hieProjectUrl = '/digital-asset/ghcide';
94+
break;
95+
}
7696
const notInstalledMsg: string =
77-
exeName + ' executable missing, please make sure it is installed, see github.com/haskell/haskell-ide-engine.';
97+
exeName + ' executable missing, please make sure it is installed, see https://github.com' + hieProjectUrl + '.';
7898
const forceStart: string = 'Force Start';
7999
window.showErrorMessage(notInstalledMsg, forceStart).then(option => {
80100
if (option === forceStart) {
@@ -141,7 +161,7 @@ function activateHieNoCheck(context: ExtensionContext, folder: WorkspaceFolder,
141161

142162
const runArgs: string[] = ['--lsp'];
143163
let debugArgs: string[] = ['--lsp'];
144-
164+
145165
// ghcide does not accept -d and -l params
146166
if (hieVariant !== 'ghcide') {
147167
if (logLevel === 'messages') {

0 commit comments

Comments
 (0)