Skip to content

Commit 5348c61

Browse files
committed
Merge branch 'master' into agda-case-split
2 parents 3ea09c3 + 1b76c81 commit 5348c61

File tree

123 files changed

+2350
-2712
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+2350
-2712
lines changed

cabal.project

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ packages:
1212
./plugins/hls-retrie-plugin
1313
./plugins/hls-haddock-comments-plugin
1414
./plugins/hls-splice-plugin
15-
1615
tests: true
1716

1817
package *
@@ -25,7 +24,7 @@ package ghcide
2524

2625
write-ghc-environment-files: never
2726

28-
index-state: 2021-02-08T19:11:03Z
27+
index-state: 2021-02-15T19:11:03Z
2928

3029
allow-newer:
3130
active:base,

ghcide/.hlint.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,14 @@
9898
- default: false
9999
- {name: [-Wno-missing-signatures, -Wno-orphans, -Wno-overlapping-patterns, -Wno-incomplete-patterns, -Wno-missing-fields, -Wno-unused-matches]}
100100
- {name: [-Wno-dodgy-imports,-Wno-incomplete-uni-patterns], within: [Main, Development.IDE.GHC.Compat, Development.Benchmark.Rules]}
101+
- {name: [-Wno-deprecations, -Wno-unticked-promoted-constructors], within: [Main, Experiments]}
101102
# - modules:
102103
# - {name: [Data.Set, Data.HashSet], as: Set} # if you import Data.Set qualified, it must be as 'Set'
103104
# - {name: Control.Arrow, within: []} # Certain modules are banned entirely
104105
#
105106
- functions:
106107
# Things that are unsafe in Haskell base library
107-
- {name: unsafeInterleaveIO, within: []}
108+
- {name: unsafeInterleaveIO, within: [Development.IDE.LSP.LanguageServer]}
108109
- {name: unsafeDupablePerformIO, within: []}
109110
- {name: unsafeCoerce, within: []}
110111
# Things that are a bit dangerous in the GHC API

