Skip to content

Commit 311f543

Browse files
authored
Merge branch 'master' into ekg
2 parents 8383805 + 40acece commit 311f543

File tree

17 files changed

+33
-107
lines changed

17 files changed

+33
-107
lines changed

.github/workflows/flags.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ jobs:
6464
- name: Build `hls-graph` with flags
6565
run: cabal v2-build hls-graph --flags="embed-files stm-stats"
6666

67-
- if: matrix.ghc != '8.6.5' && matrix.ghc != '8.8.4'
68-
name: Build `hie-compat` with flags
69-
run: cabal v2-build hie-compat --flags="ghc-lib"
70-
7167
- name: Build `ghcide` with flags
7268
run: cabal v2-build ghcide --flags="ghc-patched-unboxed-bytecode test-exe executable bench-exe"
7369

cabal-ghc90.project

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ write-ghc-environment-files: never
4040
index-state: 2022-04-27T09:22:49Z
4141

4242
constraints:
43-
hls-hlint-plugin +ghc-lib
4443

4544
-- although we are not building all plugins cabal solver phase is run for all packages
4645
-- this way we track explicitly all transitive dependencies which need support for ghc-9

cabal-ghc92.project

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ constraints:
5050
-retrie
5151
-splice
5252
-tactic,
53-
hls-hlint-plugin +ghc-lib,
54-
-- # Use ghc-lib force instead of ghc itself
5553
ghc-lib-parser-ex -auto,
5654
hlint +ghc-lib,
5755
stylish-haskell +ghc-lib

