Skip to content

Commit 084bbbd

Browse files
committed
Improve ghc project version error messages, update README a bit more
1 parent 1c94c3e commit 084bbbd

File tree

2 files changed

+25
-20
lines changed

2 files changed

+25
-20
lines changed

README.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ This is the Visual Studio Code extension for the [Haskell programming language](
44

55
## Features
66

7-
- Warning and error diagnostics
7+
- Warning and error diagnostics from GHC
88
- Code actions and quick-fixes via [`apply-refact`](https://github.com/mpickering/apply-refact) (click the lightbulb)
99
- Type information and documentation on hover
10-
- Jump to definition (`F12` or `Go to Definition` in the command palette)
11-
- List all top level definitions
10+
- Jump to definition
11+
- Document symbols
1212
- Highlight references in document
1313
- Code completion
14-
- Formatting via [`brittany`](https://github.com/lspitzner/brittany) (`^ ⌥ B` or `Format Document` in command palette)
14+
- Formatting via Brittany, Floskell, Ormolu or Stylish Haskell
1515
- [Multi-root workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces) support
1616

1717
## Requirements
@@ -75,35 +75,37 @@ There are a few placeholders which will be expanded:
7575
- `~`, `${HOME}` and `${home}` will be expanded into your users' home folder.
7676
- `${workspaceFolder}` and `${workspaceRoot}` will expand into your current project root.
7777

78-
## Docs on Hover/Generating Hoogle DB
78+
## Local documentation
7979

80-
For the most current documentation on this, see [Docs on Hover/Completion](https://github.com/haskell/haskell-ide-engine#docs-on-hovercompletion).
80+
Haskell Language Server can display Haddock documentation on hover and in code completion for your code if you have built your project with haddock enabled.
8181

82-
HIE supports fetching docs from haddock on hover. It will fallback on using a hoogle db(generally located in ~/.hoogle on linux)
83-
if no haddock documentation is found.
84-
85-
To generate haddock documentation for stack projects:
82+
For stack projects, in your project directory run
8683

8784
```bash
88-
$ cd your-project-directory
8985
$ stack haddock --keep-going
9086
```
9187

92-
To enable documentation generation for cabal projects, add the following to your ~/.cabal/config
88+
For cabal projects, run
89+
90+
```bash
91+
$ cabal build --haddock
92+
```
93+
94+
Or alternatively add the following to your `~/.cabal/config` or `cabal.config[.local]`
9395

9496
```json
9597
documentation: True
9698
```
9799

98-
To generate a hoogle database that hie can use
100+
### Haskell IDE Engine and Hoogle
101+
102+
If you are using Haskell IDE Engine as the language server, it pulls in documentation via Hoogle. After installing Hoogle via `cabal install hoogle` or `stack install hoogle`, generate the database with:
99103

100104
```bash
101-
$ cd haskell-ide-engine
102-
$ stack --stack-yaml=<stack.yaml you used to build hie> exec hoogle generate
105+
$ hoogle generate
103106
```
104107

105-
For now `ghcide`and `haskell-language-server` have not that fallback to the hoogle database, so
106-
you should generate haddock documentation as described above.
108+
Haskell IDE Engine
107109

108110
## Manual Installation
109111

@@ -141,11 +143,11 @@ This extension will download the language server binaries to a specific location
141143

142144
## Investigating and reporting problems
143145

144-
1. Go to extensions and right click `Haskell Language Server` and choose `Configure Extensions Settings`
146+
1. Go to extensions and right click `Haskell` and choose `Configure Extensions Settings`
145147
2. Scroll down to `Language Server Haskell › Trace: Server` and set it to `verbose`
146148
3. Restart vscode and reproduce your problem
147149
4. Go to the main menu and choose `View -> Output` (`Ctrl + Shift + U`)
148-
5. On the new Output panel that opens on the right side in the drop down menu choose `Haskell HIE (cabal)`
150+
5. On the new Output panel that opens on the right side in the drop down menu choose `Haskell`
149151

150152
Now you will see the information which you can use to diagnose or report a problem
151153

src/hlsBinaries.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ async function getProjectGhcVersion(context: ExtensionContext, dir: string, rele
4040
if (out.error) {
4141
throw out.error;
4242
}
43+
if (out.status !== 0) {
44+
throw Error(`${wrapper} --project-ghc-version exited with exit code ${out.status}:\n${out.stderr}`);
45+
}
4346
return out.stdout.trim();
4447
}
4548
);
@@ -135,7 +138,7 @@ export async function downloadServer(
135138
ghcVersion = await getProjectGhcVersion(context, dir, release);
136139
} catch (error) {
137140
// We couldn't figure out the right ghc version to download
138-
window.showErrorMessage("Couldn't figure out what GHC version the project is using");
141+
window.showErrorMessage(`Couldn't figure out what GHC version the project is using:\n${error.message}`);
139142
return null;
140143
}
141144

0 commit comments

Comments
 (0)