Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/github_actions/actions/checkout-4
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelpj authored Nov 7, 2023
2 parents 184a11c + 0f9be3e commit 188b5cd
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/[email protected].0
uses: fkirc/[email protected].1
with:
cancel_others: false
paths_ignore: '[ "**/docs/**"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/caching.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- id: ghcs
run: echo "ghcs=$(cat ./.github/workflows/supported-ghc-versions.json)" >> $GITHUB_OUTPUT
- id: skip_check
uses: fkirc/[email protected].0
uses: fkirc/[email protected].1
with:
cancel_others: false
paths_ignore: '["**/docs/**"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/flags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- id: ghcs
run: echo "ghcs=$(cat ./.github/workflows/supported-ghc-versions.json)" >> $GITHUB_OUTPUT
- id: skip_check
uses: fkirc/[email protected].0
uses: fkirc/[email protected].1
with:
cancel_others: false
paths_ignore: '[ "**/docs/**"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
should_skip_build: ${{ steps.skip_check_no_nix.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/[email protected].0
uses: fkirc/[email protected].1
with:
cancel_others: false
paths_ignore: '[ "**/docs/**"
Expand All @@ -36,7 +36,7 @@ jobs:
, ".gitlab/**"
]'
- id: skip_check_no_nix
uses: fkirc/[email protected].0
uses: fkirc/[email protected].1
with:
cancel_others: false
paths: '[ "**.nix" ]'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- id: ghcs
run: echo "ghcs=$(cat ./.github/workflows/supported-ghc-versions.json)" >> $GITHUB_OUTPUT
- id: skip_check
uses: fkirc/[email protected].0
uses: fkirc/[email protected].1
with:
cancel_others: false
paths_ignore: '[ "**/docs/**"
Expand All @@ -45,7 +45,7 @@ jobs:
]'
# If we only change ghcide downstream packages we have not test ghcide itself
- id: skip_ghcide_check
uses: fkirc/[email protected].0
uses: fkirc/[email protected].1
with:
cancel_others: false
paths_ignore: '[ "hls-test-utils/**"
Expand Down
53 changes: 14 additions & 39 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -34,47 +34,26 @@ packages:
./plugins/hls-refactor-plugin
./plugins/hls-overloaded-record-dot-plugin

