Skip to content

Commit

Permalink
Warn GHC 9 Compatibility to LSP Client (#1992)
Browse files Browse the repository at this point in the history
* Test 9.0.1 for windows and macOS

* Refactorize ghc checking in tests

* Correct imports/exports

* Replace CPP checks with ghcVersion

* Use GHC cpp and remove 8.4

* Use the ghc version runtime checker

* HLINT ann ignored for ghc-9 too

* Mark test as broken for win and ghc-9

* Use GHC90 in eval tests

* Avoid reformatting code

* Remove not supported ghc-8.4

* Disable tests for macos and ghc-9.0.1

* Updates README to warn GHC 9 support situation

* Send warning to LSP client when used on GHC 9

* Stop using CPP and adds ad-hoc version discover logic in Development.IDE.GHC.Util

* Use ghcVersion check

* Convert alert to log message

Co-authored-by: jneira <atreyu.bbb@gmail.com>
  • Loading branch information
konn and jneira authored Jul 7, 2021
1 parent 8edb0f7 commit b8bb06e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ ghcup install hls
If you are using [`chocolatey`](https://chocolatey.org/) to manage your installations in windows, [you can install `haskell-language-server`](https://community.chocolatey.org/packages/haskell-language-server) with
```
choco install haskell-language-server
````
````
### Visual Studio Code
Expand Down Expand Up @@ -703,6 +703,11 @@ args = ["--lsp"]
## Known limitations
### Limited GHC 9 Support
Currently, GHC 9 support in HLS is in beta stage; some features are unavailable with GHC >= 9.0.1 for the time being.
This situation is expected to be resolved in the near future after all the dependent packages support GHC 9.
See issue [#297](https://github.com/haskell/haskell-language-server/issues/297) for the supported features in GHC 9 and the status of migration progress.
### Preprocessor
HLS is not yet able to find project preprocessors, which may result in `could not execute: <preprocessor>` errors. This problem is
tracked in https://github.com/haskell/haskell-language-server/issues/176 and originally comes from https://github.com/mpickering/hie-bios/issues/125
Expand Down
8 changes: 7 additions & 1 deletion ghcide/src/Development/IDE/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import qualified Data.Text as T
import qualified Data.Text.IO as T
import Data.Text.Lazy.Encoding (decodeUtf8)
import qualified Data.Text.Lazy.IO as LT
import Development.IDE (Action, Rules,
import Development.IDE (Action, GhcVersion (..),
Rules, ghcVersion,
hDuplicateTo')
import Development.IDE.Core.Debouncer (Debouncer,
newAsyncDebouncer)
Expand Down Expand Up @@ -256,6 +257,11 @@ defaultMain Arguments{..} = do
, optRunSubset = runSubset
}
caps = LSP.resClientCapabilities env
-- FIXME: Remove this after GHC 9 gets fully supported
when (ghcVersion == GHC90) $
hPutStrLn stderr $
"Currently, HLS supports GHC 9 only partially. "
<> "See [issue #297](https://github.com/haskell/haskell-language-server/issues/297) for more detail."
initialise
argsDefaultHlsConfig
rules
Expand Down

0 comments on commit b8bb06e

Please # to comment.