@@ -541,11 +541,10 @@ getCodeActions doc range = do
541
541
getAndResolveCodeActions :: TextDocumentIdentifier -> Range -> Session [Command |? CodeAction ]
542
542
getAndResolveCodeActions doc range = do
543
543
items <- getCodeActions doc range
544
- forM items leaveCommandResolveCodeAction
545
- where leaveCommandResolveCodeAction l@ (InL _) = pure l
546
- leaveCommandResolveCodeAction (InR r) | isJust (r ^. L. data_) =
547
- InR <$> resolveCodeAction r
548
- leaveCommandResolveCodeAction r@ (InR _) = pure r
544
+ for items \ case
545
+ l@ (InL _) -> pure l
546
+ (InR r) | isJust (r ^. L. data_) -> InR <$> resolveCodeAction r
547
+ r@ (InR _) = pure r
549
548
550
549
-- | Returns all the code actions in a document by
551
550
-- querying the code actions at each of the current
@@ -628,9 +627,9 @@ resolveCodeAction ca = do
628
627
rsp <- request SMethod_CodeActionResolve ca
629
628
case rsp ^. L. result of
630
629
Right ca -> return ca
631
- Left error -> throw (UnexpectedResponseError (SomeLspId $ fromJust $ rsp ^. L. id ) error )
630
+ Left er -> throw (UnexpectedResponseError (SomeLspId $ fromJust $ rsp ^. L. id ) er )
632
631
633
- -- | If a code action contains a _data_ field, resolves, the code action, then
632
+ -- | If a code action contains a _data_ field: resolves the code action, then
634
633
-- executes it. Otherwise, just executes it.
635
634
resolveAndExecuteCodeAction :: CodeAction -> Session ()
636
635
resolveAndExecuteCodeAction ca@ CodeAction {_data_= Just _} = do
@@ -686,7 +685,7 @@ getCompletions doc pos = do
686
685
getAndResolveCompletions :: TextDocumentIdentifier -> Position -> Session [CompletionItem ]
687
686
getAndResolveCompletions doc pos = do
688
687
items <- getCompletions doc pos
689
- forM items ( \ item -> if isJust (item ^. L. data_) then resolveCompletion item else pure item)
688
+ for items $ \ item -> if isJust (item ^. L. data_) then resolveCompletion item else pure item
690
689
691
690
-- | Resolves the provided completion item.
692
691
resolveCompletion :: CompletionItem -> Session CompletionItem
@@ -797,12 +796,12 @@ getCodeLenses tId = do
797
796
rsp <- request SMethod_TextDocumentCodeLens (CodeLensParams Nothing Nothing tId)
798
797
pure $ absorbNull $ getResponseResult rsp
799
798
800
- -- | RReturns the code lenses for the specified document, resolving any with
799
+ -- | Returns the code lenses for the specified document, resolving any with
801
800
-- a non empty _data_ field.
802
801
getAndResolveCodeLenses :: TextDocumentIdentifier -> Session [CodeLens ]
803
802
getAndResolveCodeLenses tId = do
804
803
codeLenses <- getCodeLenses tId
805
- forM codeLenses ( \ codeLens -> if isJust (codeLens ^. L. data_) then resolveCodeLens codeLens else pure codeLens)
804
+ for codeLenses $ \ codeLens -> if isJust (codeLens ^. L. data_) then resolveCodeLens codeLens else pure codeLens
806
805
807
806
-- | Resolves the provided code lens.
808
807
resolveCodeLens :: CodeLens -> Session CodeLens
0 commit comments