forked from haskell/vscode-haskell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.ts
More file actions
56 lines (52 loc) · 1.39 KB
/
errors.ts
File metadata and controls
56 lines (52 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { Uri } from 'vscode';
export class HlsError extends Error {}
export class MissingToolError extends HlsError {
public readonly tool: string;
constructor(tool: string) {
let prettyTool: string;
switch (tool.toLowerCase()) {
case 'stack':
prettyTool = 'Stack';
break;
case 'cabal':
prettyTool = 'Cabal';
break;
case 'ghc':
prettyTool = 'GHC';
break;
case 'ghcup':
prettyTool = 'GHCup';
break;
case 'haskell-language-server':
case 'hls':
prettyTool = 'HLS';
break;
default:
prettyTool = tool;
break;
}
super(`Project requires ${prettyTool} but it isn't installed`);
this.tool = prettyTool;
}
public installLink(): Uri | null {
switch (this.tool) {
case 'Stack':
return Uri.parse('https://docs.haskellstack.org/en/stable/install_and_upgrade/');
case 'GHCup':
case 'Cabal':
case 'HLS':
case 'GHC':
return Uri.parse('https://www.haskell.org/ghcup/');
default:
return null;
}
}
}
export class NoMatchingHls extends Error {
constructor(readonly ghcProjVersion: string) {
super(`HLS does not support GHC ${ghcProjVersion} yet.`);
}
public docLink(): Uri {
return Uri.parse('https://haskell-language-server.readthedocs.io/en/latest/support/ghc-version-support.html');
}
}