5
5
6
6
module Main ( main ) where
7
7
8
- import Control.Lens ((^.) )
9
8
import Data.Either (rights )
10
- import Data.Functor (void )
11
- import Data.Maybe (isNothing )
12
- import Data.Row
13
9
import qualified Data.Text as T
14
- import qualified Data.Text.Lazy as TL
15
- import qualified Data.Text.Lazy.Encoding as TL
16
- import Ide.Logger (Doc , Logger (Logger ),
17
- Pretty (pretty ),
18
- Priority (Debug ),
19
- Recorder (Recorder , logger_ ),
20
- WithPriority (WithPriority , priority ),
21
- cfilter , cmapWithPrio ,
22
- makeDefaultStderrRecorder )
23
10
import qualified Ide.Plugin.OverloadedRecordDot as OverloadedRecordDot
24
- import Language.LSP.Protocol.Lens as L
25
- import System.FilePath ((<.>) , (</>) )
11
+ import System.FilePath ((</>) )
26
12
import Test.Hls
27
- import Test.Hls.Util (codeActionNoResolveCaps ,
28
- codeActionResolveCaps )
29
13
30
14
main :: IO ()
31
15
main =
@@ -59,7 +43,7 @@ mkNoResolveTest title fp selectorName x1 y1 x2 y2 =
59
43
mkResolveTest :: TestName -> FilePath -> T. Text -> UInt -> UInt -> UInt -> UInt -> TestTree
60
44
mkResolveTest title fp selectorName x1 y1 x2 y2 =
61
45
goldenWithHaskellAndCaps codeActionResolveCaps plugin title testDataDir fp " expected" " hs" $ \ doc -> do
62
- (( Right act) : _) <- getAndResolveExplicitFieldsActions doc selectorName x1 y1 x2 y2
46
+ (act: _) <- getAndResolveExplicitFieldsActions doc selectorName x1 y1 x2 y2
63
47
executeCodeAction act
64
48
65
49
@@ -77,12 +61,9 @@ getAndResolveExplicitFieldsActions
77
61
:: TextDocumentIdentifier
78
62
-> T. Text
79
63
-> UInt -> UInt -> UInt -> UInt
80
- -> Session [Either ResponseError CodeAction ]
64
+ -> Session [CodeAction ]
81
65
getAndResolveExplicitFieldsActions doc selectorName x1 y1 x2 y2 = do
82
- actions <- findExplicitFieldsAction selectorName <$> getCodeActions doc range
83
- rsp <- mapM (request SMethod_CodeActionResolve ) (filter (\ x -> isNothing (x ^. L. edit)) actions)
84
- pure $ (^. L. result) <$> rsp
85
-
66
+ findExplicitFieldsAction selectorName <$> getAndResolveCodeActions doc range
86
67
where
87
68
range = Range (Position x1 y1) (Position x2 y2)
88
69
0 commit comments