Skip to content

Commit 06c349e

Browse files
Jana Chadtfendor
Jana Chadt
authored andcommitted
Add plugin for formatting cabal files using cabal-fmt
1 parent 9b491f7 commit 06c349e

27 files changed

+953
-22
lines changed

.github/workflows/test.yml

+5
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,11 @@ jobs:
257257
name: Test hls-explicit-fixity-plugin test suite
258258
run: cabal test hls-explicit-fixity-plugin --test-options="$TEST_OPTS" || cabal test hls-explicit-fixity-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-explicit-fixity-plugin --test-options="$TEST_OPTS"
259259

260+
## version needs to be limited since the tests depend on cabal-fmt which only builds using specific ghc versions
261+
- if: matrix.test && matrix.ghc == '8.10.7'
262+
name: Test hls-cabal-fmt-plugin test suite
263+
run: cabal test hls-cabal-fmt-plugin --test-options="$TEST_OPTS" || cabal test hls-cabal-fmt-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-cabal-fmt-plugin --test-options="$TEST_OPTS"
264+
260265
test_post_job:
261266
if: always()
262267
runs-on: ubuntu-latest

CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# Plugins
1010
/plugins/hls-alternate-number-format-plugin @drsooch
1111
/plugins/hls-brittany-plugin @fendor
12+
/plugins/hls-cabal-fmt-plugin @VeryMilkyJoe @fendor
1213
/plugins/hls-call-hierarchy-plugin @July541
1314
/plugins/hls-class-plugin @Ailrun
1415
/plugins/hls-eval-plugin

cabal.project

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ packages:
88
./ghcide/test
99
./hls-plugin-api
1010
./hls-test-utils
11+
./plugins/hls-cabal-fmt-plugin
1112
./plugins/hls-tactics-plugin
1213
./plugins/hls-brittany-plugin
1314
./plugins/hls-stylish-haskell-plugin
@@ -48,7 +49,7 @@ package *
4849

4950
write-ghc-environment-files: never
5051

51-
index-state: 2022-09-14T16:53:13Z
52+
index-state: 2022-09-22T16:53:13Z
5253

5354
constraints:
5455
-- For GHC 9.4, older versions of entropy fail to build on Windows

docs/features.md

+7
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ Format your code with various Haskell code formatters.
107107
| Ormolu | `hls-ormolu-plugin` |
108108
| Stylish Haskell | `hls-stylish-haskell-plugin` |
109109

110+
Format your cabal files with a cabal code formatter.
111+
112+
| Formatter | Provided by |
113+
|-----------------|------------------------------|
114+
| cabal-fmt | `hls-cabal-fmt-plugin` |
115+
116+
110117
## Document symbols
111118

112119
Provided by: `ghcide`

