Skip to content

Commit 0180e7c

Browse files
committed
revert prev, useWithStaleE -> useE
1 parent d0400a7 commit 0180e7c

File tree

1 file changed

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

1 file changed

+13
-19
lines changed

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

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -348,25 +348,19 @@ cabalAddCodeAction state plId (CodeActionParams _ _ (TextDocumentIdentifier uri)
348348
hover :: PluginMethodHandler IdeState LSP.Method_TextDocumentHover
349349
hover ide _ msgParam = do
350350
nfp <- getNormalizedFilePathE uri
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
351+
cabalFields <- runActionE "cabal.cabal-hover" ide $ useE 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 $ useE 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
370364
where
371365
cursor = Types.lspPositionToCabalPosition (msgParam ^. JL.position)
372366
uri = msgParam ^. JL.textDocument . JL.uri

0 commit comments

Comments
 (0)