Skip to content

Commit ad55e20

Browse files
authored
Add haskell-language-server-2.2.0.0 (#2038)
* Add haskell-language-server-2.2.0.0 * Patch ghcide-2.2 for GHC 8.10.7
1 parent 8d3f93b commit ad55e20

File tree

6 files changed

+106
-1
lines changed

6 files changed

+106
-1
lines changed

build.nix

+5
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ in rec {
6262
inherit evalPackages;
6363
src = pkgs.haskell-nix.sources."hls-2.0";
6464
};
65+
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.8" < 0) {
66+
"hls-22" = tool compiler-nix-name "haskell-language-server" {
67+
inherit evalPackages;
68+
src = pkgs.haskell-nix.sources."hls-2.2";
69+
};
6570
})
6671
);
6772

flake.lock

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
flake-utils = { url = "github:numtide/flake-utils"; };
1515
"hls-1.10" = { url = "github:haskell/haskell-language-server/1.10.0.0"; flake = false; };
1616
"hls-2.0" = { url = "github:haskell/haskell-language-server/2.0.0.1"; flake = false; };
17+
"hls-2.2" = { url = "github:haskell/haskell-language-server/2.2.0.0"; flake = false; };
1718
hydra.url = "hydra";
1819
hackage = {
1920
url = "github:input-output-hk/hackage.nix";

modules/configuration-nix.nix

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ in {
9191
[
9292
(fromUntil "1.7.0.0" "1.8.0.0" ../patches/ghcide-1.7-unboxed-tuple-fix-issue-1455.patch)
9393
(fromUntil "1.8.0.0" "2.1.0.0" ../patches/ghcide-1.8-unboxed-tuple-fix-issue-1455.patch)
94+
(fromUntil "2.2.0.0" "2.3.0.0" ../patches/ghcide-2.2-unboxed-tuple-fix-issue-1455.patch)
9495
]
9596
# This is needed for a patch only applied to ghc810420210212
9697
++ pkgs.lib.optional (__elem config.compiler.nix-name [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
diff --git a/src/Development/IDE/Core/Compile.hs b/src/Development/IDE/Core/Compile.hs
2+
index 2b355639..84b77e8a 100644
3+
--- a/src/Development/IDE/Core/Compile.hs
4+
+++ b/src/Development/IDE/Core/Compile.hs
5+
@@ -154,6 +154,15 @@ import GHC.Driver.Config.CoreToStg.Prep
6+
import GHC.Core.Lint.Interactive
7+
#endif
8+
9+
+import StgSyn
10+
+import FastString
11+
+import Unique
12+
+import CostCentre
13+
+import Data.Either
14+
+import CoreSyn
15+
+import CoreToStg
16+
+import SimplStg
17+
+
18+
--Simple constants to make sure the source is consistently named
19+
sourceTypecheck :: T.Text
20+
sourceTypecheck = "typecheck"
21+
@@ -294,9 +303,38 @@ captureSplicesAndDeps TypecheckHelpers{..} env k = do
22+
stg_expr
23+
[] Nothing
24+
#else
25+
+ {- Create a temporary binding and convert to STG -}
26+
+ ; let bco_tmp_id = mkSysLocal (fsLit "BCO_toplevel")
27+
+ (mkPseudoUniqueE 0)
28+
+ (exprType prepd_expr)
29+
+ ; (binds, _) <-
30+
+ myCoreToStg hsc_env
31+
+ (icInteractiveModule (hsc_IC hsc_env))
32+
+ [NonRec bco_tmp_id prepd_expr]
33+
+
34+
+ ; let (_strings, lifted_binds) = partitionEithers $ do -- list monad
35+
+ bnd <- binds
36+
+ case bnd of
37+
+ StgTopLifted (StgNonRec i expr) -> [Right (i, expr)]
38+
+ StgTopLifted (StgRec bnds) -> map Right bnds
39+
+ StgTopStringLit b str -> [Left (b, str)]
40+
+
41+
+ ; let stg_expr = case lifted_binds of
42+
+ [(_i, e)] -> e
43+
+ _ ->
44+
+ StgRhsClosure noExtFieldSilent
45+
+ dontCareCCS
46+
+ ReEntrant
47+
+ []
48+
+ (StgLet noExtFieldSilent
49+
+ (StgRec lifted_binds)
50+
+ (StgApp bco_tmp_id []))
51+
+
52+
{- Convert to BCOs -}
53+
; bcos <- coreExprToBCOs hsc_env
54+
- (icInteractiveModule (hsc_IC hsc_env)) prepd_expr
55+
+ (icInteractiveModule (hsc_IC hsc_env))
56+
+ bco_tmp_id
57+
+ stg_expr
58+
#endif
59+
60+
-- Exclude wired-in names because we may not have read
61+
@@ -1747,6 +1785,19 @@ pathToModuleName = mkModuleName . map rep
62+
rep ':' = '_'
63+
rep c = c
64+
65+
+myCoreToStg :: HscEnv -> Module -> CoreProgram
66+
+ -> IO ( [StgTopBinding] -- output program
67+
+ , CollectedCCs ) -- CAF cost centre info (declared and used)
68+
+myCoreToStg hsc_env this_mod prepd_binds = do
69+
+ let (stg_binds, cost_centre_info)
70+
+ = {-# SCC "Core2Stg" #-}
71+
+ coreToStg (hsc_dflags hsc_env) this_mod prepd_binds
72+
+ stg_binds2
73+
+ <- {-# SCC "Stg2Stg" #-}
74+
+ stg2stg hsc_env this_mod stg_binds
75+
+
76+
+ return (stg_binds2, cost_centre_info)
77+
+
78+
{- Note [Guidelines For Using CPP In GHCIDE Import Statements]
79+
GHCIDE's interface with GHC is extensive, and unfortunately, because we have
80+
to work with multiple versions of GHC, we have several files that need to use

test/haskell-language-server/cabal.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ let
33
project = haskell-nix.cabalProject' {
44
inherit compiler-nix-name evalPackages;
55
name = "haskell-language-server";
6-
src = haskell-nix.sources."hls-2.0";
6+
src = haskell-nix.sources."hls-2.2";
77
configureArgs = "--disable-benchmarks --disable-tests";
88
};
99
in recurseIntoAttrs {

0 commit comments

Comments
 (0)