From 3bed4080bf959896bdfd1619156b89dae8235918 Mon Sep 17 00:00:00 2001 From: Georgi Lyubenov Date: Sat, 26 Sep 2020 00:26:43 +0300 Subject: [PATCH 1/4] Add documentation on choosing a formatter --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index d5b97e1cb5..16ce6059ee 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ This is *very* early stage software. - [Building](#building) - [Install via cabal](#install-via-cabal) - [Install specific GHC Version](#install-specific-ghc-version) + - [HLS LSP Configuration](#hls-lsp-configuration) - [Project Configuration](#project-configuration) - [Editor Integration](#editor-integration) - [VS Code](#using-haskell-language-server-with-vs-code) @@ -253,6 +254,34 @@ If your desired ghc has been found, you use it to install haskell-language-serve ./cabal-hls-install data ``` +## HLS LSP Configuration + +haskell-language-server supports some forms of configuration. + +### Formatting providers +By default, haskell-language-server is compiled with support for several different formatters. + +These include +* `floskell` +* `fourmolu` +* `ormolu` +* `stylish-haskell` +* `brittany` (if compiled with AGPL) + +To choose one of them, you need to include the name of the one you want to use +as the value for the `formattingProvider` key in your LSP configuration like so: +```json +{ + ... + "haskell": { + ... + "formattingProvider": "fourmolu" + ... + } + ... +} +``` + ## Project Configuration **For a full explanation of possible configurations, refer to [hie-bios/README](https://github.com/mpickering/hie-bios/blob/master/README.md).** From d8f0d36b7fd5afab8b79b17815a807c78cbf4c91 Mon Sep 17 00:00:00 2001 From: Georgi Lyubenov Date: Sat, 26 Sep 2020 00:27:03 +0300 Subject: [PATCH 2/4] Cleanup trailing whitespace --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 16ce6059ee..e91f03554e 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,7 @@ The script will install the executables `haskell-language-server-wrapper` and `h It will copy the latter appending the used ghc version, needed by the wrapper to choose the suitable version for the project at hand. -So installing the executables directly with `stack install` or `cabal v2-install` may not be enough +So installing the executables directly with `stack install` or `cabal v2-install` may not be enough for it to work properly. Install haskell-language-server for the latest available and supported GHC version (and hoogle docs): @@ -604,7 +604,7 @@ This returns an error in HLS if 'tasty-discover' is not in the path: `could not ### Style guidelines The project includes a [`.editorconfig`](https://editorconfig.org) [file](https://github.com/haskell/haskell-language-server/blob/master/.editorconfig) with the editor basic settings used by the project. -However, most editors will need some action to honour those settings automatically. +However, most editors will need some action to honour those settings automatically. For example vscode needs to have installed a specific [extension](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig). Please, try to follow those basic settings to keep the codebase as uniform as possible. @@ -645,7 +645,7 @@ If you want to test HLS while hacking on it, follow the steps below. To do once: - Open some codebase on which you want to test your hacked HLS in your favorite editor - Configure this editor to use your custom HLS executable - - With Cabal: + - With Cabal: - On Unix systems: `cabal exec which haskell-language-server` - On Windows: `cabal exec where haskell-language-server` - With Stack: `$(stack path --dist-dir)/build/haskell-language-server/haskell-language-server` From 1b08736cfad6636cc49243cac1f83ca38c244244 Mon Sep 17 00:00:00 2001 From: Georgi Lyubenov Date: Sat, 26 Sep 2020 13:32:53 +0300 Subject: [PATCH 3/4] Clarify where lsp settings are located --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index e91f03554e..41429ecf65 100644 --- a/README.md +++ b/README.md @@ -258,6 +258,12 @@ If your desired ghc has been found, you use it to install haskell-language-serve haskell-language-server supports some forms of configuration. +This configuration is done via the LSP settings you provide with your editor and/or LSP client. +Some examples include: +* in VSCode/VSCodium this is done via the `Settings` tab +* with `LanguageClient-neovim` you can point the [`g:LanguageClient_settingsPath`](https://github.com/autozimu/LanguageClient-neovim/blob/0e5c9546bfddbaa2b01e5056389c25aefc8bf989/doc/LanguageClient.txt#L221) + variable to the file in which you want to keep your LSP settings + ### Formatting providers By default, haskell-language-server is compiled with support for several different formatters. From d65e7d4d64edff61ac13982faf732774b1e43755 Mon Sep 17 00:00:00 2001 From: Georgi Lyubenov Date: Fri, 2 Oct 2020 10:00:53 +0300 Subject: [PATCH 4/4] Replace direct json with just a key name mention --- README.md | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 41429ecf65..85ebb02c70 100644 --- a/README.md +++ b/README.md @@ -265,6 +265,8 @@ Some examples include: variable to the file in which you want to keep your LSP settings ### Formatting providers +##### Raw LSP key name: `haskell.formattingProvider` + By default, haskell-language-server is compiled with support for several different formatters. These include @@ -274,20 +276,6 @@ These include * `stylish-haskell` * `brittany` (if compiled with AGPL) -To choose one of them, you need to include the name of the one you want to use -as the value for the `formattingProvider` key in your LSP configuration like so: -```json -{ - ... - "haskell": { - ... - "formattingProvider": "fourmolu" - ... - } - ... -} -``` - ## Project Configuration **For a full explanation of possible configurations, refer to [hie-bios/README](https://github.com/mpickering/hie-bios/blob/master/README.md).**