ghcide/bench/lib/Experiments.hs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{-# LANGUAGE ConstraintKinds #-}
2+
{-# LANGUAGE GADTs #-}
23
{-# LANGUAGE ExistentialQuantification #-}
34
{-# LANGUAGE ImplicitParams #-}
45
{-# LANGUAGE ImpredicativeTypes #-}
6+
{-# OPTIONS_GHC -Wno-deprecations -Wno-unticked-promoted-constructors #-}
57

68
module Experiments
79
( Bench(..)
@@ -23,16 +25,16 @@ import Control.Applicative.Combinators (skipManyTill)
2325
import Control.Exception.Safe (IOException, handleAny, try)
2426
import Control.Monad.Extra
2527
import Control.Monad.IO.Class
26-
import Data.Aeson (Value(Null))
28+
import Data.Aeson (Value(Null), toJSON)
2729
import Data.List
2830
import Data.Maybe
2931
import qualified Data.Text as T
3032
import Data.Version
3133
import Development.IDE.Plugin.Test
3234
import Experiments.Types
33-
import Language.Haskell.LSP.Test
34-
import Language.Haskell.LSP.Types
35-
import Language.Haskell.LSP.Types.Capabilities
35+
import Language.LSP.Test
36+
import Language.LSP.Types
37+
import Language.LSP.Types.Capabilities
3638
import Numeric.Natural
3739
import Options.Applicative
3840
import System.Directory
@@ -79,13 +81,13 @@ experiments =
7981
isJust <$> getHover doc (fromJust identifierP),
8082
---------------------------------------------------------------------------------------
8183
bench "getDefinition" $ allWithIdentifierPos $ \DocumentPositions{..} ->
82-
not . null <$> getDefinitions doc (fromJust identifierP),
84+
either (not . null) (not . null) . toEither <$> getDefinitions doc (fromJust identifierP),
8385
---------------------------------------------------------------------------------------
8486
bench "getDefinition after edit" $ \docs -> do
8587
forM_ docs $ \DocumentPositions{..} ->
8688
changeDoc doc [charEdit stringLiteralP]
8789
flip allWithIdentifierPos docs $ \DocumentPositions{..} ->
88-
not . null <$> getDefinitions doc (fromJust identifierP),
90+
either (not . null) (not . null) . toEither <$> getDefinitions doc (fromJust identifierP),
8991
---------------------------------------------------------------------------------------
9092
bench "documentSymbols" $ allM $ \DocumentPositions{..} -> do
9193
fmap (either (not . null) (not . null)) . getDocumentSymbols $ doc,
@@ -148,7 +150,7 @@ experiments =
148150
( \docs -> do
149151
Just hieYaml <- uriToFilePath <$> getDocUri "hie.yaml"
150152
liftIO $ appendFile hieYaml "##\n"
151-
sendNotification WorkspaceDidChangeWatchedFiles $ DidChangeWatchedFilesParams $
153+
sendNotification SWorkspaceDidChangeWatchedFiles $ DidChangeWatchedFilesParams $
152154
List [ FileEvent (filePathToUri "hie.yaml") FcChanged ]
153155
forM_ docs $ \DocumentPositions{..} ->
154156
changeDoc doc [charEdit stringLiteralP]
@@ -163,7 +165,7 @@ experiments =
163165
(\docs -> do
164166
Just hieYaml <- uriToFilePath <$> getDocUri "hie.yaml"
165167
liftIO $ appendFile hieYaml "##\n"
166-
sendNotification WorkspaceDidChangeWatchedFiles $ DidChangeWatchedFilesParams $
168+
sendNotification SWorkspaceDidChangeWatchedFiles $ DidChangeWatchedFilesParams $
167169
List [ FileEvent (filePathToUri "hie.yaml") FcChanged ]
168170
flip allWithIdentifierPos docs $ \DocumentPositions{..} -> isJust <$> getHover doc (fromJust identifierP)
169171
)
@@ -359,7 +361,9 @@ waitForProgressDone :: Session ()
359361
waitForProgressDone = loop
360362
where
361363
loop = do
362-
void (skipManyTill anyMessage message :: Session WorkDoneProgressEndNotification)
364+
~() <- skipManyTill anyMessage $ satisfyMaybe $ \case
365+
FromServerMess SProgress (NotificationMessage _ _ (ProgressParams _ (End _))) -> Just ()
366+
_ -> Nothing
363367
done <- null <$> getIncompleteProgressSessions
364368
unless done loop
365369

@@ -393,8 +397,9 @@ runBench runSess b = handleAny (\e -> print e >> return badRun)
393397
else do
394398
output (showDuration t)
395399
-- Wait for the delayed actions to finish
396-
waitId <- sendRequest (CustomClientMethod "test") WaitForShakeQueue
397-
(td, resp) <- duration $ skipManyTill anyMessage $ responseForId waitId
400+
let m = SCustomMethod "test"
401+
waitId <- sendRequest m (toJSON WaitForShakeQueue)
402+
(td, resp) <- duration $ skipManyTill anyMessage $ responseForId m waitId
398403
case resp of
399404
ResponseMessage{_result=Right Null} -> do
400405
loop (userWaits+t) (delayedWork+td) (n -1)
@@ -562,7 +567,7 @@ searchSymbol doc@TextDocumentIdentifier{_uri} fileContents pos = do
562567
checkDefinitions pos = do
563568
defs <- getDefinitions doc pos
564569
case defs of
565-
[Location uri _] -> return $ uri /= _uri
570+
(InL [Location uri _]) -> return $ uri /= _uri
566571
_ -> return False
567572
checkCompletions pos =
568573
not . null <$> getCompletions doc pos

ghcide/exe/Main.hs

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import Development.IDE.Core.OfInterest (kick)
2020
import Development.IDE.Core.Rules (mainRule)
2121
import qualified Development.IDE.Plugin.HLS.GhcIde as GhcIde
2222
import qualified Development.IDE.Plugin.Test as Test
23-
import Development.IDE.Session (setInitialDynFlags, getHieDbLoc, runWithDb)
23+
import Development.IDE.Session (setInitialDynFlags, getHieDbLoc)
2424
import Development.IDE.Types.Options
2525
import qualified Development.IDE.Main as Main
2626
import Development.Shake (ShakeOptions(shakeThreads))
@@ -56,9 +56,6 @@ main = do
5656

5757
whenJust argsCwd IO.setCurrentDirectory
5858

59-
dir <- IO.getCurrentDirectory
60-
dbLoc <- getHieDbLoc dir
61-
6259
-- lock to avoid overlapping output on stdout
6360
lock <- newLock
6461
let logger = Logger $ \pri msg -> when (pri >= logLevel) $ withLock lock $
@@ -67,6 +64,8 @@ main = do
6764

6865
case argFilesOrCmd of
6966
DbCmd opts cmd -> do
67+
dir <- IO.getCurrentDirectory
68+
dbLoc <- getHieDbLoc dir
7069
mlibdir <- setInitialDynFlags
7170
case mlibdir of
7271
Nothing -> exitWith $ ExitFailure 1
@@ -80,40 +79,39 @@ main = do
8079
hPutStrLn stderr "If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!"
8180
_ -> return ()
8281

83-
runWithDb dbLoc $ \hiedb hiechan ->
84-
Main.defaultMain (Main.defArguments hiedb hiechan)
85-
{Main.argFiles = case argFilesOrCmd of
86-
Typecheck x | not argLSP -> Just x
87-
_ -> Nothing
88-
89-
,Main.argsLogger = logger
90-
91-
,Main.argsRules = do
92-
-- install the main and ghcide-plugin rules
93-
mainRule
94-
-- install the kick action, which triggers a typecheck on every
95-
-- Shake database restart, i.e. on every user edit.
96-
unless argsDisableKick $
97-
action kick
98-
99-
,Main.argsHlsPlugins =
100-
pluginDescToIdePlugins $
101-
GhcIde.descriptors
102-
++ [Test.blockCommandDescriptor "block-command" | argsTesting]
103-
104-
,Main.argsGhcidePlugin = if argsTesting
105-
then Test.plugin
106-
else mempty
107-
108-
,Main.argsIdeOptions = \(fromMaybe def -> config) sessionLoader ->
109-
let defOptions = defaultIdeOptions sessionLoader
110-
in defOptions
111-
{ optShakeProfiling = argsShakeProfiling
112-
, optOTMemoryProfiling = IdeOTMemoryProfiling argsOTMemoryProfiling
113-
, optTesting = IdeTesting argsTesting
114-
, optShakeOptions = (optShakeOptions defOptions){shakeThreads = argsThreads}
115-
, optCheckParents = checkParents config
116-
, optCheckProject = checkProject config
117-
}
118-
}
82+
Main.defaultMain Main.defArguments
83+
{Main.argFiles = case argFilesOrCmd of
84+
Typecheck x | not argLSP -> Just x
85+
_ -> Nothing
86+
87+
,Main.argsLogger = logger
88+
89+
,Main.argsRules = do
90+
-- install the main and ghcide-plugin rules
91+
mainRule
92+
-- install the kick action, which triggers a typecheck on every
93+
-- Shake database restart, i.e. on every user edit.
94+
unless argsDisableKick $
95+
action kick
96+
97+
,Main.argsHlsPlugins =
98+
pluginDescToIdePlugins $
99+
GhcIde.descriptors
100+
++ [Test.blockCommandDescriptor "block-command" | argsTesting]
101+
102+
,Main.argsGhcidePlugin = if argsTesting
103+
then Test.plugin
104+
else mempty
105+
106+
,Main.argsIdeOptions = \(fromMaybe def -> config) sessionLoader ->
107+
let defOptions = defaultIdeOptions sessionLoader
108+
in defOptions
109+
{ optShakeProfiling = argsShakeProfiling
110+
, optOTMemoryProfiling = IdeOTMemoryProfiling argsOTMemoryProfiling
111+
, optTesting = IdeTesting argsTesting
112+
, optShakeOptions = (optShakeOptions defOptions){shakeThreads = argsThreads}
113+
, optCheckParents = pure $ checkParents config
114+
, optCheckProject = pure $ checkProject config
115+
}
116+
}
119117

ghcide/ghcide.cabal

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ library
4646
data-default,
4747
deepseq,
4848
directory,
49+
dependent-map,
50+
dependent-sum,
4951
dlist,
5052
extra >= 1.7.4,
5153
fuzzy,
@@ -55,12 +57,12 @@ library
5557
Glob,
5658
haddock-library >= 1.8,
5759
hashable,
58-
haskell-lsp-types == 0.23.*,
59-
haskell-lsp == 0.23.*,
6060
hie-compat,
61-
hls-plugin-api >= 0.7,
61+
hls-plugin-api >= 0.7.1,
6262
lens,
6363
hiedb == 0.3.0.1,
64+
lsp-types == 1.1.*,
65+
lsp == 1.1.*,
6466
mtl,
6567
network-uri,
6668
parallel,
@@ -88,7 +90,9 @@ library
8890
vector,
8991
bytestring-encoding,
9092
opentelemetry >=0.6.1,
91-
heapsize ==0.3.*
93+
heapsize ==0.3.*,
94+
unliftio,
95+
unliftio-core
9296
if flag(ghc-lib)
9397
build-depends:
9498
ghc-lib >= 8.8,
@@ -131,6 +135,9 @@ library
131135
TupleSections
132136
TypeApplications
133137
ViewPatterns
138+
DataKinds
139+
TypeOperators
140+
KindSignatures
134141

135142
hs-source-dirs:
136143
src
@@ -157,10 +164,10 @@ library
157164
Development.IDE.GHC.Orphans
158165
Development.IDE.GHC.Util
159166
Development.IDE.Import.DependencyInformation
167+
Development.IDE.Import.FindImports
160168
Development.IDE.LSP.HoverDefinition
161169
Development.IDE.LSP.LanguageServer
162170
Development.IDE.LSP.Outline
163-
Development.IDE.LSP.Protocol
164171
Development.IDE.LSP.Server
165172
Development.IDE.Spans.Common
166173
Development.IDE.Spans.Documentation
@@ -201,13 +208,11 @@ library
201208
Development.IDE.Core.FileExists
202209
Development.IDE.GHC.CPP
203210
Development.IDE.GHC.Warnings
204-
Development.IDE.Import.FindImports
205211
Development.IDE.LSP.Notifications
206212
Development.IDE.Plugin.CodeAction.PositionIndexed
207213
Development.IDE.Plugin.Completions.Logic
208-
Development.IDE.Plugin.HLS.Formatter
209214
Development.IDE.Types.Action
210-
ghc-options: -Wall -Wno-name-shadowing -Wincomplete-uni-patterns
215+
ghc-options: -Wall -Wno-name-shadowing -Wincomplete-uni-patterns -Wno-unticked-promoted-constructors
211216

212217
executable ghcide-test-preprocessor
213218
default-language: Haskell2010
@@ -285,8 +290,8 @@ executable ghcide
285290
safe-exceptions,
286291
ghc,
287292
hashable,
288-
haskell-lsp,
289-
haskell-lsp-types,
293+
lsp,
294+
lsp-types,
290295
heapsize,
291296
hie-bios,
292297
hls-plugin-api,
@@ -346,12 +351,12 @@ test-suite ghcide-tests
346351
ghcide,
347352
ghc-typelits-knownnat,
348353
haddock-library,
349-
haskell-lsp,
350-
haskell-lsp-types,
354+
lsp,
355+
lsp-types,
351356
hls-plugin-api,
352357
network-uri,
353358
lens,
354-
lsp-test >= 0.12.0.0 && < 0.13,
359+
lsp-test == 0.13.0.0,
355360
optparse-applicative,
356361
process,
357362
QuickCheck,
@@ -372,7 +377,7 @@ test-suite ghcide-tests
372377
record-hasfield
373378
hs-source-dirs: test/cabal test/exe test/src bench/lib
374379
include-dirs: include
375-
ghc-options: -threaded -Wall -Wno-name-shadowing -O0
380+
ghc-options: -threaded -Wall -Wno-name-shadowing -O0 -Wno-unticked-promoted-constructors
376381
main-is: Main.hs
377382
other-modules:
378383
Development.IDE.Test
@@ -408,7 +413,7 @@ executable ghcide-bench
408413
extra,
409414
filepath,
410415
ghcide,
411-
lsp-test >= 0.12.0.0 && < 0.13,
416+
lsp-test == 0.13.0.0,
412417
optparse-applicative,
413418
process,
414419
safe-exceptions,

0 commit comments

Comments
 (0)