Skip to content

Commit cffc9ce

Browse files
authored
Merge branch 'master' into retrie-9.2
2 parents 7dcd4ec + fdbc555 commit cffc9ce

File tree

170 files changed

+4793
-3842
lines changed

Some content is hidden

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

170 files changed

+4793
-3842
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ jobs:
160160
name: Test hls-brittany-plugin
161161
run: cabal test hls-brittany-plugin --test-options="$TEST_OPTS" || cabal test hls-brittany-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-brittany-plugin --test-options="$TEST_OPTS"
162162

163+
- if: matrix.test
164+
name: Test hls-refactor-plugin
165+
run: cabal test hls-refactor-plugin --test-options="$TEST_OPTS" || cabal test hls-refactor-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-refactor-plugin --test-options="$TEST_OPTS"
166+
163167
- if: matrix.test
164168
name: Test hls-floskell-plugin
165169
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"

.hlint.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
within:
5555
- Development.IDE.Core.Shake
5656
- Development.IDE.GHC.Util
57+
- Development.IDE.Plugin.CodeAction.Util
5758
- Development.IDE.Graph.Internal.Database
5859
- Development.IDE.Graph.Internal.Paths
5960
- Development.IDE.Graph.Internal.Profile
@@ -184,6 +185,7 @@
184185
- Development.IDE.Core.Shake
185186
- Development.IDE.Plugin.Completions
186187
- Development.IDE.Plugin.CodeAction.ExactPrint
188+
- Development.IDE.Plugin.CodeAction
187189
- Development.IDE.Test
188190
- Development.IDE.Graph.Internal.Profile
189191
- Development.IDE.Graph.Internal.Rules
@@ -221,6 +223,7 @@
221223
- Development.IDE.Core.Compile
222224
- Development.IDE.Graph.Internal.Database
223225
- Development.IDE.GHC.Util
226+
- Development.IDE.Plugin.CodeAction.Util
224227
- Wingman.Debug
225228

226229
# We really do not want novel usages of restricted functions, and mere

bench/config.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,13 @@ configurations:
108108
- ghcide-type-lenses
109109
- pragmas
110110
- Ghcide:
111+
- ghcide-completions
112+
- ghcide-type-lenses
113+
- Refactor:
111114
- ghcide-code-actions-bindings
112115
- ghcide-code-actions-fill-holes
113116
- ghcide-code-actions-imports-exports
114117
- ghcide-code-actions-type-signatures
115-
- ghcide-completions
116-
- ghcide-type-lenses
117118
- All:
118119
- alternateNumberFormat
119120
- callHierarchy

cabal.project

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ packages:
55
./hls-graph
66
./ghcide
77
./ghcide-bench
8+
./ghcide/test
89
./hls-plugin-api
910
./hls-test-utils
1011
./plugins/hls-tactics-plugin
@@ -32,6 +33,7 @@ packages:
3233
./plugins/hls-stan-plugin
3334
./plugins/hls-gadt-plugin
3435
./plugins/hls-explicit-fixity-plugin
36+
./plugins/hls-refactor-plugin
3537

3638
-- Standard location for temporary packages needed for particular environments
3739
-- For example it is used in the project gitlab mirror to help in the MAcOS M1 build script

ghcide-bench/ghcide-bench.cabal

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ library
6363
exposed-modules:
6464
Experiments.Types
6565
Experiments
66-
other-modules:
67-
Development.IDE.Test.Diagnostic
6866
build-depends:
6967
aeson,
7068
async,
@@ -76,6 +74,7 @@ library
7674
extra,
7775
filepath,
7876
ghcide,
77+
ghcide-test-utils,
7978
hashable,
8079
lens,
8180
lsp-test,

ghcide-bench/src/Development/IDE/Test/Diagnostic.hs

Lines changed: 0 additions & 48 deletions
This file was deleted.

