@@ -82,6 +82,15 @@ headerEdit =
82
82
.+ # rangeLength .== Nothing
83
83
.+ # text .== " -- header comment \n "
84
84
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
+
85
94
data DocumentPositions = DocumentPositions {
86
95
-- | A position that can be used to generate non null goto-def and completion responses
87
96
identifierP :: Maybe Position ,
@@ -104,11 +113,15 @@ experiments =
104
113
[
105
114
bench " semanticTokens" $ \ docs -> do
106
115
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
108
121
tks <- getSemanticTokens doc
109
122
case tks ^? LSP. _L of
110
123
Just _ -> return True
111
- Nothing -> return True
124
+ Nothing -> return False
112
125
return $ and r,
113
126
---------------------------------------------------------------------------------------
114
127
bench " hover" $ allWithIdentifierPos $ \ DocumentPositions {.. } ->
0 commit comments