diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b9b4678380..c70c252a34 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -169,11 +169,11 @@ jobs: name: Test hls-stylish-haskell-plugin run: cabal test hls-stylish-haskell-plugin-tests || cabal test hls-stylish-haskell-plugin-tests - - if: matrix.test && matrix.ghc != '9.12' + - if: matrix.test name: Test hls-ormolu-plugin run: cabal test hls-ormolu-plugin-tests || cabal test hls-ormolu-plugin-tests - - if: matrix.test && matrix.ghc != '9.12' + - if: matrix.test name: Test hls-fourmolu-plugin run: cabal test hls-fourmolu-plugin-tests || cabal test hls-fourmolu-plugin-tests diff --git a/cabal.project b/cabal.project index ea516ce3e8..1495f401e0 100644 --- a/cabal.project +++ b/cabal.project @@ -44,15 +44,13 @@ constraints: bitvec -simd, -if impl(ghc >= 9.8.4) && impl(ghc < 9.8.5) - -- By depending on ghc-lib-parser and ghc, we are encountering - -- a constraint conflict, ghc-9.8.4 comes with `filepath-1.4.301.0`, - -- and `ghc-lib-parser-9.8.4.20241130` specifies `filepath >=1.5 && < 1.6. - -- See https://github.com/digital-asset/ghc-lib/issues/572 for details. - allow-older: - ghc-lib-parser:filepath - constraints: - ghc-lib-parser==9.8.4.20241130 +-- Some of the formatters need the latest Cabal-syntax version, +-- but 'cabal-install-parsers-0.6.2' only has Cabal-syntax (>=3.12.0.0 && <3.13). +-- So, we relax the upper bounds here. +-- fourmolu-0.18.0 and ormolu-0.8 depend on Cabal-syntax == 3.14.*, while +-- cabal-add depends on cabal-install-parsers. +allow-newer: + cabal-install-parsers:Cabal-syntax, if impl(ghc >= 9.11) benchmarks: False diff --git a/docs/support/plugin-support.md b/docs/support/plugin-support.md index 4fc9538ee3..95aedb6745 100644 --- a/docs/support/plugin-support.md +++ b/docs/support/plugin-support.md @@ -53,13 +53,13 @@ For example, a plugin to provide a formatter which has itself been abandoned has | `hls-eval-plugin` | 2 | | | `hls-explicit-fixity-plugin` | 2 | | | `hls-explicit-record-fields-plugin` | 2 | | -| `hls-fourmolu-plugin` | 2 | 9.12.2 | +| `hls-fourmolu-plugin` | 2 | | | `hls-gadt-plugin` | 2 | 9.12.2 | | `hls-hlint-plugin` | 2 | 9.10.1, 9.12.2 | | `hls-module-name-plugin` | 2 | | | `hls-notes-plugin` | 2 | | | `hls-qualify-imported-names-plugin` | 2 | | -| `hls-ormolu-plugin` | 2 | 9.12.2 | +| `hls-ormolu-plugin` | 2 | | | `hls-rename-plugin` | 2 | | | `hls-stylish-haskell-plugin` | 2 | 9.10.1, 9.12.2 | | `hls-overloaded-record-dot-plugin` | 2 | | diff --git a/haskell-language-server.cabal b/haskell-language-server.cabal index b9b594a0fa..7a072da0cf 100644 --- a/haskell-language-server.cabal +++ b/haskell-language-server.cabal @@ -1442,19 +1442,19 @@ flag fourmolu manual: True common fourmolu - if flag(fourmolu) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds)) + if flag(fourmolu) build-depends: haskell-language-server:hls-fourmolu-plugin cpp-options: -Dhls_fourmolu library hls-fourmolu-plugin import: defaults, pedantic, warnings - if !flag(fourmolu) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds)) + if !flag(fourmolu) buildable: False exposed-modules: Ide.Plugin.Fourmolu hs-source-dirs: plugins/hls-fourmolu-plugin/src build-depends: , filepath - , fourmolu ^>= 0.14 || ^>= 0.15 || ^>= 0.16 + , fourmolu ^>= 0.14 || ^>= 0.15 || ^>= 0.16 || ^>=0.17 || ^>=0.18 , ghc-boot-th , ghcide == 2.10.0.0 , hls-plugin-api == 2.10.0.0 @@ -1468,7 +1468,7 @@ library hls-fourmolu-plugin test-suite hls-fourmolu-plugin-tests import: defaults, pedantic, test-defaults, warnings - if !flag(fourmolu) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds)) + if !flag(fourmolu) buildable: False type: exitcode-stdio-1.0 hs-source-dirs: plugins/hls-fourmolu-plugin/test @@ -1496,13 +1496,13 @@ flag ormolu manual: True common ormolu - if flag(ormolu) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds)) + if flag(ormolu) build-depends: haskell-language-server:hls-ormolu-plugin cpp-options: -Dhls_ormolu library hls-ormolu-plugin import: defaults, pedantic, warnings - if !flag(ormolu) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds)) + if !flag(ormolu) buildable: False exposed-modules: Ide.Plugin.Ormolu hs-source-dirs: plugins/hls-ormolu-plugin/src @@ -1515,14 +1515,14 @@ library hls-ormolu-plugin , lsp , mtl , process-extras >= 0.7.1 - , ormolu ^>=0.1.2 || ^>= 0.2 || ^>= 0.3 || ^>= 0.5 || ^>= 0.6 || ^>= 0.7 + , ormolu ^>=0.5.3 || ^>= 0.6 || ^>= 0.7 || ^>=0.8 , text , transformers test-suite hls-ormolu-plugin-tests import: defaults, pedantic, test-defaults, warnings - if !flag(ormolu) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds)) + if !flag(ormolu) buildable: False type: exitcode-stdio-1.0 hs-source-dirs: plugins/hls-ormolu-plugin/test @@ -2009,9 +2009,9 @@ test-suite func-test -- formatters if flag(floskell) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds)) cpp-options: -Dhls_floskell - if flag(fourmolu) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds)) + if flag(fourmolu) cpp-options: -Dhls_fourmolu - if flag(ormolu) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds)) + if flag(ormolu) cpp-options: -Dhls_ormolu test-suite wrapper-test diff --git a/test/testdata/schema/ghc912/default-config.golden.json b/test/testdata/schema/ghc912/default-config.golden.json index dbedec9067..3e466b6da8 100644 --- a/test/testdata/schema/ghc912/default-config.golden.json +++ b/test/testdata/schema/ghc912/default-config.golden.json @@ -52,6 +52,12 @@ "explicit-fixity": { "globalOn": true }, + "fourmolu": { + "config": { + "external": false, + "path": "fourmolu" + } + }, "ghcide-code-actions-bindings": { "globalOn": true }, @@ -89,6 +95,11 @@ "moduleName": { "globalOn": true }, + "ormolu": { + "config": { + "external": false + } + }, "overloaded-record-dot": { "globalOn": true }, diff --git a/test/testdata/schema/ghc912/vscode-extension-schema.golden.json b/test/testdata/schema/ghc912/vscode-extension-schema.golden.json index 937cf4dbf1..80412d39e2 100644 --- a/test/testdata/schema/ghc912/vscode-extension-schema.golden.json +++ b/test/testdata/schema/ghc912/vscode-extension-schema.golden.json @@ -113,6 +113,18 @@ "scope": "resource", "type": "boolean" }, + "haskell.plugin.fourmolu.config.external": { + "default": false, + "markdownDescription": "Call out to an external \"fourmolu\" executable, rather than using the bundled library.", + "scope": "resource", + "type": "boolean" + }, + "haskell.plugin.fourmolu.config.path": { + "default": "fourmolu", + "markdownDescription": "Set path to executable (for \"external\" mode).", + "scope": "resource", + "type": "string" + }, "haskell.plugin.ghcide-code-actions-bindings.globalOn": { "default": true, "description": "Enables ghcide-code-actions-bindings plugin", @@ -213,6 +225,12 @@ "scope": "resource", "type": "boolean" }, + "haskell.plugin.ormolu.config.external": { + "default": false, + "markdownDescription": "Call out to an external \"ormolu\" executable, rather than using the bundled library", + "scope": "resource", + "type": "boolean" + }, "haskell.plugin.overloaded-record-dot.globalOn": { "default": true, "description": "Enables overloaded-record-dot plugin",