Skip to content

Commit b0b175e

Browse files
committed
Development.IDE.Spans.Documentation: getDocumentationsTryGhc: mv map
1 parent 662da22 commit b0b175e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ghcide/src/Development/IDE/Spans/Documentation.hs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import System.FilePath
3333

3434
import Language.LSP.Types (filePathToUri, getUri)
3535
import qualified Data.Map as Map
36+
import Development.IDE.Types.Diagnostics (FileDiagnostic)
3637

3738
mkDocMap
3839
:: HscEnv
@@ -68,11 +69,14 @@ getDocumentationTryGhc env mod n = head <$> getDocumentationsTryGhc env mod [n]
6869

6970
getDocumentationsTryGhc :: HscEnv -> Module -> [Name] -> IO [SpanDoc]
7071
getDocumentationsTryGhc env mod names = do
71-
res <- catchSrcErrors (hsc_dflags env) "docs" $ (fmap . fmap) snd $ fmap Map.toList $ getDocsBatch env mod names
72+
res <- fun
7273
case res of
7374
Left _ -> return []
74-
Right res -> zipWithM unwrap res names
75+
Right res -> zipWithM unwrap (fmap snd res) names
7576
where
77+
fun :: IO (Either [FileDiagnostic] [(Name, Either String (Maybe HsDocString, Map.Map Int HsDocString))])
78+
fun = catchSrcErrors (hsc_dflags env) "docs" $ Map.toList <$> getDocsBatch env mod names
79+
7680
unwrap (Right (Just docs, _)) n = SpanDocString docs <$> getUris n
7781
unwrap _ n = mkSpanDocText n
7882

0 commit comments

Comments
 (0)