@@ -76,20 +76,20 @@ goldenWithHaskellAndCapsOutPut config plugin title tree path desc act =
76
76
void waitForBuildQueue
77
77
act doc
78
78
79
- goldenWithSemanticTokens :: TestName -> FilePath -> TestTree
80
- goldenWithSemanticTokens title path =
79
+ goldenWithSemanticTokensWithDefaultConfig :: TestName -> FilePath -> TestTree
80
+ goldenWithSemanticTokensWithDefaultConfig title path =
81
81
goldenWithHaskellAndCapsOutPut
82
82
def
83
83
semanticTokensPlugin
84
84
title
85
85
(mkFs $ FS. directProject (path <.> " hs" ))
86
86
path
87
87
" expected"
88
- docSemanticTokensString
88
+ ( docSemanticTokensString def)
89
89
90
- docSemanticTokensString :: TextDocumentIdentifier -> Session String
91
- docSemanticTokensString doc = do
92
- xs <- map fromLspTokenTypeStrict <$> docLspSemanticTokensString doc
90
+ docSemanticTokensString :: SemanticTokensConfig -> TextDocumentIdentifier -> Session String
91
+ docSemanticTokensString cf doc = do
92
+ xs <- map (lspTokenHsToken cf) <$> docLspSemanticTokensString doc
93
93
return $ unlines . map show $ xs
94
94
95
95
docLspSemanticTokensString :: TextDocumentIdentifier -> Session [SemanticTokenOriginal Language.LSP.Protocol.Types. SemanticTokenTypes ]
@@ -106,19 +106,19 @@ semanticTokensClassTests :: TestTree
106
106
semanticTokensClassTests =
107
107
testGroup
108
108
" type class"
109
- [ goldenWithSemanticTokens " golden type class" " TClass" ,
110
- goldenWithSemanticTokens " imported class method InstanceClassMethodBind" " TInstanceClassMethodBind" ,
111
- goldenWithSemanticTokens " imported class method TInstanceClassMethodUse" " TInstanceClassMethodUse" ,
112
- goldenWithSemanticTokens " imported deriving" " TClassImportedDeriving"
109
+ [ goldenWithSemanticTokensWithDefaultConfig " golden type class" " TClass" ,
110
+ goldenWithSemanticTokensWithDefaultConfig " imported class method InstanceClassMethodBind" " TInstanceClassMethodBind" ,
111
+ goldenWithSemanticTokensWithDefaultConfig " imported class method TInstanceClassMethodUse" " TInstanceClassMethodUse" ,
112
+ goldenWithSemanticTokensWithDefaultConfig " imported deriving" " TClassImportedDeriving"
113
113
]
114
114
115
115
semanticTokensValuePatternTests :: TestTree
116
116
semanticTokensValuePatternTests =
117
117
testGroup
118
118
" value and patterns "
119
- [ goldenWithSemanticTokens " value bind" " TValBind" ,
120
- goldenWithSemanticTokens " pattern match" " TPatternMatch" ,
121
- goldenWithSemanticTokens " pattern bind" " TPatternbind"
119
+ [ goldenWithSemanticTokensWithDefaultConfig " value bind" " TValBind" ,
120
+ goldenWithSemanticTokensWithDefaultConfig " pattern match" " TPatternMatch" ,
121
+ goldenWithSemanticTokensWithDefaultConfig " pattern bind" " TPatternbind"
122
122
]
123
123
124
124
mkSemanticConfig :: Value -> Config
@@ -187,35 +187,35 @@ semanticTokensTests =
187
187
either
188
188
(error . show )
189
189
(\ xs -> liftIO $ xs @?= expect)
190
- $ recoverSemanticTokens vfs tokens
190
+ $ recoverSemanticTokens def vfs tokens
191
191
return ()
192
192
_ -> error " No tokens found"
193
193
liftIO $ 1 @?= 1 ,
194
- goldenWithSemanticTokens " mixed constancy test result generated from one ghc version" " T1" ,
195
- goldenWithSemanticTokens " pattern bind" " TPatternSyn" ,
196
- goldenWithSemanticTokens " type family" " TTypefamily" ,
197
- goldenWithSemanticTokens " TUnicodeSyntax" " TUnicodeSyntax"
194
+ goldenWithSemanticTokensWithDefaultConfig " mixed constancy test result generated from one ghc version" " T1" ,
195
+ goldenWithSemanticTokensWithDefaultConfig " pattern bind" " TPatternSyn" ,
196
+ goldenWithSemanticTokensWithDefaultConfig " type family" " TTypefamily" ,
197
+ goldenWithSemanticTokensWithDefaultConfig " TUnicodeSyntax" " TUnicodeSyntax"
198
198
]
199
199
200
200
semanticTokensDataTypeTests :: TestTree
201
201
semanticTokensDataTypeTests =
202
202
testGroup
203
203
" get semantic Tokens"
204
- [ goldenWithSemanticTokens " simple datatype" " TDataType" ,
205
- goldenWithSemanticTokens " record" " TRecord" ,
206
- goldenWithSemanticTokens " datatype import" " TDatatypeImported" ,
207
- goldenWithSemanticTokens " datatype family" " TDataFamily" ,
208
- goldenWithSemanticTokens " GADT" " TGADT"
204
+ [ goldenWithSemanticTokensWithDefaultConfig " simple datatype" " TDataType" ,
205
+ goldenWithSemanticTokensWithDefaultConfig " record" " TRecord" ,
206
+ goldenWithSemanticTokensWithDefaultConfig " datatype import" " TDatatypeImported" ,
207
+ goldenWithSemanticTokensWithDefaultConfig " datatype family" " TDataFamily" ,
208
+ goldenWithSemanticTokensWithDefaultConfig " GADT" " TGADT"
209
209
]
210
210
211
211
semanticTokensFunctionTests :: TestTree
212
212
semanticTokensFunctionTests =
213
213
testGroup
214
214
" get semantic of functions"
215
- [ goldenWithSemanticTokens " functions" " TFunction" ,
216
- goldenWithSemanticTokens " local functions" " TFunctionLocal" ,
217
- goldenWithSemanticTokens " function in let binding" " TFunctionLet" ,
218
- goldenWithSemanticTokens " negative case non-function with constraint" " TNoneFunctionWithConstraint"
215
+ [ goldenWithSemanticTokensWithDefaultConfig " functions" " TFunction" ,
216
+ goldenWithSemanticTokensWithDefaultConfig " local functions" " TFunctionLocal" ,
217
+ goldenWithSemanticTokensWithDefaultConfig " function in let binding" " TFunctionLet" ,
218
+ goldenWithSemanticTokensWithDefaultConfig " negative case non-function with constraint" " TNoneFunctionWithConstraint"
219
219
]
220
220
221
221
main :: IO ()
0 commit comments