From f3a959f94ea73bd38c555bf90922d7f2a106fe81 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 26 May 2020 08:25:50 +0200 Subject: [PATCH 01/14] Minor corrections and formatting --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index da1f915f99..f927e6c4f7 100644 --- a/README.md +++ b/README.md @@ -273,9 +273,9 @@ dependencies: ## Editor Integration -Note to editor integrators: there is now a haskell-language-server-wrapper executable, which is installed alongside the haskell-language-server executable. When this is invoked in the project root directory, it attempts to work out the GHC version used in the project, and then launch the matching haskell-language-server executable. +Note to editor integrators: there is a haskell-language-server-wrapper executable, which is installed alongside the haskell-language-server executable. When this is invoked in the project root directory, it attempts to work out the GHC version used in the project, and then launch the matching haskell-language-server executable. -All of the editor integrations assume that you have already installed haskell-language-server (see above) and that the installation script put the haskell-language-server binary in your path (usually `~/.local/bin` or `~/.cabal/bin` on linux and macOS). +All of the editor integrations assume that you have already installed haskell-language-server (see above) and that the installation script put the haskell-language-server binary in your path (usually `~/.local/bin` or `~/.cabal/bin` on linux and macOS and `%APPDATA%\cabal\bin` in windows). ### Using haskell-language-server with Emacs @@ -297,11 +297,10 @@ Make sure to follow the instructions in the README of each of these packages. ) ``` - - ### Using haskell-language-server with [doom-emacs](https://github.com/hlissner/doom-emacs/tree/develop/modules/lang/haskell#module-flags) Install haskell-language-server, and then enable haskell lang module with lsp flag in `.doom.d/init.el` + ``` emacs-lisp :lang (haskell +lsp) @@ -321,7 +320,6 @@ in your `.doom.d/config.el` file then do `$HOME/.emacs.d/bin/doom refresh` - ### Using haskell-language-server with [Kakoune](https://github.com/mawww/kakoune) 1. Grab a copy of [kak-lsp](https://github.com/ul/kak-lsp), and follow the setup instructions. @@ -337,7 +335,7 @@ args = ["--lsp"] ## Contributing -### It's time to join the project! +### It's time to join the project :heart: Haskell tooling dream is near, we need your help! :heart: From 9c4f60ae601d1ba2e82877217ef335fdb93947cd Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 26 May 2020 09:04:49 +0200 Subject: [PATCH 02/14] Copy rest of editor integrations from hie --- README.md | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 154 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f927e6c4f7..9e170134bd 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,18 @@ This is *very* early stage software. - [Install specific GHC Version](#install-specific-ghc-version) - [Project Configuration](#project-configuration) - [Editor Integration](#editor-integration) - - [With emacs](#using-haskell-language-server-with-emacs) - - [With doom emacs](#using-haskell-language-server-with-doom-emacs) - - [With Kakoune](#using-haskell-language-server-with-kakoune) + - [VS Code](#using-haskell-language-server-with-vs-code) + - [Sublime Text](#using-haskell-language-server-with-sublime-text) + - [Vim or Neovim](#using-haskell-language-server-with-vim-or-neovim) + - [Coc](#coc) + - [LanguageClient-neovim](#languageclient-neovim) + - [vim-plug](#vim-plug) + - [Clone the LanguageClient-neovim repo](#clone-the-languageclient-neovim-repo) + - [Sample `~/.vimrc`](#sample-vimrc) + - [Atom](#using-haskell-language-server-with-atom) + - [Emacs](#using-haskell-language-server-with-emacs) + - [Doom emacs](#using-haskell-language-server-with-doom-emacs) + - [Kakoune](#using-haskell-language-server-with-kakoune) - [Contributing](#contributing) - [It's time to join the project!](#its-time-to-join-the-project) @@ -275,7 +284,148 @@ dependencies: Note to editor integrators: there is a haskell-language-server-wrapper executable, which is installed alongside the haskell-language-server executable. When this is invoked in the project root directory, it attempts to work out the GHC version used in the project, and then launch the matching haskell-language-server executable. -All of the editor integrations assume that you have already installed haskell-language-server (see above) and that the installation script put the haskell-language-server binary in your path (usually `~/.local/bin` or `~/.cabal/bin` on linux and macOS and `%APPDATA%\cabal\bin` in windows). +All of the editor integrations assume that you have already installed haskell-language-server (see above) and that the installation script put the haskell-language-server and haskell-language-server-wrapper binaries in your path (usually `~/.local/bin` or `~/.cabal/bin` on linux and macOS, `%APPDATA%\local\bin` or `%APPDATA%\cabal\bin` in windows). + +### Using Haskell Language Server with VS Code + +Install from +[the VSCode marketplace](https://marketplace.visualstudio.com/items?itemName=alanz.vscode-hie-server), or manually from the repository [vscode-hie-server](https://github.com/alanz/vscode-hie-server). + +Choose `haskell-language-server` in the extension setting `languageServerHaskell.hieVariant`. + +### Using Haskell Language Server with Sublime Text + +- Make sure haskell-language-server and haskell-language-server-wrapper are installed (see above) and they are in the global `$PATH`. +- Install [LSP](https://packagecontrol.io/packages/LSP) using [Package Control](https://packagecontrol.io/) +- From Sublime Text, press Command+Shift+P and search for Preferences: LSP Settings +- Paste in these settings. Make sure to change the command path to your `hie` + +```json +{ +"clients": { + "haskell-ide-engine": { + "command": ["haskell-language-server-wrapper", "--lsp"], + "scopes": ["source.haskell"], + "syntaxes": ["Packages/Haskell/Haskell.sublime-syntax"], + "languageId": "haskell", + }, +}, +} +``` + +Now open a Haskell project with Sublime Text. You should have these features available to you: + +1. Errors are underlined in red +2. LSP: Show Diagnostics will show a list of hints and errors +3. LSP: Format Document will prettify the file + +### Using Haskell Language Server with Vim or Neovim + +As above, make sure haskell-language-server and haskell-language-server-wrapper are installed. +Then you can use [Coc](https://github.com/neoclide/coc.nvim), [LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neovim) +or any other vim Language server protocol client. +Coc is recommend since it is the only complete LSP implementation for Vim and Neovim and offers snippets and floating documentation out of the box. + +#### Coc + +Follow Coc's [installation instructions](https://github.com/neoclide/coc.nvim), +Then issue `:CocConfig` and add the following to your Coc config file. + +```jsonc +"languageserver": { + "haskell": { + "command": "haskell-language-server-wrapper", + "args": ["--lsp"], + "rootPatterns": [ + "*.cabal", + "stack.yaml", + "cabal.project", + "package.yaml" + ], + "filetypes": [ + "hs", + "lhs", + "haskell" + ], + "initializationOptions": { + "languageServerHaskell": { + } + } + } +} +``` + +#### LanguageClient-neovim + +##### vim-plug + +If you use [vim-plug](https://github.com/junegunn/vim-plug), then you can do this by e.g., +including the following line in the Plug section of your `init.vim` or `~/.vimrc`: + +```text +Plug 'autozimu/LanguageClient-neovim', { + \ 'branch': 'next', + \ 'do': './install.sh' + \ } +``` + +and issuing a `:PlugInstall` command within Neovim or Vim. + +##### Clone the LanguageClient-neovim repo + +As an alternative to using [vim-plug](https://github.com/junegunn/vim-plug) shown above, clone [LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neovim) +into `~/.vim/pack/XXX/start/`, where `XXX` is just a name for your "plugin suite". + +##### Sample `~/.vimrc` + +```vim +set rtp+=~/.vim/pack/XXX/start/LanguageClient-neovim +let g:LanguageClient_serverCommands = { 'haskell': ['haskell-language-server-wrapper', '--lsp'] } +``` + +You'll probably want to add some mappings for common commands: + +```vim +nnoremap :call LanguageClient_contextMenu() +map lk :call LanguageClient#textDocument_hover() +map lg :call LanguageClient#textDocument_definition() +map lr :call LanguageClient#textDocument_rename() +map lf :call LanguageClient#textDocument_formatting() +map lb :call LanguageClient#textDocument_references() +map la :call LanguageClient#textDocument_codeAction() +map ls :call LanguageClient#textDocument_documentSymbol() +``` + +Use Ctrl+xCtrl+o (``) to open up the auto-complete menu, +or for asynchronous auto-completion, follow the setup instructions on +[LanguageClient](https://github.com/autozimu/LanguageClient-neovim). + +If you'd like diagnostics to be highlighted, add a highlight group for `ALEError`/`ALEWarning`/`ALEInfo`, +or customize `g:LanguageClient_diagnosticsDisplay`: + +```vim +hi link ALEError Error +hi Warning term=underline cterm=underline ctermfg=Yellow gui=undercurl guisp=Gold +hi link ALEWarning Warning +hi link ALEInfo SpellCap +``` + +If you're finding that the server isn't starting at the correct project root, +it may also be helpful to also specify root markers: + +```vim +let g:LanguageClient_rootMarkers = ['*.cabal', 'stack.yaml'] +``` + +### Using Haskell Language Server with Atom + +Make sure haskell-language-server and haskell-language-server-wrapper are installed, then install the two Atom packages [atom-ide-ui](https://atom.io/packages/atom-ide-ui) and [ide-haskell-hie](https://atom.io/packages/ide-haskell-hie), + +```bash +$ apm install language-haskell atom-ide-ui ide-haskell-hie +``` + +The plugin ide-haskell-ide is designed to work with haskell-ide-engine by default, so you will have to put the path to haskell-language-server-wrapper in the configuration option `Absolute path to hie executable`. ### Using haskell-language-server with Emacs From ad713ce884dc5d44e035959dd83ba4168c894490 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 26 May 2020 11:15:37 +0200 Subject: [PATCH 03/14] Update install instructions for vim-plug --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9e170134bd..fa5eb4506a 100644 --- a/README.md +++ b/README.md @@ -365,7 +365,7 @@ including the following line in the Plug section of your `init.vim` or `~/.vimrc ```text Plug 'autozimu/LanguageClient-neovim', { \ 'branch': 'next', - \ 'do': './install.sh' + \ 'do': 'bash install.sh' \ } ``` From 0fd8ea49efab651dc64264a4acc836df478f4cdf Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Tue, 26 May 2020 21:56:46 +0200 Subject: [PATCH 04/14] Add backquotes to executables Co-authored-by: Julien Debon --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fa5eb4506a..947cf29502 100644 --- a/README.md +++ b/README.md @@ -282,7 +282,7 @@ dependencies: ## Editor Integration -Note to editor integrators: there is a haskell-language-server-wrapper executable, which is installed alongside the haskell-language-server executable. When this is invoked in the project root directory, it attempts to work out the GHC version used in the project, and then launch the matching haskell-language-server executable. +Note to editor integrators: there is a `haskell-language-server-wrapper` executable, which is installed alongside the `haskell-language-server` executable. When this is invoked in the project root directory, it attempts to work out the GHC version used in the project, and then launch the matching `haskell-language-server` executable. All of the editor integrations assume that you have already installed haskell-language-server (see above) and that the installation script put the haskell-language-server and haskell-language-server-wrapper binaries in your path (usually `~/.local/bin` or `~/.cabal/bin` on linux and macOS, `%APPDATA%\local\bin` or `%APPDATA%\cabal\bin` in windows). From 935bc9389e514d7962cd921edc22d54e2522f27c Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Tue, 26 May 2020 21:57:44 +0200 Subject: [PATCH 05/14] More backquotes and upper case Co-authored-by: Julien Debon --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 947cf29502..c13953c65f 100644 --- a/README.md +++ b/README.md @@ -284,7 +284,7 @@ dependencies: Note to editor integrators: there is a `haskell-language-server-wrapper` executable, which is installed alongside the `haskell-language-server` executable. When this is invoked in the project root directory, it attempts to work out the GHC version used in the project, and then launch the matching `haskell-language-server` executable. -All of the editor integrations assume that you have already installed haskell-language-server (see above) and that the installation script put the haskell-language-server and haskell-language-server-wrapper binaries in your path (usually `~/.local/bin` or `~/.cabal/bin` on linux and macOS, `%APPDATA%\local\bin` or `%APPDATA%\cabal\bin` in windows). +All of the editor integrations assume that you have already installed `haskell-language-server` (see above) and that the installation script put the `haskell-language-server` and `haskell-language-server-wrapper` binaries in your `PATH` (usually `~/.local/bin` or `~/.cabal/bin` on Linux and macOS, `%APPDATA%\local\bin` or `%APPDATA%\cabal\bin` on Windows). ### Using Haskell Language Server with VS Code From d92670e59d2d94140b893e06bef68fccf5af953c Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Tue, 26 May 2020 22:00:09 +0200 Subject: [PATCH 06/14] Rephrasing Co-authored-by: Julien Debon --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c13953c65f..07311e0b0a 100644 --- a/README.md +++ b/README.md @@ -313,7 +313,7 @@ Choose `haskell-language-server` in the extension setting `languageServerHaskell } ``` -Now open a Haskell project with Sublime Text. You should have these features available to you: +Now open a Haskell project with Sublime Text. You should have these features available: 1. Errors are underlined in red 2. LSP: Show Diagnostics will show a list of hints and errors From 18b44a3d391d89abfa7f1fa332d606b97ad63093 Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Tue, 26 May 2020 22:11:37 +0200 Subject: [PATCH 07/14] Correct upper case Co-authored-by: Julien Debon --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 07311e0b0a..dd574ac7f7 100644 --- a/README.md +++ b/README.md @@ -323,7 +323,7 @@ Now open a Haskell project with Sublime Text. You should have these features ava As above, make sure haskell-language-server and haskell-language-server-wrapper are installed. Then you can use [Coc](https://github.com/neoclide/coc.nvim), [LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neovim) -or any other vim Language server protocol client. +or any other Vim Language server protocol client. Coc is recommend since it is the only complete LSP implementation for Vim and Neovim and offers snippets and floating documentation out of the box. #### Coc From c01f4d9ec492499ecac170affdf70f172b9520f5 Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Tue, 26 May 2020 22:11:57 +0200 Subject: [PATCH 08/14] Correct punctuation Co-authored-by: Julien Debon --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dd574ac7f7..fe32460178 100644 --- a/README.md +++ b/README.md @@ -328,7 +328,7 @@ Coc is recommend since it is the only complete LSP implementation for Vim and Ne #### Coc -Follow Coc's [installation instructions](https://github.com/neoclide/coc.nvim), +Follow Coc's [installation instructions](https://github.com/neoclide/coc.nvim). Then issue `:CocConfig` and add the following to your Coc config file. ```jsonc From 12cf5e521726c9c742a3e19de9803e5e102349d6 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 26 May 2020 22:28:18 +0200 Subject: [PATCH 09/14] Remove redundant mention to install --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fe32460178..96521d0c6e 100644 --- a/README.md +++ b/README.md @@ -295,10 +295,9 @@ Choose `haskell-language-server` in the extension setting `languageServerHaskell ### Using Haskell Language Server with Sublime Text -- Make sure haskell-language-server and haskell-language-server-wrapper are installed (see above) and they are in the global `$PATH`. - Install [LSP](https://packagecontrol.io/packages/LSP) using [Package Control](https://packagecontrol.io/) - From Sublime Text, press Command+Shift+P and search for Preferences: LSP Settings -- Paste in these settings. Make sure to change the command path to your `hie` +- Paste in these settings. Make sure to change the command path to your `haskell-language-server` ```json { @@ -321,8 +320,7 @@ Now open a Haskell project with Sublime Text. You should have these features ava ### Using Haskell Language Server with Vim or Neovim -As above, make sure haskell-language-server and haskell-language-server-wrapper are installed. -Then you can use [Coc](https://github.com/neoclide/coc.nvim), [LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neovim) +You can use [Coc](https://github.com/neoclide/coc.nvim), [LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neovim) or any other Vim Language server protocol client. Coc is recommend since it is the only complete LSP implementation for Vim and Neovim and offers snippets and floating documentation out of the box. @@ -419,7 +417,7 @@ let g:LanguageClient_rootMarkers = ['*.cabal', 'stack.yaml'] ### Using Haskell Language Server with Atom -Make sure haskell-language-server and haskell-language-server-wrapper are installed, then install the two Atom packages [atom-ide-ui](https://atom.io/packages/atom-ide-ui) and [ide-haskell-hie](https://atom.io/packages/ide-haskell-hie), +Install the two Atom packages [atom-ide-ui](https://atom.io/packages/atom-ide-ui) and [ide-haskell-hie](https://atom.io/packages/ide-haskell-hie), ```bash $ apm install language-haskell atom-ide-ui ide-haskell-hie From d459c78b6154a90fb449c4f63979cfe81badc76e Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 26 May 2020 22:30:31 +0200 Subject: [PATCH 10/14] Remove reference to mac specific key shortcut --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 96521d0c6e..1d70a90dbe 100644 --- a/README.md +++ b/README.md @@ -296,8 +296,8 @@ Choose `haskell-language-server` in the extension setting `languageServerHaskell ### Using Haskell Language Server with Sublime Text - Install [LSP](https://packagecontrol.io/packages/LSP) using [Package Control](https://packagecontrol.io/) -- From Sublime Text, press Command+Shift+P and search for Preferences: LSP Settings -- Paste in these settings. Make sure to change the command path to your `haskell-language-server` +- From Sublime Text, go to Preferences and search for LSP Settings +- Paste in these settings. Make sure to change the command path to your `haskell-language-server-wrapper` ```json { From 3dbde82d8ca70dd061c3f73319a17b41b4ff28c5 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 26 May 2020 22:32:36 +0200 Subject: [PATCH 11/14] Fix json formatting --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1d70a90dbe..2750aab8ed 100644 --- a/README.md +++ b/README.md @@ -301,14 +301,14 @@ Choose `haskell-language-server` in the extension setting `languageServerHaskell ```json { -"clients": { - "haskell-ide-engine": { - "command": ["haskell-language-server-wrapper", "--lsp"], - "scopes": ["source.haskell"], - "syntaxes": ["Packages/Haskell/Haskell.sublime-syntax"], - "languageId": "haskell", + "clients": { + "haskell-ide-engine": { + "command": ["haskell-language-server-wrapper", "--lsp"], + "scopes": ["source.haskell"], + "syntaxes": ["Packages/Haskell/Haskell.sublime-syntax"], + "languageId": "haskell", + }, }, -}, } ``` @@ -329,7 +329,7 @@ Coc is recommend since it is the only complete LSP implementation for Vim and Ne Follow Coc's [installation instructions](https://github.com/neoclide/coc.nvim). Then issue `:CocConfig` and add the following to your Coc config file. -```jsonc +```json "languageserver": { "haskell": { "command": "haskell-language-server-wrapper", From 2cf7913091da25fc8990af8243648437a017d6e1 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 26 May 2020 22:40:25 +0200 Subject: [PATCH 12/14] Correct typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2750aab8ed..b9064416a9 100644 --- a/README.md +++ b/README.md @@ -423,7 +423,7 @@ Install the two Atom packages [atom-ide-ui](https://atom.io/packages/atom-ide-ui $ apm install language-haskell atom-ide-ui ide-haskell-hie ``` -The plugin ide-haskell-ide is designed to work with haskell-ide-engine by default, so you will have to put the path to haskell-language-server-wrapper in the configuration option `Absolute path to hie executable`. +The plugin ide-haskell-hie is designed to work with haskell-ide-engine by default, so you will have to put the path to haskell-language-server-wrapper in the configuration option `Absolute path to hie executable`. ### Using haskell-language-server with Emacs From 34ed4b92c792dfd0b9141e7c3a6b4fa9ddda4c5c Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 26 May 2020 22:50:26 +0200 Subject: [PATCH 13/14] Add needed step for sublime --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b9064416a9..a87bc19ba2 100644 --- a/README.md +++ b/README.md @@ -312,7 +312,8 @@ Choose `haskell-language-server` in the extension setting `languageServerHaskell } ``` -Now open a Haskell project with Sublime Text. You should have these features available: +Now open a Haskell project with Sublime Text and enable Language Server in the project. +You should have these features available: 1. Errors are underlined in red 2. LSP: Show Diagnostics will show a list of hints and errors From e59b4bd43d5b0ca0a5a38795086ea5dc112b05de Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 26 May 2020 23:18:40 +0200 Subject: [PATCH 14/14] Correct language server name --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a87bc19ba2..c81c0473df 100644 --- a/README.md +++ b/README.md @@ -302,7 +302,7 @@ Choose `haskell-language-server` in the extension setting `languageServerHaskell ```json { "clients": { - "haskell-ide-engine": { + "haskell-language-server": { "command": ["haskell-language-server-wrapper", "--lsp"], "scopes": ["source.haskell"], "syntaxes": ["Packages/Haskell/Haskell.sublime-syntax"],