@@ -162,8 +162,12 @@ semanticTokensConfigTest =
162162 void waitForBuildQueue
163163 result1 <- docLspSemanticTokensString doc
164164 liftIO $ unlines (map show result1) @?=
165- T. unlines ([" 1:8-13 SemanticTokenTypes_Namespace \" Hello\" " | compilerVersion >= Version [9 , 10 ] [] ]
166- ++ [" 2:1-3 SemanticTokenTypes_Variable \" go\" " ])
165+ T. unlines ( [ " 1:1-7 SemanticTokenTypes_Keyword \" module\" " ]
166+ ++ [" 1:8-13 SemanticTokenTypes_Namespace \" Hello\" " | compilerVersion >= Version [9 , 10 ] [] ]
167+ ++ [ " 1:14-19 SemanticTokenTypes_Keyword \" where\" "
168+ , " 2:1-3 SemanticTokenTypes_Variable \" go\" "
169+ , " 2:6-7 SemanticTokenTypes_Keyword \" =\" "
170+ , " 2:8-9 SemanticTokenTypes_Number \" 1\" " ])
167171 ]
168172
169173
@@ -182,8 +186,8 @@ semanticTokensFullDeltaTests =
182186 testCase " add tokens" $ do
183187 let file1 = " TModuleA.hs"
184188 let expectDelta
185- | compilerVersion >= Version [9 , 10 ] [] = InR (InL (SemanticTokensDelta (Just " 1" ) [SemanticTokensEdit 25 0 ( Just [2 , 0 , 3 , 8 , 0 ]) ]))
186- | otherwise = InR (InL (SemanticTokensDelta ( Just " 1" ) [SemanticTokensEdit 20 0 ( Just [2 , 0 , 3 , 8 , 0 ])] ))
189+ | compilerVersion >= Version [9 , 10 ] [] = InR (InL (SemanticTokensDelta (Just " 1" ) [SemanticTokensEdit {_start = 60 , _deleteCount = 0 , _data_ = Just [2 ,0 , 3 , 8 , 0 , 0 , 4 , 1 , 15 , 0 , 0 , 2 , 1 , 19 , 0 ]} ]))
190+ | otherwise = InR (InL (SemanticTokensDelta {_resultId = Just " 1" , _edits = [SemanticTokensEdit {_start = 55 , _deleteCount = 0 , _data_ = Just [2 ,0 , 3 , 8 , 0 , 0 , 4 , 1 , 15 , 0 , 0 , 2 , 1 , 19 , 0 ]}]} ))
187191 -- r c l t m
188192 -- where r = row, c = column, l = length, t = token, m = modifier
189193 Test.Hls. runSessionWithServerInTmpDir def semanticTokensPlugin (mkFs $ FS. directProjectMulti [file1]) $ do
@@ -203,8 +207,8 @@ semanticTokensFullDeltaTests =
203207 testCase " remove tokens" $ do
204208 let file1 = " TModuleA.hs"
205209 let expectDelta
206- | compilerVersion >= Version [9 , 10 ] [] = InR (InL (SemanticTokensDelta ( Just " 1" ) [SemanticTokensEdit 5 20 ( Just [] )] ))
207- | otherwise = InR (InL (SemanticTokensDelta ( Just " 1" ) [SemanticTokensEdit 0 20 ( Just [] )] ))
210+ | compilerVersion >= Version [9 , 10 ] [] = InR (InL (SemanticTokensDelta {_resultId = Just " 1" , _edits = [SemanticTokensEdit {_start = 21 , _deleteCount = 12 , _data_ = Just [] }, SemanticTokensEdit {_start = 34 , _deleteCount = 3 , _data_ = Just [] }, SemanticTokensEdit {_start = 41 , _deleteCount = 0 , _data_ = Just [ 7 ]}, SemanticTokensEdit {_start = 42 , _deleteCount = 2 , _data_ = Just [ 15 ]}, SemanticTokensEdit {_start = 46 , _deleteCount = 1 , _data_ = Just [ 5 ]}, SemanticTokensEdit {_start = 51 , _deleteCount = 6 , _data_ = Just [6 ]}]} ))
211+ | otherwise = InR (InL (SemanticTokensDelta {_resultId = Just " 1" , _edits = [SemanticTokensEdit {_start = 16 , _deleteCount = 12 , _data_ = Just [] }, SemanticTokensEdit {_start = 29 , _deleteCount = 3 , _data_ = Just [] }, SemanticTokensEdit {_start = 36 , _deleteCount = 0 , _data_ = Just [7 ]}, SemanticTokensEdit {_start = 37 , _deleteCount = 2 , _data_ = Just [ 15 ]}, SemanticTokensEdit {_start = 41 , _deleteCount = 1 , _data_ = Just [ 5 ]}, SemanticTokensEdit {_start = 46 , _deleteCount = 6 , _data_ = Just [ 6 ]}]} ))
208212 -- delete all tokens
209213 Test.Hls. runSessionWithServerInTmpDir def semanticTokensPlugin (mkFs $ FS. directProjectMulti [file1]) $ do
210214 doc1 <- openDoc file1 " haskell"
@@ -244,19 +248,26 @@ semanticTokensTests =
244248 let expect =
245249 unlines
246250 (
251+ [ " [1:1-7 HsSyntacticTokenType TKeyword \" module\" ]" ]
247252 -- > 9.10 have module name in the token
248- ([" 1:8-16 TModule \" TModuleB\" " | compilerVersion >= Version [9 , 10 ] [] ])
249- ++
250- [
251- " 3:8-16 TModule \" TModuleA\" " ,
252- " 4:18-26 TModule \" TModuleA\" " ,
253- " 6:1-3 TVariable \" go\" " ,
254- " 6:6-10 TDataConstructor \" Game\" " ,
255- " 8:1-5 TVariable \" a\\ 66560bb\" " ,
256- " 8:8-17 TModule \" TModuleA.\" " ,
257- " 8:17-20 TRecordField \" a\\ 66560b\" " ,
258- " 8:21-23 TVariable \" go\" "
259- ])
253+ ++ [" [1:8-16 HsSemanticTokenType TModule \" TModuleB\" ]" | compilerVersion >= Version [9 , 10 ] [] ]
254+ ++ [ " [1:17-22 HsSyntacticTokenType TKeyword \" where\" ]"
255+ , " [3:1-7 HsSyntacticTokenType TKeyword \" import\" ]"
256+ , " [3:8-16 HsSemanticTokenType TModule \" TModuleA\" ]"
257+ , " [4:1-7 HsSyntacticTokenType TKeyword \" import\" ]"
258+ , " [4:8-17 HsSyntacticTokenType TKeyword \" qualified\" ]"
259+ , " [4:18-26 HsSemanticTokenType TModule \" TModuleA\" ]"
260+ , " [6:1-3 HsSemanticTokenType TVariable \" go\" ]"
261+ , " [6:4-5 HsSyntacticTokenType TKeyword \" =\" ]"
262+ , " [6:6-10 HsSemanticTokenType TDataConstructor \" Game\" ]"
263+ , " [6:11-12 HsSyntacticTokenType TNumberLit \" 1\" ]"
264+ , " [8:1-5 HsSemanticTokenType TVariable \" a\\ 66560bb\" ]"
265+ , " [8:5-6 HsSyntacticTokenType TKeyword \" \" ]"
266+ , " [8:8-17 HsSemanticTokenType TModule \" TModuleA.\" ]"
267+ , " [8:17-20 HsSyntacticTokenType TRecordSelector \" a\\ 66560b\" ,8:17-20 HsSemanticTokenType TRecordField \" a\\ 66560b\" ]"
268+ , " [8:21-23 HsSemanticTokenType TVariable \" go\" ]"
269+ ]
270+ )
260271 liftIO $ result @?= expect,
261272 goldenWithSemanticTokensWithDefaultConfig " mixed constancy test result generated from one ghc version" " T1" ,
262273 goldenWithSemanticTokensWithDefaultConfig " pattern bind" " TPatternSynonym" ,
0 commit comments