|
| 1 | ++++ |
| 2 | +title = "Haskell Language Server 2.10.0.0 release" |
| 3 | +date = 2025-04-07 |
| 4 | +[taxonomies] |
| 5 | +authors = ["Fendor"] |
| 6 | +categories = ["HLS"] |
| 7 | +tags = ["Release"] |
| 8 | ++++ |
| 9 | + |
| 10 | +The HLS Team is proud to announce the new release of the Haskell Language Server `2.10.0.0`! |
| 11 | + |
| 12 | +<!-- more --> |
| 13 | + |
| 14 | +The last release of HLS was quite some time ago, back in July of 2024. |
| 15 | +Thus, this release has quite a number of new features, some of which we would like to highlight for you. |
| 16 | + |
| 17 | +## HLS `2.10.0.0` |
| 18 | + |
| 19 | +The release `2.10.0.0` supports the following GHC versions: |
| 20 | + |
| 21 | +* `9.12.2` |
| 22 | +* `9.10.1` |
| 23 | +* `9.8.4` |
| 24 | +* `9.6.7` |
| 25 | +* `9.4.8` |
| 26 | + |
| 27 | +We expect `2.10.0.0` to be the last HLS release having support for GHC `9.4` versions. |
| 28 | + |
| 29 | +### Go to Implementations |
| 30 | + |
| 31 | +We added support for a new LSP feature called `Go to Implementations`. |
| 32 | +This LSP feature allows you to jump to the implementation of overloaded functions. |
| 33 | + |
| 34 | +<img src="jump-to-implementations.gif" alt="A simple 'Demo' typeclass illustrating that the 'Go to Implementations request sends the cursor to the instance declaration 'Demo Char'." width=70%> |
| 35 | + |
| 36 | +### Inlay Hints |
| 37 | + |
| 38 | +Inlay hints allow you to display additional information within a line of code. |
| 39 | +This can be an elegant alternative to code lenses, which can be a bit more invasive in the editor. |
| 40 | +For GSoC 2024, `jetjiinser` added inlay hints for various Haskell constructs where additional information can be provided. |
| 41 | + |
| 42 | +#### Record Wildcards |
| 43 | + |
| 44 | +When [`RecordWildCards`](https://downloads.haskell.org/ghc/latest/docs/users_guide/exts/record_wildcards.html#extension-RecordWildCards) are enabled, it can be tricky to tell which functions are brought into scope. |
| 45 | + |
| 46 | +Inlay hints are convenient to show exactly which variables have been added to the scope. |
| 47 | + |
| 48 | +<img src="inlay-wildcards.png" alt="Showing the name of record field selectors in record wildcard patterns. One example shows for deconstruction, while the other example shows constructing a record using a wildcard pattern." width=70%> |
| 49 | + |
| 50 | +#### Record construction |
| 51 | + |
| 52 | +One more example showing the convenience of inlay hints. |
| 53 | + |
| 54 | +<img src="inlay-record.png" alt="Constructing a value of type 'MyRec' shows the names of its field." width=70%> |
| 55 | + |
| 56 | +#### Imports |
| 57 | + |
| 58 | +Inlay hints are also an alternative to code lenses in many situations, for example for showing which identifiers are actually used from an `import`: |
| 59 | + |
| 60 | +<img src="inlay-imports.png" alt="Many Haskell import statements, showing the imported identifiers as inlay hints." width=70%> |
| 61 | + |
| 62 | +### `hls-cabal-plugin` features |
| 63 | + |
| 64 | +The `hls-cabal-plugin` provides language features for `.cabal` files. |
| 65 | + |
| 66 | +During GSoC 2024, `VenInf` added many new features to HLS' support for `.cabal` files. |
| 67 | + |
| 68 | +Moreover, during hackathons such as MuniHac and ZuriHac, a lot of other developers also took the time and effort to fix bugs and contribute new features to the `hls-cabal-plugin`. |
| 69 | + |
| 70 | +#### `.cabal` file outline |
| 71 | + |
| 72 | +The outline on the left shows an overview of the contents of a `.cabal` file. |
| 73 | +A small quality-of-life improvement. |
| 74 | + |
| 75 | +<img src="cabal-outline.png" alt="VSCode Editor showing an Outline of the `haskell-language-server.cabal`." width=70%> |
| 76 | + |
| 77 | +#### Support for `cabal-add` |
| 78 | + |
| 79 | +HLS now offers a convenient code action which allows you to add a new dependency to your `.cabal` file, without having to open it yourself. |
| 80 | + |
| 81 | +<img src="cabal-add-1.png" alt="Import of `Data.List.Split` shows an unknown package error. VSCode offers a CodeAction offering to extend the dependency section in the `.cabal` file." width=70%> |
| 82 | + |
| 83 | +After executing the code action, we see that the `.cabal` file has been modified: |
| 84 | + |
| 85 | +<img src="cabal-add-2.png" alt="View of the `.cabal` file where showing a new dependency has been added." width=70%> |
| 86 | + |
| 87 | +#### Hover for Dependencies |
| 88 | + |
| 89 | +A tiny, new feature: hover for dependencies in `.cabal` files. |
| 90 | +It shows a link to the `Hackage` documentation of a package. |
| 91 | + |
| 92 | +<img src="cabal-hover.png" alt="Hover over `split` package shows the name and a link to the Hackage documentation of the `split` package." width=70%> |
| 93 | + |
| 94 | +This is mostly a proof of concept, we expand on this idea in [PR #4428](https://github.com/haskell/haskell-language-server/pull/4428). |
| 95 | + |
| 96 | +### GHC Structured Errors |
| 97 | + |
| 98 | +This release is also the first release which uses GHC's structured errors infrastructure. |
| 99 | +You might not notice this at first as an end-user, as it is a rather technical detail mainly concerned with refactoring internals of HLS to provide many of its features based on structured diagnostics, improving accuracy and maintainability of HLS. |
| 100 | + |
| 101 | +But it also has the useful side effect of allowing us to integrate with [the Haskell Error Index](https://errors.haskell.org/): |
| 102 | + |
| 103 | +<img src="error-index.jpeg" alt="A GHC error message, displaying the error code associated with this particular error message." width=70%> |
| 104 | + |
| 105 | +For anyone wondering how HLS is providing code actions and other LSP features without structured diagnostics... the answer is [lots of GHC version dependent regexes](https://github.com/haskell/haskell-language-server/blob/master/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs#L975). |
| 106 | + |
| 107 | +We want to replace most of these regexes with structured errors. |
| 108 | +Do you want to help? Pick an HLS plugin and hack away! |
| 109 | +The [PR #4472](https://github.com/haskell/haskell-language-server/pull/4472) is only the beginning of our efforts! |
| 110 | + |
| 111 | +### Fixed |
| 112 | + |
| 113 | +HLS has lots of bugs. In each release we fix a couple and we introduce a couple of new ones. |
| 114 | +We can't list all bug fixes, so let's just list a few important ones: |
| 115 | + |
| 116 | +* [Bugfix: Explicit record fields inlay hints for polymorphic records](https://github.com/haskell/haskell-language-server/pull/4510) |
| 117 | +* [Implement fallback handler for `*/resolve` requests](https://github.com/haskell/haskell-language-server/pull/4478) |
| 118 | + |
| 119 | +## Thank you, Haskell Community |
| 120 | + |
| 121 | +We wish all Haskellers happy hacking while using the latest release of the Haskell Language Server `2.10.0.0`! |
| 122 | + |
| 123 | +We want to thank our countless contributors from the community and our Google Summer of Code participants! |
| 124 | +This is a community project, and the HLS team is grateful for every contribution, be it documentation, bug fixes or new features. |
| 125 | + |
| 126 | +Finally, a reminder that you can donate to the development of HLS via [OpenCollective](https://opencollective.com/haskell-language-server). |
| 127 | +The OpenCollective money pays for tedious, but important maintenance work and, sometimes, development of new features. |
0 commit comments