ghcide/ghcide.cabal

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ library
6060
filepath,
6161
fingertree,
6262
focus,
63-
ghc-exactprint < 1 || >= 1.4,
6463
ghc-trace-events,
6564
Glob,
6665
haddock-library >= 1.8 && < 1.11,
@@ -74,16 +73,13 @@ library
7473
lsp ^>= 1.5.0.0 ,
7574
monoid-subclasses,
7675
mtl,
77-
network-uri,
7876
optparse-applicative,
7977
parallel,
8078
prettyprinter-ansi-terminal,
8179
prettyprinter >= 1.6,
8280
random,
8381
regex-tdfa >= 1.3.1.0,
84-
retrie,
8582
text-rope,
86-
safe,
8783
safe-exceptions,
8884
hls-graph ^>= 1.7,
8985
sorted-list,
@@ -95,9 +91,7 @@ library
9591
time,
9692
transformers,
9793
unordered-containers >= 0.2.10.0,
98-
utf8-string,
9994
vector,
100-
vector-algorithms,
10195
hslogger,
10296
Diff ^>=0.4.0,
10397
vector,
@@ -114,9 +108,6 @@ library
114108
hie-bios ^>= 0.9.1,
115109
implicit-hie-cradle ^>= 0.3.0.5 || ^>= 0.5,
116110
base16-bytestring >=0.1.1 && <1.1
117-
if impl(ghc >= 9.2)
118-
build-depends:
119-
ghc-exactprint >= 1.4
120111
if os(windows)
121112
build-depends:
122113
Win32
@@ -172,7 +163,6 @@ library
172163
Development.IDE.GHC.Compat
173164
Development.IDE.GHC.Compat.Core
174165
Development.IDE.GHC.Compat.Env
175-
Development.IDE.GHC.Compat.ExactPrint
176166
Development.IDE.GHC.Compat.Iface
177167
Development.IDE.GHC.Compat.Logger
178168
Development.IDE.GHC.Compat.Outputable
@@ -182,9 +172,7 @@ library
182172
Development.IDE.GHC.Compat.Util
183173
Development.IDE.Core.Compile
184174
Development.IDE.GHC.CoreFile
185-
Development.IDE.GHC.Dump
186175
Development.IDE.GHC.Error
187-
Development.IDE.GHC.ExactPrint
188176
Development.IDE.GHC.Orphans
189177
Development.IDE.GHC.Util
190178
Development.IDE.Import.DependencyInformation
@@ -214,8 +202,6 @@ library
214202
Development.IDE.Plugin
215203
Development.IDE.Plugin.Completions
216204
Development.IDE.Plugin.Completions.Types
217-
Development.IDE.Plugin.CodeAction
218-
Development.IDE.Plugin.CodeAction.ExactPrint
219205
Development.IDE.Plugin.HLS
220206
Development.IDE.Plugin.HLS.GhcIde
221207
Development.IDE.Plugin.Test
@@ -226,8 +212,6 @@ library
226212
Development.IDE.Core.FileExists
227213
Development.IDE.GHC.CPP
228214
Development.IDE.GHC.Warnings
229-
Development.IDE.Plugin.CodeAction.PositionIndexed
230-
Development.IDE.Plugin.CodeAction.Args
231215
Development.IDE.Plugin.Completions.Logic
232216
Development.IDE.Session.VersionCheck
233217
Development.IDE.Types.Action
@@ -365,6 +349,7 @@ test-suite ghcide-tests
365349
ghc,
366350
--------------------------------------------------------------
367351
ghcide,
352+
ghcide-test-utils-internal,
368353
ghc-typelits-knownnat,
369354
lsp,
370355
lsp-types,
@@ -393,12 +378,10 @@ test-suite ghcide-tests
393378
build-depends:
394379
record-dot-preprocessor,
395380
record-hasfield
396-
hs-source-dirs: test/cabal test/exe test/src bench/lib
381+
hs-source-dirs: test/cabal test/exe bench/lib
397382
ghc-options: -threaded -Wall -Wno-name-shadowing -O0 -Wno-unticked-promoted-constructors
398383
main-is: Main.hs
399384
other-modules:
400-
Development.IDE.Test
401-
Development.IDE.Test.Diagnostic
402385
Development.IDE.Test.Runfiles
403386
FuzzySearch
404387
Progress
@@ -418,3 +401,41 @@ test-suite ghcide-tests
418401
TupleSections
419402
TypeApplications
420403
ViewPatterns
404+
405+
library ghcide-test-utils-internal
406+
default-language: Haskell2010
407+
build-depends:
408+
aeson,
409+
base,
410+
containers,
411+
data-default,
412+
directory,
413+
extra,
414+
filepath,
415+
ghcide,
416+
lsp-types,
417+
hls-plugin-api,
418+
lens,
419+
lsp-test ^>= 0.14,
420+
tasty-hunit >= 0.10,
421+
text,
422+
hs-source-dirs: test/src
423+
ghc-options: -Wunused-packages
424+
exposed-modules:
425+
Development.IDE.Test
426+
Development.IDE.Test.Diagnostic
427+
default-extensions:
428+
BangPatterns
429+
DeriveFunctor
430+
DeriveGeneric
431+
FlexibleContexts
432+
GeneralizedNewtypeDeriving
433+
LambdaCase
434+
NamedFieldPuns
435+
OverloadedStrings
436+
RecordWildCards
437+
ScopedTypeVariables
438+
StandaloneDeriving
439+
TupleSections
440+
TypeApplications
441+
ViewPatterns

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ import Development.IDE.GHC.Compat hiding
119119
import qualified Development.IDE.GHC.Compat as Compat hiding (vcat, nest)
120120
import qualified Development.IDE.GHC.Compat.Util as Util
121121
import Development.IDE.GHC.Error
122-
import Development.IDE.GHC.ExactPrint hiding (LogShake, Log)
123122
import Development.IDE.GHC.Util hiding
124123
(modifyDynFlags)
125124
import Development.IDE.Graph
@@ -154,7 +153,6 @@ import System.Info.Extra (isWindows)
154153
import HIE.Bios.Ghc.Gap (hostIsDynamic)
155154
import Development.IDE.Types.Logger (Recorder, logWith, cmapWithPrio, WithPriority, Pretty (pretty), (<+>), nest, vcat)
156155
import qualified Development.IDE.Core.Shake as Shake
157-
import qualified Development.IDE.GHC.ExactPrint as ExactPrint hiding (LogShake)
158156
import qualified Development.IDE.Types.Logger as Logger
159157
import qualified Development.IDE.Types.Shake as Shake
160158
import Development.IDE.GHC.CoreFile
@@ -167,7 +165,6 @@ data Log
167165
| LogLoadingHieFile !NormalizedFilePath
168166
| LogLoadingHieFileFail !FilePath !SomeException
169167
| LogLoadingHieFileSuccess !FilePath
170-
| LogExactPrint ExactPrint.Log
171168
| LogTypecheckedFOI !NormalizedFilePath
172169
deriving Show
173170

