Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ghc 9.4 for hls-class-plugin #3258

Merged
merged 5 commits into from
Oct 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ jobs:
name: Test hls-floskell-plugin
run: cabal test hls-floskell-plugin --test-options="$TEST_OPTS" || cabal test hls-floskell-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-floskell-plugin --test-options="$TEST_OPTS"

- if: matrix.test && matrix.ghc != '9.4.2'
- if: matrix.test
name: Test hls-class-plugin
run: cabal test hls-class-plugin --test-options="$TEST_OPTS" || cabal test hls-class-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-class-plugin --test-options="$TEST_OPTS"

Expand Down
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ package *

write-ghc-environment-files: never

index-state: 2022-09-14T16:53:13Z
index-state: 2022-10-07T12:19:15Z

constraints:
-- For GHC 9.4, older versions of entropy fail to build on Windows
Expand Down
2 changes: 1 addition & 1 deletion configuration-ghc-94.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let
ptr-poker = hself.callCabal2nix "ptr-poker" inputs.ptr-poker { };

ghc-exactprint =
hself.callCabal2nix "ghc-exactprint" inputs.ghc-exactprint-150 { };
hself.callCabal2nix "ghc-exactprint" inputs.ghc-exactprint-160 { };
# Hlint is still broken
hlint = doJailbreak (hself.callCabal2nix "hlint" inputs.hlint { });

Expand Down
2 changes: 1 addition & 1 deletion docs/support/plugin-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ For example, a plugin to provide a formatter which has itself been abandoned has
| `hls-pragmas-plugin` | 1 | |
| `hls-refactor-plugin` | 1 | 9.4 |
| `hls-alternate-number-plugin` | 2 | |
| `hls-class-plugin` | 2 | 9.4 |
| `hls-class-plugin` | 2 | |
| `hls-change-type-signature-plugin` | 2 | |
| `hls-eval-plugin` | 2 | 9.4 |
| `hls-explicit-fixity-plugin` | 2 | |
Expand Down
4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
url = "https://hackage.haskell.org/package/lsp-test-0.14.1.0/lsp-test-0.14.1.0.tar.gz";
flake = false;
};
ghc-exactprint-160 = {
url = "https://hackage.haskell.org/package/ghc-exactprint-1.6.0/ghc-exactprint-1.6.0.tar.gz";
flake = false;
};
ghc-exactprint-150 = {
url = "https://hackage.haskell.org/package/ghc-exactprint-1.5.0/ghc-exactprint-1.5.0.tar.gz";
flake = false;
Expand Down
4 changes: 2 additions & 2 deletions haskell-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ flag dynamic
manual: True

common class
if flag(class) && (impl(ghc < 9.4.1) || flag(ignore-plugins-ghc-bounds))
if flag(class)
build-depends: hls-class-plugin ^>= 1.1
cpp-options: -Dhls_class

Expand Down Expand Up @@ -271,7 +271,7 @@ common splice
cpp-options: -Dhls_splice

common alternateNumberFormat
if flag(alternateNumberFormat)
if flag(alternateNumberFormat)
build-depends: hls-alternate-number-format-plugin ^>= 1.2
cpp-options: -Dhls_alternateNumberFormat

Expand Down
12 changes: 2 additions & 10 deletions plugins/hls-class-plugin/hls-class-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ source-repository head
location: https://github.com/haskell/haskell-language-server.git

library
if impl(ghc >= 9.3)
buildable: False
else
buildable: True
exposed-modules: Ide.Plugin.Class
other-modules: Ide.Plugin.Class.CodeAction
, Ide.Plugin.Class.CodeLens
Expand All @@ -53,9 +49,9 @@ library
, transformers

if impl(ghc >=9.2.1)
build-depends: ghc-exactprint ^>= 1.5
build-depends: ghc-exactprint >= 1.5
else
build-depends: ghc-exactprint >= 0.6.4 && <1.1
build-depends: ghc-exactprint >= 0.6.4 && <1.1

default-language: Haskell2010
default-extensions:
Expand All @@ -66,10 +62,6 @@ library
ghc-options: -Wall -Wno-unticked-promoted-constructors -Wno-name-shadowing

test-suite tests
if impl(ghc >= 9.3)
buildable: False
else
buildable: True
type: exitcode-stdio-1.0
default-language: Haskell2010
hs-source-dirs: test
Expand Down
4 changes: 2 additions & 2 deletions plugins/hls-class-plugin/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ codeActionTests recorder = testGroup
executeCodeAction gAction
, goldenWithClass recorder "Creates a placeholder for other two methods" "T6" "2" $ \(_:_:ghAction:_) -> do
executeCodeAction ghAction
, onlyRunForGhcVersions [GHC92] "Only ghc-9.2 enabled GHC2021 implicitly" $
, onlyRunForGhcVersions [GHC92, GHC94] "Only ghc-9.2+ enabled GHC2021 implicitly" $
goldenWithClass recorder "Don't insert pragma with GHC2021" "InsertWithGHC2021Enabled" "" $ \(_:eqWithSig:_) -> do
executeCodeAction eqWithSig
, goldenWithClass recorder "Insert pragma if not exist" "InsertWithoutPragma" "" $ \(_:eqWithSig:_) -> do
Expand All @@ -96,7 +96,7 @@ codeLensTests recorder = testGroup
, goldenCodeLens recorder "Apply code lens for local class" "LocalClassDefine" 0
, goldenCodeLens recorder "Apply code lens on the same line" "Inline" 0
, goldenCodeLens recorder "Don't insert pragma while existing" "CodeLensWithPragma" 0
, onlyRunForGhcVersions [GHC92] "Only ghc-9.2 enabled GHC2021 implicitly" $
, onlyRunForGhcVersions [GHC92, GHC94] "Only ghc-9.2+ enabled GHC2021 implicitly" $
goldenCodeLens recorder "Don't insert pragma while GHC2021 enabled" "CodeLensWithGHC2021" 0
, goldenCodeLens recorder "Qualified name" "Qualified" 0
, goldenCodeLens recorder "Type family" "TypeFamily" 0
Expand Down