cabal.project

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,19 @@ optional-packages: vendored/*/*.cabal
3737
tests: true
3838

3939
package *
40-
ghc-options: -haddock
40+
-- ghc 8.10 cannot build ghc-lib 9.2 with --haddock
41+
-- ghc-options: -haddock
4142
test-show-details: direct
4243

4344
write-ghc-environment-files: never
4445

45-
index-state: 2022-03-08T10:53:01Z
46+
index-state: 2022-04-27T09:22:49Z
4647

4748
constraints:
48-
hyphenation +embed
49+
hyphenation +embed,
50+
-- remove this when hlint sets ghc-lib to true by default
51+
-- https://github.com/ndmitchell/hlint/issues/1376
52+
hlint +ghc-lib
4953

5054
-- This is benign and won't affect our ability to release to Hackage,
5155
-- because we only depend on `ekg-wai` when a non-default flag

ghcide/src/Development/IDE/Core/Debouncer.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ asyncRegisterEvent d delay k fire = mask_ $ do
5050
sleep delay
5151
fire
5252
atomically $ STM.delete k d
53-
do
54-
prev <- atomicallyNamed "debouncer" $ STM.focus (Focus.lookup <* Focus.insert a) k d
55-
traverse_ cancel prev
53+
prev <- atomicallyNamed "debouncer" $ STM.focus (Focus.lookup <* Focus.insert a) k d
54+
traverse_ cancel prev
5655

5756
-- | Debouncer used in the DAML CLI compiler that emits events immediately.
5857
noopDebouncer :: Debouncer k

ghcide/src/Development/IDE/Core/FileStore.hs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import Control.Exception
2828
import Control.Monad.Extra
2929
import Control.Monad.IO.Class
3030
import qualified Data.ByteString as BS
31-
import Data.Either.Extra
3231
import qualified Data.Rope.UTF16 as Rope
3332
import qualified Data.Text as T
3433
import Data.Time
@@ -192,12 +191,6 @@ getFileContentsImpl file = do
192191
pure $ Rope.toText . _text <$> mbVirtual
193192
pure ([], Just (time, res))
194193

195-
ideTryIOException :: NormalizedFilePath -> IO a -> IO (Either FileDiagnostic a)
196-
ideTryIOException fp act =
197-
mapLeft
198-
(\(e :: IOException) -> ideErrorText fp $ T.pack $ show e)
199-
<$> try act
200-
201194
-- | Returns the modification time and the contents.
202195
-- For VFS paths, the modification time is the current time.
203196
getFileContents :: NormalizedFilePath -> Action (UTCTime, Maybe T.Text)

ghcide/src/Development/IDE/Core/OfInterest.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ addFileOfInterest state f v = do
107107
(prev, files) <- modifyVar var $ \dict -> do
108108
let (prev, new) = HashMap.alterF (, Just v) f dict
109109
pure (new, (prev, new))
110-
when (prev /= Just v) $
110+
when (prev /= Just v) $ do
111111
join $ atomically $ recordDirtyKeys (shakeExtras state) IsFileOfInterest [f]
112-
logDebug (ideLogger state) $
113-
"Set files of interest to: " <> T.pack (show files)
112+
logDebug (ideLogger state) $
113+
"Set files of interest to: " <> T.pack (show files)
114114

115115
deleteFileOfInterest :: IdeState -> NormalizedFilePath -> IO ()
116116
deleteFileOfInterest state f = do

ghcide/src/Development/IDE/Core/Shake.hs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -706,17 +706,6 @@ shakeRestart recorder IdeState{..} vfs reason acts =
706706
queue <- atomicallyNamed "actionQueue - peek" $ peekInProgress $ actionQueue shakeExtras
707707

708708
log Debug $ LogBuildSessionRestart reason queue backlog stopTime res
709-
710-
let profile = case res of
711-
Just fp -> ", profile saved at " <> fp
712-
_ -> ""
713-
-- TODO: should replace with logging using a logger that sends lsp message
714-
let msg = T.pack $ "Restarting build session " ++ reason' ++ queueMsg ++ keysMsg ++ abortMsg
715-
reason' = "due to " ++ reason
716-
queueMsg = " with queue " ++ show (map actionName queue)
717-
keysMsg = " for keys " ++ show (HSet.toList backlog) ++ " "
718-
abortMsg = "(aborting the previous one took " ++ showDuration stopTime ++ profile ++ ")"
719-
notifyTestingLogMessage shakeExtras msg
720709
)
721710
-- It is crucial to be masked here, otherwise we can get killed
722711
-- between spawning the new thread and updating shakeSession.
@@ -729,13 +718,6 @@ shakeRestart recorder IdeState{..} vfs reason acts =
729718
sleep seconds
730719
logWith recorder Error (LogBuildSessionRestartTakingTooLong seconds)
731720

732-
notifyTestingLogMessage :: ShakeExtras -> T.Text -> IO ()
733-
notifyTestingLogMessage extras msg = do
734-
(IdeTesting isTestMode) <- optTesting <$> getIdeOptionsIO extras
735-
let notif = LSP.LogMessageParams LSP.MtLog msg
736-
when isTestMode $ mRunLspT (lspEnv extras) $ LSP.sendNotification LSP.SWindowLogMessage notif
737-
738-
739721
-- | Enqueue an action in the existing 'ShakeSession'.
740722
-- Returns a computation to block until the action is run, propagating exceptions.
741723
-- Assumes a 'ShakeSession' is available.
@@ -807,17 +789,12 @@ newSession recorder extras@ShakeExtras{..} vfsMod shakeDb acts reason = do
807789
let keysActs = pumpActionThread otSpan : map (run otSpan) (reenqueued ++ acts)
808790
res <- try @SomeException $
809791
restore $ shakeRunDatabaseForKeys (HSet.toList <$> allPendingKeys) shakeDb keysActs
810-
let res' = case res of
811-
Left e -> "exception: " <> displayException e
812-
Right _ -> "completed"
813-
let msg = T.pack $ "Finishing build session(" ++ res' ++ ")"
814792
return $ do
815793
let exception =
816794
case res of
817795
Left e -> Just e
818796
_ -> Nothing
819797
logWith recorder Debug $ LogBuildSessionFinish exception
820-
notifyTestingLogMessage extras msg
821798

822799
-- Do the work in a background thread
823800
workThread <- asyncWithUnmask workRun

ghcide/test/exe/Main.hs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import Control.Exception (bracket_, catch,
2222
import qualified Control.Lens as Lens
2323
import Control.Monad
2424
import Control.Monad.IO.Class (MonadIO, liftIO)
25-
import Data.Aeson (fromJSON, toJSON)
25+
import Data.Aeson (toJSON)
2626
import qualified Data.Aeson as A
2727
import Data.Default
2828
import Data.Foldable
@@ -6075,11 +6075,14 @@ ifaceErrorTest = testCase "iface-error-test-1" $ runWithExtraFiles "recomp" $ \d
60756075
expectDiagnostics
60766076
[("P.hs", [(DsWarning,(4,0), "Top-level binding")])] -- So what we know P has been loaded
60776077

6078+
waitForProgressDone
6079+
60786080
-- Change y from Int to B
60796081
changeDoc bdoc [TextDocumentContentChangeEvent Nothing Nothing $ T.unlines ["module B where", "y :: Bool", "y = undefined"]]
60806082
-- save so that we can that the error propogates to A
60816083
sendNotification STextDocumentDidSave (DidSaveTextDocumentParams bdoc Nothing)
60826084

6085+
60836086
-- Check that the error propogates to A
60846087
expectDiagnostics
60856088
[("A.hs", [(DsError, (5, 4), "Couldn't match expected type 'Int' with actual type 'Bool'")])]
@@ -6090,7 +6093,8 @@ ifaceErrorTest = testCase "iface-error-test-1" $ runWithExtraFiles "recomp" $ \d
60906093
hi_exists <- liftIO $ doesFileExist $ hidir </> "B.hi"
60916094
liftIO $ assertBool ("Couldn't find B.hi in " ++ hidir) hi_exists
60926095

6093-
pdoc <- createDoc pPath "haskell" pSource
6096+
pdoc <- openDoc pPath "haskell"
6097+
waitForProgressDone
60946098
changeDoc pdoc [TextDocumentContentChangeEvent Nothing Nothing $ pSource <> "\nfoo = y :: Bool" ]
60956099
-- Now in P we have
60966100
-- bar = x :: Int

ghcide/test/src/Development/IDE/Test.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ expectNoMoreDiagnostics timeout =
8383
expectMessages STextDocumentPublishDiagnostics timeout $ \diagsNot -> do
8484
let fileUri = diagsNot ^. params . uri
8585
actual = diagsNot ^. params . diagnostics
86-
liftIO $
86+
unless (actual == List []) $ liftIO $
8787
assertFailure $
8888
"Got unexpected diagnostics for " <> show fileUri
8989
<> " got "

hie-compat/hie-compat.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ library
2525
build-depends:
2626
base < 4.17, array, bytestring, containers, directory, filepath, transformers
2727
if flag(ghc-lib)
28-
build-depends: ghc-lib
28+
build-depends: ghc-lib < 9.0
2929
else
3030
build-depends: ghc, ghc-boot
3131
if (impl(ghc >= 9.0) && impl(ghc < 9.1))

plugins/hls-change-type-signature-plugin/hls-change-type-signature-plugin.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ extra-source-files:
1515
LICENSE
1616
README.md
1717
test/testdata/*.hs
18+
test/testdata/*.txt
1819
test/testdata/*.yaml
1920

2021
library

plugins/hls-hlint-plugin/hls-hlint-plugin.cabal

Lines changed: 7 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,9 @@ flag pedantic
2626
manual: True
2727

2828
flag ghc-lib
29-
default: False
30-
manual: True
31-
description:
32-
Force dependency on ghc-lib-parser even if GHC API in the ghc package is supported
33-
34-
flag hlint34
35-
default: True
36-
manual: False
37-
description:
38-
Hlint-3.4 doesn't support versions ghc-lib < 9.0.1 nor ghc <= 8.6, so we can use hlint-3.2 for backwards compat
39-
This flag can be removed when all dependencies support ghc-lib-9.0.* and we drop support for ghc-8.6
29+
default: True
30+
manual: True
31+
description: Use ghc-lib types (requires hlint to be built with ghc-lib)
4032

4133
library
4234
exposed-modules: Ide.Plugin.Hlint
@@ -56,7 +48,7 @@ library
5648
, ghc-exactprint >=0.6.3.4
5749
, ghcide ^>=1.7
5850
, hashable
59-
, hlint
51+
, hlint < 3.5
6052
, hls-plugin-api ^>=1.4
6153
, hslogger
6254
, lens
@@ -69,41 +61,11 @@ library
6961
, transformers
7062
, unordered-containers
7163
, apply-refact >=0.9.0.0
72-
-- can be removed if https://github.com/ndmitchell/hlint/pull/1325#issue-1077062712 is merged
73-
-- and https://github.com/haskell/haskell-language-server/pull/2464#issue-1077133441 is updated
74-
-- accordingly
64+
, ghc-lib
65+
, ghc-lib-parser
7566
, ghc-lib-parser-ex
7667

77-
if (flag(hlint34))
78-
-- This mirrors the logic in hlint.cabal for hlint-3.3
79-
-- https://github.com/ndmitchell/hlint/blob/d3576de4529d8df6cca5a345f5b7e04474ff7bff/hlint.cabal#L79-L88
80-
-- so we can make sure that we do the same thing as hlint
81-
build-depends: hlint ^>=3.4
82-
83-
if (!flag(ghc-lib) && impl(ghc >=9.0.1) && impl(ghc <9.1.0))
84-
build-depends: ghc ==9.0.*
85-
else
86-
build-depends:
87-
, ghc-lib ^>=9.2
88-
, ghc-lib-parser-ex ^>=9.2
89-
, ghc-lib-parser ^>=9.2
90-
91-
cpp-options: -DHLINT_ON_GHC_LIB
92-
93-
else
94-
-- This mirrors the logic in hlint.cabal for hlint-3.2
95-
-- https://github.com/ndmitchell/hlint/blob/c7354e473c7d09213c8adc3dc94bf50a6eb4a42d/hlint.cabal#L79-L88
96-
build-depends: hlint ^>=3.2
97-
if (!flag(ghc-lib) && impl(ghc >=8.10.1) && impl(ghc < 8.11.0))
98-
build-depends: ghc >=8.10 && <9.0
99-
else
100-
build-depends:
101-
, ghc
102-
, ghc-lib ^>=8.10.7.20210828
103-
, ghc-lib-parser-ex ^>=8.10
104-
105-
cpp-options: -DHLINT_ON_GHC_LIB
106-
68+
cpp-options: -DHLINT_ON_GHC_LIB
10769
ghc-options:
10870
-Wall -Wredundant-constraints -Wno-name-shadowing
10971
-Wno-unticked-promoted-constructors

plugins/hls-hlint-plugin/test/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ disableHlint = sendConfigurationChanged $ toJSON $ def { Plugin.plugins = Map.fr
371371
-- Although a given hlint version supports one direct ghc, we could use several versions of hlint
372372
-- each one supporting a different ghc version. It should be a temporary situation though.
373373
knownBrokenForHlintOnGhcLib :: String -> TestTree -> TestTree
374-
knownBrokenForHlintOnGhcLib = knownBrokenForGhcVersions [GHC86, GHC88, GHC90, GHC92]
374+
knownBrokenForHlintOnGhcLib = expectFailBecause
375375

376376
-- 1's based
377377
data Point = Point {

stack-lts16.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,10 @@ flags:
103103
pedantic: true
104104
retrie:
105105
BuildExecutable: false
106-
# Stack doesn't support automatic flags.
107-
# Until the formatters support ghc-lib-9, we need this flag disabled
108-
hls-hlint-plugin:
109-
hlint34: false
110106
hyphenation:
111107
embed: true
108+
hlint:
109+
ghc-lib: true
112110

113111
nix:
114112
packages: [icu libcxx zlib]

stack-lts19.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,10 @@ flags:
6767
retrie:
6868
BuildExecutable: false
6969
# Stack doesn't support automatic flags.
70-
# Until the formatters support ghc-lib-9, we need this flag disabled
71-
hls-hlint-plugin:
72-
hlint34: true
73-
ghc-lib: true
7470
hyphenation:
7571
embed: true
72+
hlint:
73+
ghc-lib: true
7674

7775
nix:
7876
packages: [ icu libcxx zlib ]

stack.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ flags:
8282
retrie:
8383
BuildExecutable: false
8484
# Stack doesn't support automatic flags.
85-
hls-hlint-plugin:
86-
hlint34: true
87-
ghc-lib: true
8885
# Use ghc-lib force instead of ghc itself
8986
ghc-lib-parser-ex:
9087
auto: false

0 commit comments

Comments
 (0)