Skip to content

Commit 89a263e

Browse files
committed
try to edit the file and then get result
1 parent 3953584 commit 89a263e

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

bench/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# The number of samples to run per experiment.
22
# At least 100 is recommended in order to observe space leaks
3-
samples: 1
3+
samples: 50
44

55
buildTool: cabal
66

ghcide-bench/src/Experiments.hs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ headerEdit =
8282
.+ #rangeLength .== Nothing
8383
.+ #text .== "-- header comment \n"
8484

85+
tailEdit :: UInt -> Text -> TextDocumentContentChangeEvent
86+
tailEdit end i =
87+
TextDocumentContentChangeEvent $ InL $ #range .== Range (Position end 0) (Position end (fromIntegral $ T.length txt))
88+
.+ #rangeLength .== Nothing
89+
.+ #text .== (txt <> "\n")
90+
where
91+
txt :: Text
92+
txt = "x" <> i <> "=" <> i
93+
8594
data DocumentPositions = DocumentPositions {
8695
-- | A position that can be used to generate non null goto-def and completion responses
8796
identifierP :: Maybe Position,
@@ -104,11 +113,15 @@ experiments =
104113
[
105114
bench "semanticTokens" $ \docs -> do
106115
liftIO $ putStrLn "Starting semanticTokens"
107-
r <- forM docs $ \DocumentPositions{..} -> do
116+
r <- forM (zip [T.pack $ show i | i :: Int <- [0..]] docs) $ \(i, DocumentPositions{..}) -> do
117+
bottom <- fromIntegral . length . T.lines <$> documentContents doc
118+
changeDoc doc [tailEdit bottom i]
119+
-- wait for a fresh build start
120+
waitForProgressStart
108121
tks <- getSemanticTokens doc
109122
case tks ^? LSP._L of
110123
Just _ -> return True
111-
Nothing -> return True
124+
Nothing -> return False
112125
return $ and r,
113126
---------------------------------------------------------------------------------------
114127
bench "hover" $ allWithIdentifierPos $ \DocumentPositions{..} ->

0 commit comments

Comments
 (0)