Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 7e36aa3

Browse files
authored
Merge pull request #1402 from alanz/haskell-lsp-0.16
Haskell lsp 0.16
2 parents 5385087 + c281205 commit 7e36aa3

19 files changed

+53
-52
lines changed

haskell-ide-engine.cabal

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ library
7171
, gitrev >= 1.1
7272
, haddock-api
7373
, haddock-library
74-
, haskell-lsp == 0.15.*
75-
, haskell-lsp-types == 0.15.*
74+
, haskell-lsp == 0.16.*
75+
, haskell-lsp-types == 0.16.*
7676
, haskell-src-exts
7777
, hie-plugin-api
7878
, hoogle >= 5.0.13
@@ -199,7 +199,7 @@ test-suite unit-test
199199
, free
200200
, ghc
201201
, haskell-ide-engine
202-
, haskell-lsp-types >= 0.15.0.0
202+
, haskell-lsp-types == 0.16.*
203203
, hie-test-utils
204204
, hie-plugin-api
205205
, hoogle > 5.0.11
@@ -287,8 +287,8 @@ test-suite func-test
287287
, filepath
288288
, lsp-test >= 0.6.0.0
289289
, haskell-ide-engine
290-
, haskell-lsp-types == 0.15.*
291-
, haskell-lsp == 0.15.*
290+
, haskell-lsp-types == 0.16.*
291+
, haskell-lsp == 0.16.*
292292
, hie-test-utils
293293
, hie-plugin-api
294294
, hspec

hie-plugin-api/hie-plugin-api.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ library
4545
, ghc
4646
, ghc-mod-core >= 5.9.0.0
4747
, ghc-project-types >= 5.9.0.0
48-
, haskell-lsp == 0.15.*
48+
, haskell-lsp == 0.16.*
4949
, hslogger
5050
, monad-control
5151
, mtl

