@@ -348,19 +348,25 @@ cabalAddCodeAction state plId (CodeActionParams _ _ (TextDocumentIdentifier uri)
348
348
hover :: PluginMethodHandler IdeState LSP. Method_TextDocumentHover
349
349
hover ide _ msgParam = do
350
350
nfp <- getNormalizedFilePathE uri
351
- (cabalFields, _) <- runActionE " cabal.cabal-hover" ide $ useWithStaleE ParseCabalFields nfp
352
- case CabalFields. findTextWord cursor cabalFields of
353
- Nothing ->
354
- pure $ InR Null
355
- Just cursorText -> do
356
- (gpd, _) <- runActionE " cabal.GPD" ide $ useWithStaleE ParseCabalFile nfp
357
- let depsNames = map dependencyName $ allBuildDepends $ flattenPackageDescription gpd
358
- case filterVersion cursorText of
359
- Nothing -> pure $ InR Null
360
- Just txt ->
361
- if txt `elem` depsNames
362
- then pure $ foundHover (Nothing , [txt <> " \n " , documentationText txt])
363
- else pure $ InR Null
351
+ mFields <- liftIO $ runAction " cabal.cabal-hover" ide $ useWithStale ParseCabalFields nfp
352
+ case mFields of
353
+ Nothing -> pure $ InR Null
354
+ Just (cabalFields, _) ->
355
+ case CabalFields. findTextWord cursor cabalFields of
356
+ Nothing ->
357
+ pure $ InR Null
358
+ Just cursorText -> do
359
+ mGPD <- liftIO $ runAction " cabal.GPD" ide $ useWithStale ParseCabalFile nfp
360
+ case mGPD of
361
+ Nothing -> pure $ InR Null
362
+ Just (gpd, _) -> do
363
+ let depsNames = map dependencyName $ allBuildDepends $ flattenPackageDescription gpd
364
+ case filterVersion cursorText of
365
+ Nothing -> pure $ InR Null
366
+ Just txt ->
367
+ if txt `elem` depsNames
368
+ then pure $ foundHover (Nothing , [txt <> " \n " , documentationText txt])
369
+ else pure $ InR Null
364
370
where
365
371
cursor = Types. lspPositionToCabalPosition (msgParam ^. JL. position)
366
372
uri = msgParam ^. JL. textDocument . JL. uri
0 commit comments