Skip to content

Commit 3a4ddda

Browse files
committed
merge master
2 parents ddef7d4 + 59b733f commit 3a4ddda

File tree

68 files changed

+307
-2665
lines changed

Some content is hidden

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

68 files changed

+307
-2665
lines changed

CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
/hls-graph @wz1000
55
/hls-plugin-api @michaelpj @fendor
66
/hls-test-utils @fendor
7-
/hie-compat @wz1000
87

98
# HLS main
109
/src @fendor

RELEASING.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
- [ ] bump package versions in all `*.cabal` files (same version as hls)
1010
- HLS uses lockstep versioning. The core packages and all plugins use the same version number, and only support exactly this version.
1111
- Exceptions:
12-
- `hie-compat` requires no automatic version bump.
1312
- `shake-bench` is an internal testing tool, not exposed to the outside world. Thus, no version bump required for releases.
1413
- For updating cabal files, the following script can be used:
1514
- ```sh

cabal.project

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
packages:
22
./
3-
./hie-compat
43
./shake-bench
54
./hls-graph
65
./ghcide

docs/contributing/contributing.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ pre-commit install
197197
#### Why are some components excluded from automatic formatting?
198198

199199
- `test/testdata` and `test/data` are excluded because we want to test formatting plugins.
200-
- `hie-compat` is excluded because we want to keep its code as close to GHC as possible.
201200

202201
## Plugin tutorial
203202

ghcide-test/exe/FindDefinitionAndHoverTests.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ tests = let
187187
holeL65 = Position 65 8 ; hleInfo2 = [ExpectHoverText ["_ :: a -> Maybe a"]]
188188
cccL17 = Position 17 16 ; docLink = [ExpectHoverTextRegex "\\*Defined in 'GHC.Types'\\* \\*\\(ghc-prim-[0-9.]+\\)\\*\n\n"]
189189
imported = Position 56 13 ; importedSig = getDocUri "Foo.hs" >>= \foo -> return [ExpectHoverText ["foo", "Foo", "Haddock"], mkL foo 5 0 5 3]
190-
reexported = Position 55 14 ; reexportedSig = getDocUri "Bar.hs" >>= \bar -> return [ExpectHoverText ["Bar", "Bar", "Haddock"], if ghcVersion < GHC910 then mkL bar 3 5 3 8 else mkL bar 3 0 3 14]
190+
reexported = Position 55 14
191+
reexportedSig = getDocUri "Bar.hs" >>= \bar -> return [ExpectHoverText ["Bar", "Bar", "Haddock"], if ghcVersion < GHC910 || not isWindows then mkL bar 3 5 3 8 else mkL bar 3 0 3 14]
191192
thLocL57 = Position 59 10 ; thLoc = [ExpectHoverText ["Identity"]]
192193
cmtL68 = Position 67 0 ; lackOfdEq = [ExpectHoverExcludeText ["$dEq"]]
193194
import310 = Position 3 10; pkgTxt = [ExpectHoverText ["Data.Text\n\ntext-"]]
@@ -237,9 +238,9 @@ tests = let
237238
, testM yes yes imported importedSig "Imported symbol"
238239
, if isWindows then
239240
-- Flaky on Windows: https://github.com/haskell/haskell-language-server/issues/2997
240-
testM no yes reexported reexportedSig "Imported symbol (reexported)"
241+
testM no yes reexported reexportedSig "Imported symbol reexported"
241242
else
242-
testM yes yes reexported reexportedSig "Imported symbol (reexported)"
243+
testM yes yes reexported reexportedSig "Imported symbol reexported"
243244
, test no yes thLocL57 thLoc "TH Splice Hover"
244245
, test yes yes import310 pkgTxt "show package name and its version"
245246
]

ghcide/ghcide.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ library
7474
, haddock-library >=1.8 && <1.12
7575
, hashable
7676
, hie-bios ^>=0.16.0
77-
, hie-compat ^>=0.3.0.0
7877
, hiedb ^>= 0.7.0.0
7978
, hls-graph == 2.11.0.0
8079
, hls-plugin-api == 2.11.0.0

ghcide/session-loader/Development/IDE/Session.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,10 +827,11 @@ session recorder sessionShake sessionState knownTargetsVar(hieYaml, cfp, opts, l
827827
packageSetup :: Recorder (WithPriority Log) -> SessionState -> SessionM HscEnv -> (Maybe FilePath, NormalizedFilePath, ComponentOptions) -> SessionM ([ComponentInfo], [ComponentInfo])
828828
packageSetup recorder sessionState newEmptyHscEnv (hieYaml, cfp, opts) = do
829829
getCacheDirs <- asks (getCacheDirs . sessionLoadingOptions)
830+
haddockparse <- asks (optHaddockParse . sessionIdeOptions)
830831
rootDir <- asks sessionRootDir
831832
-- Parse DynFlags for the newly discovered component
832833
hscEnv <- newEmptyHscEnv
833-
newTargetDfs <- liftIO $ evalGhcEnv hscEnv $ setOptions cfp opts (hsc_dflags hscEnv) rootDir
834+
newTargetDfs <- liftIO $ evalGhcEnv hscEnv $ setOptions haddockparse cfp opts (hsc_dflags hscEnv) rootDir
834835
let deps = componentDependencies opts ++ maybeToList hieYaml
835836
dep_info <- liftIO $ getDependencyInfo deps
836837
-- Now lookup to see whether we are combining with an existing HscEnv

ghcide/session-loader/Development/IDE/Session/Ghc.hs

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,59 @@
22
module Development.IDE.Session.Ghc where
33

44
import Control.Monad
5-
import Control.Monad.Extra as Extra
5+
import Control.Monad.Extra as Extra
66
import Control.Monad.IO.Class
7-
import qualified Crypto.Hash.SHA1 as H
8-
import qualified Data.ByteString.Base16 as B16
9-
import qualified Data.ByteString.Char8 as B
7+
import qualified Crypto.Hash.SHA1 as H
8+
import qualified Data.ByteString.Base16 as B16
9+
import qualified Data.ByteString.Char8 as B
1010
import Data.Function
1111
import Data.List
12-
import Data.List.Extra as L
13-
import Data.List.NonEmpty (NonEmpty (..))
14-
import qualified Data.List.NonEmpty as NE
15-
import qualified Data.Map.Strict as Map
12+
import Data.List.Extra as L
13+
import Data.List.NonEmpty (NonEmpty (..))
14+
import qualified Data.List.NonEmpty as NE
15+
import qualified Data.Map.Strict as Map
1616
import Data.Maybe
17-
import qualified Data.Text as T
18-
import Development.IDE.Core.Shake hiding (Log, knownTargets,
19-
withHieDb)
20-
import qualified Development.IDE.GHC.Compat as Compat
17+
import qualified Data.Text as T
18+
import Development.IDE.Core.Shake hiding (Log, knownTargets,
19+
withHieDb)
20+
import qualified Development.IDE.GHC.Compat as Compat
2121
import Development.IDE.GHC.Compat.CmdLine
22-
import Development.IDE.GHC.Compat.Core hiding (Target, TargetFile,
23-
TargetModule, Var,
24-
Warning, getOptions)
25-
import qualified Development.IDE.GHC.Compat.Core as GHC
26-
import Development.IDE.GHC.Compat.Env hiding (Logger)
27-
import Development.IDE.GHC.Compat.Units (UnitId)
22+
import Development.IDE.GHC.Compat.Core hiding (Target, TargetFile,
23+
TargetModule, Var, Warning,
24+
getOptions)
25+
import qualified Development.IDE.GHC.Compat.Core as GHC
26+
import Development.IDE.GHC.Compat.Env hiding (Logger)
27+
import Development.IDE.GHC.Compat.Units (UnitId)
2828
import Development.IDE.GHC.Util
2929
import Development.IDE.Types.Diagnostics
30-
import Development.IDE.Types.HscEnvEq (HscEnvEq, newHscEnvEq)
30+
import Development.IDE.Types.HscEnvEq (HscEnvEq, newHscEnvEq)
3131
import Development.IDE.Types.Location
3232
import GHC.ResponseFile
33-
import HIE.Bios.Environment hiding (getCacheDir)
34-
import HIE.Bios.Types hiding (Log)
35-
import Ide.Logger (Pretty (pretty),
36-
Priority (Debug, Error, Info),
37-
Recorder, WithPriority, logWith, viaShow, (<+>))
33+
import HIE.Bios.Environment hiding (getCacheDir)
34+
import HIE.Bios.Types hiding (Log)
35+
import Ide.Logger (Pretty (pretty),
36+
Priority (Debug, Error, Info),
37+
Recorder, WithPriority,
38+
logWith, viaShow, (<+>))
3839
import System.Directory
3940
import System.FilePath
4041
import System.Info
4142

4243

4344
import Control.DeepSeq
44-
import Control.Exception (evaluate)
45-
import Control.Monad.IO.Unlift (MonadUnliftIO)
46-
import qualified Data.Set as OS
47-
import qualified Development.IDE.GHC.Compat.Util as Compat
45+
import Control.Exception (evaluate)
46+
import Control.Monad.IO.Unlift (MonadUnliftIO)
47+
import qualified Data.Set as OS
48+
import qualified Development.IDE.GHC.Compat.Util as Compat
4849
import Development.IDE.Session.Dependency
50+
import Development.IDE.Types.Options
4951
import GHC.Data.Graph.Directed
50-
import Ide.PluginUtils (toAbsolute)
52+
import Ide.PluginUtils (toAbsolute)
5153

52-
import GHC.Driver.Env (hsc_all_home_unit_ids)
54+
import GHC.Driver.Env (hsc_all_home_unit_ids)
5355
import GHC.Driver.Errors.Types
54-
import GHC.Types.Error (errMsgDiagnostic,
55-
singleMessage)
56+
import GHC.Types.Error (errMsgDiagnostic,
57+
singleMessage)
5658
import GHC.Unit.State
5759

5860
data Log
@@ -192,12 +194,13 @@ newComponentCache recorder exts _cfp hsc_env old_cis new_cis = do
192194

193195
-- | Throws if package flags are unsatisfiable
194196
setOptions :: GhcMonad m
195-
=> NormalizedFilePath
197+
=> OptHaddockParse
198+
-> NormalizedFilePath
196199
-> ComponentOptions
197200
-> DynFlags
198201
-> FilePath -- ^ root dir, see Note [Root Directory]
199202
-> m (NonEmpty (DynFlags, [GHC.Target]))
200-
setOptions cfp (ComponentOptions theOpts compRoot _) dflags rootDir = do
203+
setOptions haddockOpt cfp (ComponentOptions theOpts compRoot _) dflags rootDir = do
201204
((theOpts',_errs,_warns),units) <- processCmdLineP unit_flags [] (map noLoc theOpts)
202205
case NE.nonEmpty units of
203206
Just us -> initMulti us
@@ -258,6 +261,7 @@ setOptions cfp (ComponentOptions theOpts compRoot _) dflags rootDir = do
258261
dontWriteHieFiles $
259262
setIgnoreInterfacePragmas $
260263
setBytecodeLinkerOptions $
264+
enableOptHaddock haddockOpt $
261265
disableOptimisation $
262266
Compat.setUpTypedHoles $
263267
makeDynFlagsAbsolute compRoot -- makeDynFlagsAbsolute already accounts for workingDirectory
@@ -318,6 +322,14 @@ setIgnoreInterfacePragmas df =
318322
disableOptimisation :: DynFlags -> DynFlags
319323
disableOptimisation df = updOptLevel 0 df
320324

325+
-- | We always compile with '-haddock' unless explicitly disabled.
326+
--
327+
-- This avoids inconsistencies when doing recompilation checking which was
328+
-- observed in https://github.com/haskell/haskell-language-server/issues/4511
329+
enableOptHaddock :: OptHaddockParse -> DynFlags -> DynFlags
330+
enableOptHaddock HaddockParse d = gopt_set d Opt_Haddock
331+
enableOptHaddock NoHaddockParse d = d
332+
321333
setHiDir :: FilePath -> DynFlags -> DynFlags
322334
setHiDir f d =
323335
-- override user settings to avoid conflicts leading to recompilation

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import Development.IDE.Graph
2828
import qualified Development.IDE.Spans.AtPoint as AtPoint
2929
import Development.IDE.Types.HscEnvEq (hscEnv)
3030
import Development.IDE.Types.Location
31+
import GHC.Iface.Ext.Types (Identifier)
3132
import qualified HieDb
3233
import Language.LSP.Protocol.Types (DocumentHighlight (..),
3334
SymbolInformation (..),

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ import qualified Data.Set as Set
109109
import qualified GHC as G
110110
import GHC.Core.Lint.Interactive
111111
import GHC.Driver.Config.CoreToStg.Prep
112+
import GHC.Iface.Ext.Types (HieASTs)
112113
import qualified GHC.Runtime.Loader as Loader
113114
import GHC.Tc.Gen.Splice
114115
import GHC.Types.Error
@@ -145,6 +146,7 @@ import Development.IDE.GHC.Compat hiding
145146
import qualified Data.List.NonEmpty as NE
146147
import Data.Time (getCurrentTime)
147148
import GHC.Driver.Env (hsc_all_home_unit_ids)
149+
import GHC.Iface.Ext.Types (NameEntityInfo)
148150
#endif
149151

150152
#if MIN_VERSION_ghc(9,12,0)

0 commit comments

Comments
 (0)