File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,22 @@ tests = testGroup "completions" [
84
84
compls <- getCompletions doc (Position 5 7 )
85
85
liftIO $ assertBool " Expected completions" $ not $ null compls
86
86
87
+ , testGroup " recorddotsyntax"
88
+ [ testCase " shows field selectors" $ runSession hlsCommand fullCaps " test/testdata/completion" $ do
89
+ doc <- openDoc " RecordDotSyntax.hs" " haskell"
90
+
91
+ let te = TextEdit (Range (Position 25 0 ) (Position 25 5 )) " z = x.a"
92
+ _ <- applyEdit doc te
93
+
94
+ compls <- getCompletions doc (Position 25 6 )
95
+ item <- getCompletionByLabel " a" compls
96
+ liftIO $ do
97
+ item ^. label @?= " a"
98
+ -- item ^. detail @?= Just "Data.List" TODO
99
+ -- item ^. kind @?= Just CiModule
100
+ liftIO $ length compls @?= 6
101
+ ]
102
+
87
103
-- See https://github.com/haskell/haskell-ide-engine/issues/903
88
104
, testCase " strips compiler generated stuff from completions" $ runSession hlsCommand fullCaps " test/testdata/completion" $ do
89
105
doc <- openDoc " DupRecFields.hs" " haskell"
Original file line number Diff line number Diff line change
1
+ {-# LANGUAGE OverloadedRecordDot #-}
2
+ {-# LANGUAGE DuplicateRecordFields #-}
3
+ {-# LANGUAGE NoFieldSelectors #-}
4
+
5
+ module Test where
6
+
7
+ import qualified Data.Maybe as M
8
+
9
+ data MyRecord = MyRecord1
10
+ { a :: String
11
+ , b :: Integer
12
+ , c :: MyChild
13
+ }
14
+ | MyRecord2 { a2 :: String
15
+ , b2 :: Integer
16
+ , c2 :: MyChild
17
+ } deriving (Eq , Show )
18
+
19
+ newtype MyChild = MyChild
20
+ { z :: String
21
+ } deriving (Eq , Show )
22
+
23
+ x = MyRecord1 { a = " Hello" , b = 12 , c = MyChild { z = " there" } }
24
+
25
+ y = x. a ++ show x. b
26
+
27
+
You can’t perform that action at this time.
0 commit comments