Skip to content

Commit c4676da

Browse files
committed
Make haskell-language-server the default
Also rename a bunch of configuration paths so that they're server agnostic. This will break people's configurations
1 parent 599dd08 commit c4676da

File tree

4 files changed

+37
-42
lines changed

4 files changed

+37
-42
lines changed

README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,29 @@ Check the [requirements](#user-content-requirements) for dependencies.
99

1010
The language client requires you to manually install at least one of:
1111

12-
* [Haskell IDE Engine](https://github.com/haskell/haskell-ide-engine#installation): It was the unique haskell LSP server supported by this extension until version `0.40.0`. It is stable and functional but it will be replaced sooner or later by the new Haskell Language Server (see below).
13-
* [ghcide](https://github.com/digital-asset/ghcide#install-ghcide): A fast and reliable LSP server with the [main basic features](https://github.com/digital-asset/ghcide#features). Supported since the `0.40.0` version of the extension.
14-
* [Haskell language server](https://github.com/haskell/haskell-language-server#installation): The future successor of haskell-ide-engine. It is still under heavy development and it does not have all the features of haskell-ide-engine, yet, so use at your own risk! It is supported since the `0.40.0` version of the extension.
12+
- [Haskell IDE Engine](https://github.com/haskell/haskell-ide-engine#installation): It was the unique haskell LSP server supported by this extension until version `0.40.0`. It is stable and functional but it will be replaced sooner or later by the new Haskell Language Server (see below).
13+
- [ghcide](https://github.com/digital-asset/ghcide#install-ghcide): A fast and reliable LSP server with the [main basic features](https://github.com/digital-asset/ghcide#features). Supported since the `0.40.0` version of the extension.
14+
- [Haskell language server](https://github.com/haskell/haskell-language-server#installation): The future successor of haskell-ide-engine. It is still under heavy development and it does not have all the features of haskell-ide-engine, yet, so use at your own risk! It is supported since the `0.40.0` version of the extension.
1515

1616
## Features
1717

1818
Language server client for haskell using the [HIE](https://github.com/haskell/haskell-ide-engine) language server. Supports,
1919

20-
* Diagnostics via HLint and GHC warnings/errors
21-
* Code actions and quick-fixes via [`apply-refact`](https://github.com/mpickering/apply-refact) (click the lightbulb)
22-
* Type information and documentation (via hoogle) on hover
23-
* Jump to definition (`F12` or `Go to Definition` in command palette)
24-
* List all top level definitions
25-
* Highlight references in document
26-
* Completion
27-
* Formatting via [`brittany`](https://github.com/lspitzner/brittany) (`^ ⌥ B` or `Format Document` in command palette)
28-
* Renaming via [`HaRe`](https://github.com/alanz/HaRe) (`F2` or `Rename Symbol` in command palette)
29-
* [Multi-root workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces) support
20+
- Diagnostics via HLint and GHC warnings/errors
21+
- Code actions and quick-fixes via [`apply-refact`](https://github.com/mpickering/apply-refact) (click the lightbulb)
22+
- Type information and documentation (via hoogle) on hover
23+
- Jump to definition (`F12` or `Go to Definition` in command palette)
24+
- List all top level definitions
25+
- Highlight references in document
26+
- Completion
27+
- Formatting via [`brittany`](https://github.com/lspitzner/brittany) (`^ ⌥ B` or `Format Document` in command palette)
28+
- Renaming via [`HaRe`](https://github.com/alanz/HaRe) (`F2` or `Rename Symbol` in command palette)
29+
- [Multi-root workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces) support
3030

3131
Additionally the language server itself features,
3232

33-
* Supports plain GHC projects, cabal projects and stack projects
34-
* Fast due to caching of compile info
33+
- Supports plain GHC projects, cabal projects and stack projects
34+
- Fast due to caching of compile info
3535

3636
The other two language servers ([ghcide](https://github.com/digital-asset/ghcide#features) and haskell-language-server) have a subset of the features described above.
3737

@@ -66,9 +66,9 @@ The extension will look for the language server executable in `$PATH` and it wil
6666
with the appropiate params depending on the extension settings.
6767
However, not all extension settings can be applied to all the language servers:
6868

69-
* `haskell-ide-engine`: It supports all of them.
70-
* `ghcide`: It does not support any of them.
71-
* `haskell-language-server`: For now it only supports the log related settings: `Log File` and `Trace:server`. The goal is to support the same settings as `haskell-ide-engine`.
69+
- `haskell-ide-engine`: It supports all of them.
70+
- `ghcide`: It does not support any of them.
71+
- `haskell-language-server`: For now it only supports the log related settings: `Log File` and `Trace:server`. The goal is to support the same settings as `haskell-ide-engine`.
7272

7373
### Enable/disable HIE
7474

@@ -83,13 +83,13 @@ You can enable or disable the chosen haskell language server via configuration.
8383
If your chosen haskell language server executable is not on your path, you can manually set it,
8484

8585
```json
86-
"languageServerHaskell.hieExecutablePath": "~/.local/bin/hie"
86+
"languageServerHaskell.serverExecutablePath": "~/.local/bin/hie"
8787
```
8888

8989
There are a few placeholders which will be expanded:
9090

91-
* `~`, `${HOME}` and `${home}` will be expanded into your users' home folder.
92-
* `${workspaceFolder}` and `${workspaceRoot}` will expand into your current project root.
91+
- `~`, `${HOME}` and `${home}` will be expanded into your users' home folder.
92+
- `${workspaceFolder}` and `${workspaceRoot}` will expand into your current project root.
9393

9494
## Docs on Hover/Generating Hoogle DB
9595

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,18 @@
132132
"default": "",
133133
"description": "If set, redirects the logs to a file."
134134
},
135-
"languageServerHaskell.hieVariant": {
135+
"languageServerHaskell.serverVariant": {
136136
"scope": "resource",
137137
"type": "string",
138138
"enum": [
139139
"haskell-ide-engine",
140140
"haskell-language-server",
141141
"ghcide"
142142
],
143-
"default": "haskell-ide-engine",
143+
"default": "haskell-language-server",
144144
"description": "Which language server to use."
145145
},
146-
"languageServerHaskell.hieExecutablePath": {
146+
"languageServerHaskell.serverExecutablePath": {
147147
"scope": "resource",
148148
"type": "string",
149149
"default": "",

src/extension.ts

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,35 +63,30 @@ export async function activate(context: ExtensionContext) {
6363
}
6464

6565
function findManualExecutable(uri: Uri, folder?: WorkspaceFolder): string | null {
66-
let hieExecutablePath = workspace.getConfiguration('languageServerHaskell', uri).hieExecutablePath;
67-
if (hieExecutablePath === '') {
66+
let exePath = workspace.getConfiguration('languageServerHaskell', uri).serverExecutablePath;
67+
if (exePath === '') {
6868
return null;
6969
}
7070

7171
// Substitute path variables with their corresponding locations.
72-
hieExecutablePath = hieExecutablePath
73-
.replace('${HOME}', os.homedir)
74-
.replace('${home}', os.homedir)
75-
.replace(/^~/, os.homedir);
72+
exePath = exePath.replace('${HOME}', os.homedir).replace('${home}', os.homedir).replace(/^~/, os.homedir);
7673
if (folder) {
77-
hieExecutablePath = hieExecutablePath
78-
.replace('${workspaceFolder}', folder.uri.path)
79-
.replace('${workspaceRoot}', folder.uri.path);
74+
exePath = exePath.replace('${workspaceFolder}', folder.uri.path).replace('${workspaceRoot}', folder.uri.path);
8075
}
8176

82-
if (!executableExists(hieExecutablePath)) {
77+
if (!executableExists(exePath)) {
8378
throw new Error('Manual executable missing');
8479
}
85-
return hieExecutablePath;
80+
return exePath;
8681
}
8782

88-
/** Searches the PATH for whatever is set in hieVariant */
83+
/** Searches the PATH for whatever is set in serverVariant */
8984
function findLocalServer(context: ExtensionContext, uri: Uri, folder?: WorkspaceFolder): string | null {
90-
const hieVariant = workspace.getConfiguration('languageServerHaskell', uri).hieVariant;
85+
const serverVariant = workspace.getConfiguration('languageServerHaskell', uri).serverVariant;
9186

9287
// Set the executable, based on the settings.
9388
let exes: string[] = []; // should get set below
94-
switch (hieVariant) {
89+
switch (serverVariant) {
9590
case 'haskell-ide-engine':
9691
exes = ['hie-wrapper', 'hie'];
9792
break;
@@ -163,9 +158,9 @@ async function activateHieNoCheck(context: ExtensionContext, uri: Uri, folder?:
163158
const runArgs: string[] = ['--lsp'];
164159
let debugArgs: string[] = ['--lsp'];
165160

166-
const hieVariant = workspace.getConfiguration('languageServerHaskell', uri).hieVariant;
161+
const serverVariant = workspace.getConfiguration('languageServerHaskell', uri).serverVariant;
167162
// ghcide does not accept -d and -l params
168-
if (hieVariant !== 'ghcide') {
163+
if (serverVariant !== 'ghcide') {
169164
if (logLevel === 'messages') {
170165
debugArgs = debugArgs.concat(['-d']);
171166
}
@@ -253,7 +248,7 @@ export function deactivate(): Thenable<void> {
253248
}
254249

255250
function showNotInstalledErrorMessage(uri: Uri) {
256-
const variant = workspace.getConfiguration('languageServerHaskell', uri).hieVariant;
251+
const variant = workspace.getConfiguration('languageServerHaskell', uri).serverVariant;
257252
let projectUrl = '';
258253
switch (variant) {
259254
case 'haskell-ide-engine':

src/hlsBinaries.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export async function downloadServer(
8080
folder?: WorkspaceFolder
8181
): Promise<string | null> {
8282
// We only download binaries for haskell-language-server at the moment
83-
if (workspace.getConfiguration('languageServerHaskell', resource).hieVariant !== 'haskell-language-server') {
83+
if (workspace.getConfiguration('languageServerHaskell', resource).serverVariant !== 'haskell-language-server') {
8484
return null;
8585
}
8686

0 commit comments

Comments
 (0)