docs/supported-versions.md

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Supported GHC versions
2+
3+
## Current GHC version support status
4+
5+
The current support for different GHC versions is given in the following table.
6+
7+
Last supporting HLS version:
8+
- "next": this GHC version is supported in master, and will be in the next released version of HLS.
9+
- "latest": this GHC version is one of the actively supported versions (see below) and is supported in the latest released version of HLS.
10+
- specific version number: this GHC version is no longer one of the actively supported versions, and the last version of HLS which supports it is listed.
11+
12+
Support status (see the support policy below for more details):
13+
- "supported": this version of GHC is currently actively supported
14+
- "deprecated": this version of GHC was supported in the past, but is now deprecated
15+
- "will be deprecated ...": this version of GHC has special deprecation conditions that deviate from the support policy
16+
- "partial": not all features and plugins work, see the plugin support table and any linked issues for more details
17+
18+
| GHC version | Last supporting HLS version | Support status |
19+
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
20+
| 9.2.3 | next | supported, ([partial](https://github.com/haskell/haskell-language-server/issues/2982)) |
21+
| 9.2.2 | [latest](https://github.com/haskell/haskell-language-server/releases/latest) | supported, ([partial](https://github.com/haskell/haskell-language-server/issues/2982)) |
22+
| 9.2.1 | [1.7.0.0](https://github.com/haskell/haskell-language-server/releases/tag/1.7.0.0) | deprecated |
23+
| 9.0.2 | [latest](https://github.com/haskell/haskell-language-server/releases/latest) | supported |
24+
| 9.0.1 | [1.6.1.0](https://github.com/haskell/haskell-language-server/releases/tag/1.6.1.0) | deprecated |
25+
| 8.10.7 | [latest](https://github.com/haskell/haskell-language-server/releases/latest) | supported |
26+
| 8.10.6 | [1.6.1.0](https://github.com/haskell/haskell-language-server/releases/tag/1.6.1.0) | deprecated |
27+
| 8.10.5 | [1.5.1](https://github.com/haskell/haskell-language-server/releases/tag/1.5.1) | deprecated |
28+
| 8.10.4 | [1.4.0](https://github.com/haskell/haskell-language-server/releases/tag/1.4.0) | deprecated |
29+
| 8.10.3 | [1.4.0](https://github.com/haskell/haskell-language-server/releases/tag/1.4.0) | deprecated |
30+
| 8.10.2 | [1.4.0](https://github.com/haskell/haskell-language-server/releases/tag/1.4.0) | deprecated |
31+
| 8.10.1 | [0.9.0](https://github.com/haskell/haskell-language-server/releases/tag/0.9.0) | deprecated |
32+
| 8.8.4 | [latest](https://github.com/haskell/haskell-language-server/releases/latest) | will be deprecated after LTS and HLS full support for ghc-9.2 |
33+
| 8.8.3 | [1.5.1](https://github.com/haskell/haskell-language-server/releases/1.5.1) | deprecated |
34+
| 8.8.2 | [1.2.0](https://github.com/haskell/haskell-language-server/releases/tag/1.2.0) | deprecated |
35+
| 8.6.5 | [latest](https://github.com/haskell/haskell-language-server/releases/latest) | will be deprecated after LTS and HLS full suppot for ghc-9.2 |
36+
| 8.6.4 | [1.4.0](https://github.com/haskell/haskell-language-server/releases/tag/1.4.0) | deprecated |
37+
38+
39+
GHC versions not in the list have never been supported by HLS. LTS stands for [Stackage](https://www.stackage.org/) Long Term Support.
40+
41+
The policy for when we deprecate support for versions of GHC is given below. The table reflects that, but we may decide to deviate from it for good reasons.
42+
43+
Additionally, some plugins do not have support for some GHC versions, as shown in the following table.
44+
As such, the functionality provided by those plugins is not available in HLS when using a GHC version which they do not support.
45+
Sometimes a plugin will be supported in the pre-built binaries but not in a HLS binary installed from Hackage.
46+
47+
### Plugins support by GHC version
48+
49+
| Plugin | Unsupported GHC versions |
50+
|-------------------------------------|--------------------------|
51+
| `hls-alternate-number-plugin` | |
52+
| `hls-brittany-plugin` | 9.2 |
53+
| `hls-cabal-fmt-plugin` | |
54+
| `hls-call-hierarchy-plugin` | |
55+
| `hls-class-plugin` | |
56+
| `hls-eval-plugin` | |
57+
| `hls-explicit-imports-plugin` | |
58+
| `hls-floskell-plugin` | |
59+
| `hls-fourmolu-plugin` | |
60+
| `hls-haddock-comments-plugin` | 9.2 |
61+
| `hls-hlint-plugin` | |
62+
| `hls-module-name-plugin` | |
63+
| `hls-ormolu-plugin` | |
64+
| `hls-pragmas-plugin` | |
65+
| `hls-qualify-imported-names-plugin` | |
66+
| `hls-refine-imports-plugin` | |
67+
| `hls-rename-plugin` | |
68+
| `hls-retrie-plugin` | 9.2 |
69+
| `hls-splice-plugin` | 9.2 |
70+
| `hls-stylish-haskell-plugin` | |
71+
| `hls-tactics-plugin` | 9.2 |
72+
| `hls-selection-range-plugin` | |
73+
| `hls-gadt-plugin` | |
74+
75+
### Using deprecated GHC versions
76+
77+
Users who want to use a GHC version which is not supported by the latest HLS can still use older versions of HLS (consult the version support table above to identify the appropriate HLS version).
78+
In the future, we may extend the existing discovery mechanisms (`haskell-language-server-wrapper`, automatic download in vscode extension) to find and download older HLS binaries in this case.
79+
80+
Users of a deprecated minor version (where the major version is still supported) can try building the latest HLS from source, which will likely still work, since the GHC API tends to remain compatible across minor versions.
81+
82+
### Using GHC versions not yet supported in a HLS release
83+
84+
Some users may wish to use a version of GHC that is not yet supported by a released version of HLS.
85+
In particular, this means that pre-built binaries will not be available for that GHC version.
86+
87+
The easiest thing to do in this case is to build HLS from source yourself.
88+
This can be done easily with `ghcup`, see the examples for `ghcup compile` on the [installation page](./installation.md).
89+
90+
Generally, if a version of GHC is supported by HLS on master _or_ is a new minor version of a GHC version that is supported by HLS on master, then compiling from source is likely to work.
91+
Major versions of GHC which are not supported by HLS on master are extremely unlikely to work.
92+
93+
## GHC version deprecation policy
94+
95+
### Major versions
96+
97+
A major GHC version is a "legacy" version if it is 3 or more major versions behind the latest GHC version that is
98+
99+
1. Fully supported by HLS
100+
2. Used in the a Stackage LTS
101+
102+
For example, if 9.2 is the latest major version fully supported by HLS and used in a Stackage LTS, then the 8.8 major version and older will be legacy.
103+
104+
HLS will support all non-legacy major versions of GHC.
105+
106+
### Minor versions
107+
108+
For the latest supported major GHC version we will support at least 2 minor versions.
109+
110+
For the rest of the supported major GHC versions, we will support at least the latest minor version in Stackage LTS (so 1 minor version).
111+
112+
### Announcements
113+
114+
We will warn users about the upcoming deprecation of a GHC version in the notes of the release *prior* to the deprecation itself.
115+
116+
### Why deprecate older versions of GHC?
117+
118+
`haskell-language-server`(HLS) is highly tied to the GHC API. This imposes a high maintenance cost:
119+
120+
- The codebase is littered with conditional logic,
121+
- We own auxiliary packages to support older versions of GHC.
122+
- CI has to cover all the supported versions.
123+
124+
So we need to limit the GHC support to save maintainers and contributors time and reduce CI resources.
125+
126+
At same time we aim to support the right balance of GHC versions to minimize impact to final users.
127+
128+
### What factors do we take into account when deprecating a version?
129+
130+
To establish and apply the policy we take into account:
131+
132+
- Completeness: support includes all plugins and features
133+
- The most recent [stackage](https://www.stackage.org/) LTS snapshot
134+
- The GHC versions used in the most popular [linux distributions](https://repology.org/project/ghc/versions)
135+
- The reliability of different ghc versions on the major operating systems (Linux, Windows, MacOS)

0 commit comments

Comments
 (0)