2
2
{-# LANGUAGE GADTs #-}
3
3
{-# LANGUAGE ImplicitParams #-}
4
4
{-# LANGUAGE ImpredicativeTypes #-}
5
- {-# LANGUAGE OverloadedLabels #-}
6
5
{-# LANGUAGE OverloadedStrings #-}
7
6
{-# OPTIONS_GHC -Wno-deprecations -Wno-unticked-promoted-constructors #-}
8
7
@@ -43,14 +42,12 @@ import Data.Either (fromRight)
43
42
import Data.List
44
43
import Data.Maybe
45
44
import Data.Proxy
46
- import Data.Row hiding (switch )
47
45
import Data.Text (Text )
48
46
import qualified Data.Text as T
49
47
import Data.Version
50
48
import Development.IDE.Plugin.Test
51
49
import Development.IDE.Test.Diagnostic
52
- import Development.Shake (CmdOption (Cwd , FileStdout ),
53
- cmd_ )
50
+ import Development.Shake (CmdOption (Cwd ), cmd_ )
54
51
import Experiments.Types
55
52
import Language.LSP.Protocol.Capabilities
56
53
import qualified Language.LSP.Protocol.Lens as L
@@ -72,15 +69,19 @@ import Text.Printf
72
69
73
70
charEdit :: Position -> TextDocumentContentChangeEvent
74
71
charEdit p =
75
- TextDocumentContentChangeEvent $ InL $ # range .== Range p p
76
- .+ # rangeLength .== Nothing
77
- .+ # text .== " a"
72
+ TextDocumentContentChangeEvent $ InL TextDocumentContentChangePartial
73
+ { _range = Range p p
74
+ , _rangeLength = Nothing
75
+ , _text = " a"
76
+ }
78
77
79
78
headerEdit :: TextDocumentContentChangeEvent
80
79
headerEdit =
81
- TextDocumentContentChangeEvent $ InL $ # range .== Range (Position 0 0 ) (Position 0 0 )
82
- .+ # rangeLength .== Nothing
83
- .+ # text .== " -- header comment \n "
80
+ TextDocumentContentChangeEvent $ InL TextDocumentContentChangePartial
81
+ { _range = Range (Position 0 0 ) (Position 0 0 )
82
+ , _rangeLength = Nothing
83
+ , _text = " -- header comment \n "
84
+ }
84
85
85
86
data DocumentPositions = DocumentPositions {
86
87
-- | A position that can be used to generate non null goto-def and completion responses
@@ -241,9 +242,11 @@ experiments =
241
242
benchWithSetup
242
243
" hole fit suggestions"
243
244
( mapM_ $ \ DocumentPositions {.. } -> do
244
- let edit = TextDocumentContentChangeEvent $ InL $ # range .== Range bottom bottom
245
- .+ # rangeLength .== Nothing
246
- .+ # text .== t
245
+ let edit = TextDocumentContentChangeEvent $ InL TextDocumentContentChangePartial
246
+ { _range = Range bottom bottom
247
+ , _rangeLength = Nothing
248
+ , _text = t
249
+ }
247
250
bottom = Position maxBound 0
248
251
t = T. unlines
249
252
[" "
@@ -271,9 +274,11 @@ experiments =
271
274
benchWithSetup
272
275
" eval execute single-line code lens"
273
276
( mapM_ $ \ DocumentPositions {.. } -> do
274
- let edit = TextDocumentContentChangeEvent $ InL $ # range .== Range bottom bottom
275
- .+ # rangeLength .== Nothing
276
- .+ # text .== t
277
+ let edit = TextDocumentContentChangeEvent $ InL TextDocumentContentChangePartial
278
+ { _range = Range bottom bottom
279
+ , _rangeLength = Nothing
280
+ , _text = t
281
+ }
277
282
bottom = Position maxBound 0
278
283
t = T. unlines
279
284
[ " "
@@ -296,9 +301,11 @@ experiments =
296
301
benchWithSetup
297
302
" eval execute multi-line code lens"
298
303
( mapM_ $ \ DocumentPositions {.. } -> do
299
- let edit = TextDocumentContentChangeEvent $ InL $ # range .== Range bottom bottom
300
- .+ # rangeLength .== Nothing
301
- .+ # text .== t
304
+ let edit = TextDocumentContentChangeEvent $ InL TextDocumentContentChangePartial
305
+ { _range = Range bottom bottom
306
+ , _rangeLength = Nothing
307
+ , _text = t
308
+ }
302
309
bottom = Position maxBound 0
303
310
t = T. unlines
304
311
[ " "
@@ -552,7 +559,7 @@ runBenchmarksFun dir allBenchmarks = do
552
559
lspTestCaps =
553
560
fullCaps
554
561
& (L. window . _Just) .~ WindowClientCapabilities (Just True ) Nothing Nothing
555
- & (L. textDocument . _Just . L. codeAction . _Just . L. resolveSupport . _Just) .~ (# properties .== [" edit" ])
562
+ & (L. textDocument . _Just . L. codeAction . _Just . L. resolveSupport . _Just) .~ (ClientCodeActionResolveOptions [" edit" ])
556
563
& (L. textDocument . _Just . L. codeAction . _Just . L. dataSupport . _Just) .~ True
557
564
558
565
showMs :: Seconds -> String
@@ -756,10 +763,12 @@ setupDocumentContents config =
756
763
757
764
-- Setup the special positions used by the experiments
758
765
lastLine <- fromIntegral . length . T. lines <$> documentContents doc
759
- changeDoc doc [TextDocumentContentChangeEvent $ InL
760
- $ # range .== Range (Position lastLine 0 ) (Position lastLine 0 )
761
- .+ # rangeLength .== Nothing
762
- .+ # text .== T. unlines [ " _hygienic = \" hygienic\" " ]]
766
+ changeDoc doc [TextDocumentContentChangeEvent $ InL TextDocumentContentChangePartial
767
+ { _range = Range (Position lastLine 0 ) (Position lastLine 0 )
768
+ , _rangeLength = Nothing
769
+ , _text = T. unlines [ " _hygienic = \" hygienic\" " ]
770
+ }
771
+ ]
763
772
let
764
773
-- Points to a string in the target file,
765
774
-- convenient for hygienic edits
0 commit comments