From dd86e6b05530d0afa68f2131a9d3fa0af97bd4bc Mon Sep 17 00:00:00 2001 From: sir4ur0n Date: Sun, 16 Aug 2020 17:48:17 +0200 Subject: [PATCH 1/2] doc(hack): Add explanation to hack and test HLS --- README.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b9cc143e60..f4481ff81c 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,8 @@ This is *very* early stage software. - [Preprocessor](#preprocessor) - [Contributing](#contributing) - [It's time to join the project!](#its-time-to-join-the-project) + - [Building haskell-language-server](#building-haskell-language-server) + - [Hacking on haskell-language-server](#hacking-on-haskell-language-server) ## Features @@ -551,7 +553,7 @@ This returns an error in HLS if 'tasty-discover' is not in the path: `could not - Fork this repo and hack as much as you can. - Ask @alanz or @hvr to join the project. -### Hacking on haskell-language-server +### Building haskell-language-server Haskell-language-server can be used on itself. We provide preset samples of `hie.yaml` for Cabal and Stack. @@ -577,3 +579,27 @@ $ stack build --test --no-run-tests $ cd install $ stack build ``` + +### Hacking on haskell-language-server + +#### Introduction tutorial +Pepeiborra [wrote an tutorial](https://github.com/pepeiborra/hls-tutorial) on writing a plugin in HLS. + +#### Test your hacked HLS in your editor +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: `/haskell-language-server/dist-newstyle/build///haskell-language-server-/x/haskell-language-server/build/haskell-language-server/haskell-language-server` + - This value can be found by running `cabal exec which haskell-language-server` + - With Stack: `/haskell-language-server/.stack-work/dist//Cabal-/build/haskell-language-server/haskell-language-server` + - This value can be found by running `$(stack path --dist-dir)/build/haskell-language-server/haskell-language-server` + +To do every time you changed code and want to test it: +- Build HLS + - With Cabal: `cabal build exe:haskell-language-server` + - With Stack: `stack build haskell-language-server:exe:haskell-language-server` +- Restart HLS + - With VS Code: `Haskell: Restart Haskell LSP Server` + From cd2e29162fb9dd161d62d62189d3686050cbeb38 Mon Sep 17 00:00:00 2001 From: sir4ur0n Date: Mon, 17 Aug 2020 18:27:04 +0200 Subject: [PATCH 2/2] Fix after review --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f4481ff81c..a306758920 100644 --- a/README.md +++ b/README.md @@ -591,10 +591,10 @@ 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: `/haskell-language-server/dist-newstyle/build///haskell-language-server-/x/haskell-language-server/build/haskell-language-server/haskell-language-server` - - This value can be found by running `cabal exec which haskell-language-server` - - With Stack: `/haskell-language-server/.stack-work/dist//Cabal-/build/haskell-language-server/haskell-language-server` - - This value can be found by running `$(stack path --dist-dir)/build/haskell-language-server/haskell-language-server` + - 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` To do every time you changed code and want to test it: - Build HLS