src/Haskell/Ide/Engine/Plugin/ApplyRefact.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ parseErrorToDiagnostic (Hlint.ParseError l msg contents) =
148148
[Diagnostic
149149
{ _range = srcLoc2Range l
150150
, _severity = Just DsInfo -- Not displayed
151-
, _code = Just "parser"
151+
, _code = Just (LSP.StringValue "parser")
152152
, _source = Just "hlint"
153153
, _message = T.unlines [T.pack msg,T.pack contents]
154154
, _relatedInformation = Nothing
@@ -192,7 +192,7 @@ hintToDiagnostic idea
192192
= Diagnostic
193193
{ _range = ss2Range (ideaSpan idea)
194194
, _severity = Just (hintSeverityMap $ ideaSeverity idea)
195-
, _code = Just (T.pack $ ideaHint idea)
195+
, _code = Just (LSP.StringValue $ T.pack $ ideaHint idea)
196196
, _source = Just "hlint"
197197
, _message = idea2Message idea
198198
, _relatedInformation = Nothing
@@ -315,7 +315,7 @@ codeActionProvider plId docId _ context = IdeResultOk <$> hlintActions
315315
hlintActions = catMaybes <$> mapM mkHlintAction (filter validCommand diags)
316316

317317
-- |Some hints do not have an associated refactoring
318-
validCommand (LSP.Diagnostic _ _ (Just code) (Just "hlint") _ _) =
318+
validCommand (LSP.Diagnostic _ _ (Just (LSP.StringValue code)) (Just "hlint") _ _) =
319319
case code of
320320
"Eta reduce" -> False
321321
_ -> True
@@ -324,7 +324,7 @@ codeActionProvider plId docId _ context = IdeResultOk <$> hlintActions
324324
LSP.List diags = context ^. LSP.diagnostics
325325

326326
mkHlintAction :: LSP.Diagnostic -> IdeM (Maybe LSP.CodeAction)
327-
mkHlintAction diag@(LSP.Diagnostic (LSP.Range start _) _s (Just code) (Just "hlint") m _) =
327+
mkHlintAction diag@(LSP.Diagnostic (LSP.Range start _) _s (Just (LSP.StringValue code)) (Just "hlint") m _) =
328328
Just . codeAction <$> mkLspCommand plId "applyOne" title (Just args)
329329
where
330330
codeAction cmd = LSP.CodeAction title (Just LSP.CodeActionRefactor) (Just (LSP.List [diag])) Nothing (Just cmd)

stack-8.2.2.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ extra-deps:
2020
- ghc-exactprint-0.5.8.2
2121
- haddock-api-2.18.1
2222
- haddock-library-1.4.4
23-
- haskell-lsp-0.15.0.0
24-
- haskell-lsp-types-0.15.0.0
23+
- haskell-lsp-0.16.0.0
24+
- haskell-lsp-types-0.16.0.0
2525
- haskell-src-exts-1.21.0
2626
- haskell-src-exts-util-0.2.5
2727
- hlint-2.1.17 # last hlint supporting GHC 8.2
2828
- hoogle-5.0.17.9
2929
- hsimport-0.8.8
30-
- lsp-test-0.6.0.0
30+
- lsp-test-0.7.0.0
3131
- monad-dijkstra-0.1.1.2
3232
- pretty-show-1.8.2
3333
- rope-utf16-splay-0.3.1.0

stack-8.4.2.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ extra-deps:
1919
- ghc-lib-parser-8.8.0.20190723
2020
- haddock-api-2.20.0
2121
- haddock-library-1.6.0
22-
- haskell-lsp-0.15.0.0
23-
- haskell-lsp-types-0.15.0.0
22+
- haskell-lsp-0.16.0.0
23+
- haskell-lsp-types-0.16.0.0
2424
- haskell-src-exts-1.21.0
2525
- haskell-src-exts-util-0.2.5
2626
- hlint-2.2.2
2727
- hoogle-5.0.17.9
2828
- hsimport-0.10.0
29-
- lsp-test-0.6.0.0
29+
- lsp-test-0.7.0.0
3030
- monad-dijkstra-0.1.1.2
3131
- pretty-show-1.8.2
3232
- rope-utf16-splay-0.3.1.0

stack-8.4.3.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ extra-deps:
1919
- ghc-lib-parser-8.8.0.20190723
2020
- haddock-api-2.20.0
2121
- haddock-library-1.6.0
22-
- haskell-lsp-0.15.0.0
23-
- haskell-lsp-types-0.15.0.0
22+
- haskell-lsp-0.16.0.0
23+
- haskell-lsp-types-0.16.0.0
2424
- haskell-src-exts-1.21.0
2525
- haskell-src-exts-util-0.2.5
2626
- hlint-2.2.2
2727
- hoogle-5.0.17.9
2828
- hsimport-0.10.0
29-
- lsp-test-0.6.0.0
29+
- lsp-test-0.7.0.0
3030
- monad-dijkstra-0.1.1.2
3131
- pretty-show-1.8.2
3232
- rope-utf16-splay-0.3.1.0

stack-8.4.4.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ extra-deps:
1818
- ghc-lib-parser-8.8.0.20190723
1919
- haddock-api-2.20.0
2020
- haddock-library-1.6.0
21-
- haskell-lsp-0.15.0.0
22-
- haskell-lsp-types-0.15.0.0
21+
- haskell-lsp-0.16.0.0
22+
- haskell-lsp-types-0.16.0.0
2323
- haskell-src-exts-1.21.0
2424
- haskell-src-exts-util-0.2.5
2525
- hlint-2.2.2
2626
- hoogle-5.0.17.9
2727
- hsimport-0.10.0
28-
- lsp-test-0.6.0.0
28+
- lsp-test-0.7.0.0
2929
- monad-dijkstra-0.1.1.2
3030
- optparse-simple-0.1.0
3131
- pretty-show-1.9.5

stack-8.6.1.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ extra-deps:
2121
- floskell-0.10.0
2222
- ghc-lib-parser-8.8.0.20190723
2323
- haddock-api-2.21.0
24-
- haskell-lsp-0.15.0.0
25-
- haskell-lsp-types-0.15.0.0
24+
- haskell-lsp-0.16.0.0
25+
- haskell-lsp-types-0.16.0.0
2626
- haskell-src-exts-1.21.0
2727
- haskell-src-exts-util-0.2.5
2828
- hlint-2.2.2
2929
- hoogle-5.0.17.9
3030
- hsimport-0.10.0
31-
- lsp-test-0.6.0.0
31+
- lsp-test-0.7.0.0
3232
- monad-dijkstra-0.1.1.2
3333
- monad-memo-0.4.1
3434
- monoid-subclasses-0.4.6.1

stack-8.6.2.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ extra-deps:
1717
- floskell-0.10.0
1818
- ghc-lib-parser-8.8.0.20190723
1919
- haddock-api-2.21.0
20-
- haskell-lsp-0.15.0.0
21-
- haskell-lsp-types-0.15.0.0
20+
- haskell-lsp-0.16.0.0
21+
- haskell-lsp-types-0.16.0.0
2222
- haskell-src-exts-1.21.0
2323
- haskell-src-exts-util-0.2.5
2424
- hlint-2.2.2
2525
- hoogle-5.0.17.9
2626
- hsimport-0.10.0
27-
- lsp-test-0.6.0.0
27+
- lsp-test-0.7.0.0
2828
- monad-dijkstra-0.1.1.2
2929
- monad-memo-0.4.1
3030
- multistate-0.8.0.1

stack-8.6.3.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ extra-deps:
1717
- floskell-0.10.0
1818
- ghc-lib-parser-8.8.0.20190723
1919
- haddock-api-2.21.0
20-
- haskell-lsp-0.15.0.0
21-
- haskell-lsp-types-0.15.0.0
20+
- haskell-lsp-0.16.0.0
21+
- haskell-lsp-types-0.16.0.0
2222
- haskell-src-exts-1.21.0
2323
- haskell-src-exts-util-0.2.5
2424
- hlint-2.2.2
2525
- hoogle-5.0.17.9
2626
- hsimport-0.10.0
27-
- lsp-test-0.6.0.0
27+
- lsp-test-0.7.0.0
2828
- monad-dijkstra-0.1.1.2
2929
- monad-memo-0.4.1
3030
- multistate-0.8.0.1

stack-8.6.4.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ extra-deps:
1717
- floskell-0.10.0
1818
- ghc-lib-parser-8.8.0.20190723
1919
- haddock-api-2.22.0
20-
- haskell-lsp-0.15.0.0
21-
- haskell-lsp-types-0.15.0.0
20+
- haskell-lsp-0.16.0.0
21+
- haskell-lsp-types-0.16.0.0
2222
- haskell-src-exts-1.21.0
2323
- hlint-2.2.2
2424
- hoogle-5.0.17.9
2525
- hsimport-0.10.0
26-
- lsp-test-0.6.0.0
26+
- lsp-test-0.7.0.0
2727
- monad-dijkstra-0.1.1.2@rev:1
2828
- monad-memo-0.4.1
2929
- multistate-0.8.0.1

stack-8.6.5.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ extra-deps:
1717
- floskell-0.10.0
1818
- ghc-lib-parser-8.8.0.20190723
1919
- haddock-api-2.22.0
20-
- haskell-lsp-0.15.0.0
21-
- haskell-lsp-types-0.15.0.0
20+
- haskell-lsp-0.16.0.0
21+
- haskell-lsp-types-0.16.0.0
2222
- haskell-src-exts-1.21.0
2323
- hlint-2.2.2
2424
- hsimport-0.10.0
2525
- hoogle-5.0.17.9
26-
- lsp-test-0.6.0.0
26+
- lsp-test-0.7.0.0
2727
- monad-dijkstra-0.1.1.2@rev:1
2828
- monad-memo-0.4.1
2929
- multistate-0.8.0.1

stack.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ extra-deps:
1818
- floskell-0.10.1
1919
- ghc-lib-parser-8.8.0.20190723
2020
- haddock-api-2.22.0
21-
- haskell-lsp-0.15.0.0
22-
- haskell-lsp-types-0.15.0.0
21+
- haskell-lsp-0.16.0.0
22+
- haskell-lsp-types-0.16.0.0
2323
- hlint-2.2.2
2424
- hsimport-0.10.0
25-
- lsp-test-0.6.0.0
25+
- lsp-test-0.7.0.0
2626
- monad-dijkstra-0.1.1.2@rev:1
2727
- syz-0.2.0.0
2828
- temporary-1.2.1.1

test/dispatcher/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ funcSpec = describe "functional dispatch" $ do
249249
[ Diagnostic
250250
(Range (Position 9 6) (Position 10 18))
251251
(Just DsInfo)
252-
(Just "Redundant do")
252+
(Just (StringValue "Redundant do"))
253253
(Just "hlint")
254254
"Redundant do\nFound:\n do putStrLn \"hello\"\nWhy not:\n putStrLn \"hello\"\n"
255255
Nothing

test/functional/DeferredSpec.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ spec = do
115115
[ Diagnostic
116116
(Range (Position 9 6) (Position 10 18))
117117
(Just DsInfo)
118-
(Just "Redundant do")
118+
(Just (StringValue "Redundant do"))
119119
(Just "hlint")
120120
"Redundant do\nFound:\n do putStrLn \"hello\"\nWhy not:\n putStrLn \"hello\"\n"
121121
Nothing

test/functional/DiagnosticsSpec.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ spec = describe "diagnostics providers" $ do
3535
length diags `shouldBe` 2
3636
reduceDiag ^. LSP.range `shouldBe` Range (Position 1 0) (Position 1 12)
3737
reduceDiag ^. LSP.severity `shouldBe` Just DsInfo
38-
reduceDiag ^. LSP.code `shouldBe` Just "Eta reduce"
38+
reduceDiag ^. LSP.code `shouldBe` Just (StringValue "Eta reduce")
3939
reduceDiag ^. LSP.source `shouldBe` Just "hlint"
4040

4141
diags2a <- waitForDiagnostics

test/functional/FunctionalCodeActionsSpec.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spec = describe "code actions" $ do
3434
length diags `shouldBe` 2
3535
reduceDiag ^. L.range `shouldBe` Range (Position 1 0) (Position 1 12)
3636
reduceDiag ^. L.severity `shouldBe` Just DsInfo
37-
reduceDiag ^. L.code `shouldBe` Just "Eta reduce"
37+
reduceDiag ^. L.code `shouldBe` Just (StringValue "Eta reduce")
3838
reduceDiag ^. L.source `shouldBe` Just "hlint"
3939

4040
(CACodeAction ca:_) <- getAllCodeActions doc
@@ -79,7 +79,7 @@ spec = describe "code actions" $ do
7979
length diags `shouldBe` 2
8080
reduceDiag ^. L.range `shouldBe` Range (Position 1 0) (Position 1 12)
8181
reduceDiag ^. L.severity `shouldBe` Just DsInfo
82-
reduceDiag ^. L.code `shouldBe` Just "Eta reduce"
82+
reduceDiag ^. L.code `shouldBe` Just (StringValue "Eta reduce")
8383
reduceDiag ^. L.source `shouldBe` Just "hlint"
8484

8585
(CACodeAction ca:_) <- getAllCodeActions doc

test/functional/FunctionalLiquidSpec.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ spec = describe "liquid haskell diagnostics" $ do
3333
length diags `shouldBe` 2
3434
reduceDiag ^. range `shouldBe` Range (Position 5 18) (Position 5 22)
3535
reduceDiag ^. severity `shouldBe` Just DsHint
36-
reduceDiag ^. code `shouldBe` Just "Use negate"
36+
reduceDiag ^. code `shouldBe` Just (StringValue "Use negate")
3737
reduceDiag ^. source `shouldBe` Just "hlint"
3838

3939
-- liftIO $ putStrLn "b"
@@ -77,7 +77,7 @@ spec = describe "liquid haskell diagnostics" $ do
7777
length diags `shouldBe` 2
7878
reduceDiag ^. range `shouldBe` Range (Position 5 18) (Position 5 22)
7979
reduceDiag ^. severity `shouldBe` Just DsHint
80-
reduceDiag ^. code `shouldBe` Just "Use negate"
80+
reduceDiag ^. code `shouldBe` Just (StringValue "Use negate")
8181
reduceDiag ^. source `shouldBe` Just "hlint"
8282

8383
-- Enable liquid haskell plugin and disable hlint

test/unit/ApplyRefactPluginSpec.hs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import qualified Data.Text as T
88
import Haskell.Ide.Engine.Plugin.ApplyRefact
99
import Haskell.Ide.Engine.MonadTypes
1010
import Haskell.Ide.Engine.PluginUtils
11+
import Language.Haskell.LSP.Types
1112
import System.Directory
1213
import TestUtils
1314

@@ -74,13 +75,13 @@ applyRefactSpec = do
7475
, _diagnostics = List $
7576
[ Diagnostic (Range (Position 1 7) (Position 1 25))
7677
(Just DsHint)
77-
(Just "Redundant bracket")
78+
(Just (StringValue "Redundant bracket"))
7879
(Just "hlint")
7980
"Redundant bracket\nFound:\n (putStrLn \"hello\")\nWhy not:\n putStrLn \"hello\"\n"
8081
Nothing
8182
, Diagnostic (Range (Position 3 8) (Position 3 15))
8283
(Just DsHint)
83-
(Just "Redundant bracket")
84+
(Just (StringValue "Redundant bracket"))
8485
(Just "hlint")
8586
"Redundant bracket\nFound:\n (x + 1)\nWhy not:\n x + 1\n"
8687
Nothing
@@ -103,15 +104,15 @@ applyRefactSpec = do
103104
[Diagnostic {_range = Range { _start = Position {_line = 12, _character = 23}
104105
, _end = Position {_line = 12, _character = 100000}}
105106
, _severity = Just DsInfo
106-
, _code = Just "parser"
107+
, _code = Just (StringValue "parser")
107108
, _source = Just "hlint"
108109
, _message = T.pack filePathNoUri <> ":13:24: error:\n Operator applied to too few arguments: +\n data instance Sing (z :: (a :~: b)) where\n> SRefl :: Sing Refl +\n\n"
109110
, _relatedInformation = Nothing }]}
110111
#elif (defined(MIN_VERSION_GLASGOW_HASKELL) && (MIN_VERSION_GLASGOW_HASKELL(8,2,2,0)))
111112
[Diagnostic {_range = Range { _start = Position {_line = 13, _character = 0}
112113
, _end = Position {_line = 13, _character = 100000}}
113114
, _severity = Just DsInfo
114-
, _code = Just "parser"
115+
, _code = Just (StringValue "parser")
115116
, _source = Just "hlint"
116117
, _message = "Parse error: virtual }\n data instance Sing (z :: (a :~: b)) where\n SRefl :: Sing Refl +\n> \n\n"
117118
, _relatedInformation = Nothing }]}
@@ -140,7 +141,7 @@ applyRefactSpec = do
140141
, _diagnostics = List
141142
[ Diagnostic (Range (Position 3 11) (Position 3 20))
142143
(Just DsInfo)
143-
(Just "Redundant bracket")
144+
(Just (StringValue "Redundant bracket"))
144145
(Just "hlint")
145146
"Redundant bracket\nFound:\n (\"hello\")\nWhy not:\n \"hello\"\n"
146147
Nothing

0 commit comments

Comments
 (0)