-- Standard location for temporary packages needed for particular environments
-- For example it is used in the project gitlab mirror to help in the MAcOS M1 build script
-- See https://github.com/haskell/haskell-language-server/blob/master/.gitlab-ci.yml
optional-packages: vendored/*/*.cabal
index-state: 2023-10-06T06:12:29Z

tests: True
test-show-details: direct

-- mfsolve has duplicate instances in its test suite
-- See: https://github.com/kuribas/mfsolve/issues/8
package mfsolve
tests: False

package *
ghc-options: -haddock
test-show-details: direct
benchmarks: True

write-ghc-environment-files: never

index-state: 2023-10-06T06:12:29Z
-- Make sure dependencies are build with haddock so we get
-- haddock shown on hover
package *
ghc-options: -haddock

constraints:
-- C++ is hard to distribute, especially on older GHCs
-- See https://github.com/haskell/haskell-language-server/issues/3822
text -simdutf,
-- For GHC 9.4, older versions of entropy fail to build on Windows
entropy >= 0.4.1.10,
-- For GHC 9.4
basement >= 0.0.15,
-- For GHC 9.4
hw-prim >= 0.6.3.2,
hyphenation +embed,
-- remove this when hlint sets ghc-lib to true by default
-- https://github.com/ndmitchell/hlint/issues/1376
hlint +ghc-lib,
ghc-check -ghc-check-use-package-abis,
ghc-lib-parser-ex -auto,
stylish-haskell +ghc-lib,
fourmolu -fixity-th,
setup.happy == 1.20.1.1,
happy == 1.20.1.1,
filepath installed,
-- Centos 7 comes with an old gcc version that doesn't know about
-- the flag '-fopen-simd', which blocked the release 2.2.0.0.
-- We want to be able to benefit from the performance optimisations
Expand All @@ -94,20 +73,17 @@ source-repository-package
tag: 7a0af7a8fd38045fd15fb13445bdcc7085325460
-- END DELETE

allow-newer:
-- ghc-9.4
ekg-json:base,
ekg-wai:time,

if impl(ghc >= 9.5)
if impl(ghc >= 9.1)
-- ekg packagess are old and unmaintained, but we
-- don't rely on them for the mainline build, so
-- this is okay
allow-newer:
-- ghc-9.6
ekg-core:ghc-prim,
stm-hamt:transformers,
ekg-json:base,
ekg-wai:time,
ekg-core:ghc-prim

if impl(ghc >= 9.7)
allow-newer:
-- ghc-9.8
base,
template-haskell,
ghc,
Expand All @@ -122,7 +98,6 @@ if impl(ghc >= 9.7)
unix,
deepseq,

if impl(ghc >= 9.7)
repository head.hackage.ghc.haskell.org
url: https://ghc.gitlab.haskell.org/head.hackage/
secure: True
Expand Down
2 changes: 1 addition & 1 deletion ghcide/session-loader/Development/IDE/Session.hs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ loadWithImplicitCradle mHieYaml rootDir = do

getInitialGhcLibDirDefault :: Recorder (WithPriority Log) -> FilePath -> IO (Maybe LibDir)
getInitialGhcLibDirDefault recorder rootDir = do
hieYaml <- findCradle def rootDir
hieYaml <- findCradle def (rootDir </> "a")
cradle <- loadCradle def hieYaml rootDir
libDirRes <- getRuntimeGhcLibDir (toCologActionWithPrio (cmapWithPrio LogHieBios recorder)) cradle
case libDirRes of
Expand Down
3 changes: 3 additions & 0 deletions haskell-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,9 @@ test-suite wrapper-test
main-is: Main.hs

benchmark benchmark
-- Depends on shake-bench which is unbuildable after this point
if impl(ghc >= 9.5)
buildable: False
type: exitcode-stdio-1.0
default-language: Haskell2010
ghc-options: -Wall -Wno-name-shadowing -threaded
Expand Down
1 change: 1 addition & 0 deletions hls-test-utils/src/Test/Hls.hs
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ runSessionWithServer' plugins conf sconf caps root s = withLock lock $ keepCurr
, argsDefaultHlsConfig = conf
, argsLogger = argsLogger
, argsIdeOptions = ideOptions
, argsProjectRoot = Just root
}

x <- runSessionWithHandles inW outR sconf' caps root s
Expand Down
28 changes: 14 additions & 14 deletions plugins/hls-fourmolu-plugin/src/Ide/Plugin/Fourmolu.hs
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DisambiguateRecordFields #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}

module Ide.Plugin.Fourmolu (
descriptor,
provider,
LogEvent,
) where

import Control.Exception (IOException, handle, try)
import Control.Exception
import Control.Lens ((^.))
import Control.Monad (guard)
import Control.Monad.Error.Class (MonadError (throwError))
import Control.Monad.Trans.Except (ExceptT (..), mapExceptT,
runExceptT)

import Control.Monad.IO.Class (MonadIO (liftIO))
import Control.Monad.Trans.Class (MonadTrans (lift))
import Control.Monad.Trans.Except (ExceptT (..), runExceptT)
import Data.Bifunctor (bimap)
import Data.List (intercalate)
import Data.Maybe (catMaybes)
Expand Down Expand Up @@ -96,6 +93,9 @@ provider recorder plId ideState typ contents fp fo = ExceptT $ withIndefinitePro
errorMessage = "Failed to load " <> T.pack f <> ": " <> T.pack (show err)

let config =
#if MIN_VERSION_fourmolu(0,13,0)
refineConfig ModuleSource Nothing Nothing Nothing
#endif
defaultConfig
{ cfgDynOptions = map DynOption fileOpts
, cfgFixityOverrides = cfgFileFixities
Expand Down
5 changes: 4 additions & 1 deletion plugins/hls-fourmolu-plugin/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module Main
) where

import Data.Aeson
import qualified Data.Aeson.KeyMap as KM
import Data.Functor
import Ide.Plugin.Config
import qualified Ide.Plugin.Fourmolu as Fourmolu
Expand All @@ -28,12 +29,14 @@ tests =
formatDoc doc (FormattingOptions 4 True Nothing Nothing Nothing)
, goldenWithFourmolu cli "formats imports correctly" "Fourmolu2" "formatted" $ \doc -> do
formatDoc doc (FormattingOptions 4 True Nothing Nothing Nothing)
, goldenWithFourmolu cli "uses correct operator fixities" "Fourmolu3" "formatted" $ \doc -> do
formatDoc doc (FormattingOptions 4 True Nothing Nothing Nothing)
]

goldenWithFourmolu :: Bool -> TestName -> FilePath -> FilePath -> (TextDocumentIdentifier -> Session ()) -> TestTree
goldenWithFourmolu cli title path desc = goldenWithHaskellDocFormatter def fourmoluPlugin "fourmolu" conf title testDataDir path desc "hs"
where
conf = def{plcConfig = (\(Object obj) -> obj) $ object ["external" .= cli]}
conf = def{plcConfig = KM.fromList ["external" .= cli]}

testDataDir :: FilePath
testDataDir = "test" </> "testdata"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
b :: Bool
b =
id $
id $
case True && True of
True -> True
False -> False
6 changes: 6 additions & 0 deletions plugins/hls-fourmolu-plugin/test/testdata/Fourmolu3.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
b :: Bool
b =
id $ id $
case True && True of
True -> True
False -> False
2 changes: 1 addition & 1 deletion plugins/hls-hlint-plugin/hls-hlint-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ library
, ghc-exactprint >=0.6.3.4
, ghcide == 2.4.0.0
, hashable
, hlint < 3.7
, hlint >= 3.5 && < 3.7
, hls-plugin-api == 2.4.0.0
, lens
, lsp
Expand Down
1 change: 1 addition & 0 deletions shake-bench/shake-bench.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ source-repository head
location: https://github.com/haskell/haskell-language-server.git

library
-- Depends on Chart which is unbuildable after this point
if impl(ghc >= 9.5)
buildable: False
exposed-modules: Development.Benchmark.Rules
Expand Down
2 changes: 1 addition & 1 deletion src/Ide/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ defaultMain recorder args idePlugins = do

BiosMode PrintCradleType -> do
dir <- IO.getCurrentDirectory
hieYaml <- Session.findCradle def dir
hieYaml <- Session.findCradle def (dir </> "a")
cradle <- Session.loadCradle def hieYaml dir
print cradle

Expand Down
5 changes: 0 additions & 5 deletions stack-lts21.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ flags:
pedantic: true
retrie:
BuildExecutable: false
# Stack doesn't support automatic flags.
hyphenation:
embed: true
stylish-haskell:
ghc-lib: true

nix:
packages: [ icu libcxx zlib ]
Expand Down
3 changes: 0 additions & 3 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ flags:
pedantic: true
retrie:
BuildExecutable: false
# Stack doesn't support automatic flags.
hyphenation:
embed: true

nix:
packages: [ icu libcxx zlib ]
Expand Down

0 comments on commit 188b5cd

Please sign in to comment.