@@ -185,7 +182,6 @@ instance Pretty Log where
185182
, pretty (displayException e) ]
186183
LogLoadingHieFileSuccess path ->
187184
"SUCCEEDED LOADING HIE FILE FOR" <+> pretty path
188-
LogExactPrint log -> pretty log
189185
LogTypecheckedFOI path -> vcat
190186
[ "Typechecked a file which is not currently open in the editor:" <+> pretty (fromNormalizedFilePath path)
191187
, "This can indicate a bug which results in excessive memory usage."
@@ -1230,7 +1226,6 @@ mainRule recorder RulesConfig{..} = do
12301226
else defineNoDiagnostics (cmapWithPrio LogShake recorder) $ \NeedsCompilation _ -> return $ Just Nothing
12311227
generateCoreRule recorder
12321228
getImportMapRule recorder
1233-
getAnnotatedParsedSourceRule (cmapWithPrio LogExactPrint recorder)
12341229
persistentHieFileRule recorder
12351230
persistentDocMapRule
12361231
persistentImportMapRule

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import Development.IDE.Core.Shake hiding (Log)
4141
import qualified Development.IDE.Core.Shake as Shake
4242
import Development.IDE.Types.Monitoring (Monitoring)
4343
import Development.IDE.Types.Shake (WithHieDb)
44+
import Ide.Types (IdePlugins)
4445
import System.Environment (lookupEnv)
4546

4647
data Log
@@ -61,6 +62,7 @@ instance Pretty Log where
6162
-- | Initialise the Compiler Service.
6263
initialise :: Recorder (WithPriority Log)
6364
-> Config
65+
-> IdePlugins IdeState
6466
-> Rules ()
6567
-> Maybe (LSP.LanguageContextEnv Config)
6668
-> Logger
@@ -70,7 +72,7 @@ initialise :: Recorder (WithPriority Log)
7072
-> IndexQueue
7173
-> Monitoring
7274
-> IO IdeState
73-
initialise recorder defaultConfig mainRule lspEnv logger debouncer options withHieDb hiedbChan metrics = do
75+
initialise recorder defaultConfig plugins mainRule lspEnv logger debouncer options withHieDb hiedbChan metrics = do
7476
shakeProfiling <- do
7577
let fromConf = optShakeProfiling options
7678
fromEnv <- lookupEnv "GHCIDE_BUILD_PROFILING"
@@ -79,6 +81,7 @@ initialise recorder defaultConfig mainRule lspEnv logger debouncer options withH
7981
(cmapWithPrio LogShake recorder)
8082
lspEnv
8183
defaultConfig
84+
plugins
8285
logger
8386
debouncer
8487
shakeProfiling

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ import GHC.Stack (HasCallStack)
158158
import HieDb.Types
159159
import Ide.Plugin.Config
160160
import qualified Ide.PluginUtils as HLS
161-
import Ide.Types (PluginId)
161+
import Ide.Types (PluginId, IdePlugins)
162162
import Language.LSP.Diagnostics
163163
import qualified Language.LSP.Server as LSP
164164
import Language.LSP.Types
@@ -239,6 +239,7 @@ data ShakeExtras = ShakeExtras
239239
lspEnv :: Maybe (LSP.LanguageContextEnv Config)
240240
,debouncer :: Debouncer NormalizedUri
241241
,logger :: Logger
242+
,idePlugins :: IdePlugins IdeState
242243
,globals :: TVar (HMap.HashMap TypeRep Dynamic)
243244
-- ^ Registry of global state used by rules.
244245
-- Small and immutable after startup, so not worth using an STM.Map.
@@ -552,6 +553,7 @@ seqValue val = case val of
552553
shakeOpen :: Recorder (WithPriority Log)
553554
-> Maybe (LSP.LanguageContextEnv Config)
554555
-> Config
556+
-> IdePlugins IdeState
555557
-> Logger
556558
-> Debouncer NormalizedUri
557559
-> Maybe FilePath
@@ -563,7 +565,7 @@ shakeOpen :: Recorder (WithPriority Log)
563565
-> Monitoring
564566
-> Rules ()
565567
-> IO IdeState
566-
shakeOpen recorder lspEnv defaultConfig logger debouncer
568+
shakeOpen recorder lspEnv defaultConfig idePlugins logger debouncer
567569
shakeProfileDir (IdeReportProgress reportProgress)
568570
ideTesting@(IdeTesting testing)
569571
withHieDb indexQueue opts monitoring rules = mdo

0 commit comments

Comments
 (0)