@@ -14,6 +14,7 @@ import Control.Monad.IO.Class (MonadIO (liftIO))
14
14
import qualified Data.Text as T
15
15
import qualified Data.Text.IO as T
16
16
import Language.Haskell.LSP.Test (
17
+ Session ,
17
18
anyMessage ,
18
19
documentContents ,
19
20
executeCommand ,
@@ -166,8 +167,13 @@ goldenTestBy f input = runSession hlsCommand fullCaps evalPath $ do
166
167
codeLenses <- reverse . filter f <$> getCodeLenses doc
167
168
-- liftIO $ print codeLenses
168
169
169
- mapM_ executeCommand $ [c | CodeLens {_command = Just c} <- codeLenses]
170
- _resp :: ApplyWorkspaceEditRequest <- skipManyTill anyMessage message
170
+ -- Execute in parallel
171
+ -- mapM_ executeCommand $ [c | CodeLens{_command = Just c} <- codeLenses]
172
+ -- _resp :: ApplyWorkspaceEditRequest <- skipManyTill anyMessage message
173
+
174
+ -- Execute sequentially
175
+ mapM_ executeCmd $ [c | CodeLens {_command = Just c} <- codeLenses]
176
+
171
177
edited <- replaceUnicodeQuotes <$> documentContents doc
172
178
-- liftIO $ T.putStrLn edited
173
179
@@ -181,6 +187,14 @@ goldenTestBy f input = runSession hlsCommand fullCaps evalPath $ do
181
187
expected <- liftIO $ T. readFile expectedFile
182
188
liftIO $ edited @?= expected
183
189
190
+ -- Execute command and wait for result
191
+ executeCmd :: Command -> Session ()
192
+ executeCmd cmd = do
193
+ executeCommand cmd
194
+ _resp :: ApplyWorkspaceEditRequest <- skipManyTill anyMessage message
195
+ -- liftIO $ print _resp
196
+ return ()
197
+
184
198
-- Execute only Eval tests to avoid interference from other plugins (e.g ghcide:typesignature.add)
185
199
isEvalTest :: CodeLens -> Bool
186
200
isEvalTest (CodeLens _ (Just (Command _ cmd _)) _)
0 commit comments