Skip to content

Commit 5cd4c26

Browse files
committed
Fix "after edit" experiments
When the example includes >1 modules, we have to wait for the progress start of every edit. This is the sequence of events: --> didChange A.hs --> didChange B.hs <-- ProgressStart (for A.hs change) <-- ProgressDone (aborted) <-- ProgressStart (for B.hs change) <-- ProgressDone The experiment needs to ignore the aborted progress done events and wait until the last progress done event. To accomplish this, we wait for all the progress start events and then wait for one progress done event
1 parent 28222e9 commit 5cd4c26

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

ghcide/bench/lib/Experiments.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ experiments =
7474
isJust <$> getHover doc (fromJust identifierP),
7575
---------------------------------------------------------------------------------------
7676
bench "edit" $ \docs -> do
77-
forM_ docs $ \DocumentPositions{..} ->
77+
forM_ docs $ \DocumentPositions{..} -> do
7878
changeDoc doc [charEdit stringLiteralP]
79-
-- wait for a fresh build start
80-
waitForProgressStart
79+
-- wait for a fresh build start
80+
waitForProgressStart
8181
-- wait for the build to be finished
8282
waitForProgressDone
8383
return True,
@@ -121,8 +121,9 @@ experiments =
121121
( \docs -> do
122122
unless (any (isJust . identifierP) docs) $
123123
error "None of the example modules is suitable for this experiment"
124-
forM_ docs $ \DocumentPositions{..} ->
124+
forM_ docs $ \DocumentPositions{..} -> do
125125
forM_ identifierP $ \p -> changeDoc doc [charEdit p]
126+
waitForProgressStart
126127
waitForProgressDone
127128
)
128129
( \docs -> not . null . catMaybes <$> forM docs (\DocumentPositions{..} ->
@@ -139,8 +140,9 @@ experiments =
139140
forM_ identifierP $ \p -> changeDoc doc [charEdit p]
140141
)
141142
( \docs -> do
142-
forM_ docs $ \DocumentPositions{..} ->
143+
forM_ docs $ \DocumentPositions{..} -> do
143144
changeDoc doc [charEdit stringLiteralP]
145+
waitForProgressStart
144146
waitForProgressDone
145147
not . null . catMaybes <$> forM docs (\DocumentPositions{..} -> do
146148
forM identifierP $ \p ->
@@ -162,6 +164,7 @@ experiments =
162164
List [ FileEvent hieYamlUri FcChanged ]
163165
forM_ docs $ \DocumentPositions{..} ->
164166
changeDoc doc [charEdit stringLiteralP]
167+
waitForProgressStart
165168
waitForProgressDone
166169
not . null . catMaybes <$> forM docs (\DocumentPositions{..} -> do
167170
forM identifierP $ \p ->

0 commit comments

Comments
 (0)