Skip to content

Commit d0400a7

Browse files
committed
runActionE -> runAction
1 parent ecd8828 commit d0400a7

File tree

1 file changed

+19
-13
lines changed
  • plugins/hls-cabal-plugin/src/Ide/Plugin

1 file changed

+19
-13
lines changed

plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -348,19 +348,25 @@ cabalAddCodeAction state plId (CodeActionParams _ _ (TextDocumentIdentifier uri)
348348
hover :: PluginMethodHandler IdeState LSP.Method_TextDocumentHover
349349
hover ide _ msgParam = do
350350
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
364370
where
365371
cursor = Types.lspPositionToCabalPosition (msgParam ^. JL.position)
366372
uri = msgParam ^. JL.textDocument . JL.uri

0 commit comments

Comments
 (0)