File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed
Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -1652,7 +1652,7 @@ lookupName :: HscEnv
16521652 -> IO (Maybe TyThing )
16531653lookupName _ name
16541654 | Nothing <- nameModule_maybe name = pure Nothing
1655- lookupName hsc_env name = do
1655+ lookupName hsc_env name = handle $ do
16561656#if MIN_VERSION_ghc(9,2,0)
16571657 mb_thing <- liftIO $ lookupType hsc_env name
16581658#else
@@ -1671,6 +1671,8 @@ lookupName hsc_env name = do
16711671 case res of
16721672 Util. Succeeded x -> return (Just x)
16731673 _ -> return Nothing
1674+ where
1675+ handle x = x `catch` \ (_ :: IOEnvFailure ) -> pure Nothing
16741676
16751677pathToModuleName :: FilePath -> ModuleName
16761678pathToModuleName = mkModuleName . map rep
Original file line number Diff line number Diff line change @@ -79,7 +79,9 @@ lookupKind env =
7979 fmap (fromRight Nothing ) . catchSrcErrors (hsc_dflags env) " span" . lookupName env
8080
8181getDocumentationTryGhc :: HscEnv -> Name -> IO SpanDoc
82- getDocumentationTryGhc env n = fromMaybe emptySpanDoc . listToMaybe <$> getDocumentationsTryGhc env [n]
82+ getDocumentationTryGhc env n =
83+ (fromMaybe emptySpanDoc . listToMaybe <$> getDocumentationsTryGhc env [n])
84+ `catch` (\ (_ :: IOEnvFailure ) -> pure emptySpanDoc)
8385
8486getDocumentationsTryGhc :: HscEnv -> [Name ] -> IO [SpanDoc ]
8587getDocumentationsTryGhc env names = do
Original file line number Diff line number Diff line change @@ -1983,7 +1983,7 @@ completionDocTests =
19831983 , " foo = ()"
19841984 , " bar = fo"
19851985 ]
1986- test doc (Position 3 8 ) " foo" Nothing [" *Defined at line 3, column 1 in this module*\n * * *\n docdoc\n " ]
1986+ test doc (Position 3 8 ) " foo" Nothing [" *Defined at line 3, column 1 in this module*\n * * *\n\n\ n docdoc\n " ]
19871987 , testSession " local multi line doc with '\\ n'" $ do
19881988 doc <- createDoc " A.hs" " haskell" $ T. unlines
19891989 [ " module A where"
@@ -1992,7 +1992,7 @@ completionDocTests =
19921992 , " foo = ()"
19931993 , " bar = fo"
19941994 ]
1995- test doc (Position 4 8 ) " foo" Nothing [" *Defined at line 4, column 1 in this module*\n * * *\n abcabc \n " ]
1995+ test doc (Position 4 8 ) " foo" Nothing [" *Defined at line 4, column 1 in this module*\n * * *\n\n\n abcabc \n " ]
19961996 , testSession " local multi line doc without '\\ n'" $ do
19971997 doc <- createDoc " A.hs" " haskell" $ T. unlines
19981998 [ " module A where"
@@ -2002,7 +2002,7 @@ completionDocTests =
20022002 , " foo = ()"
20032003 , " bar = fo"
20042004 ]
2005- test doc (Position 5 8 ) " foo" Nothing [" *Defined at line 5, column 1 in this module*\n * * *\n abcabc \n\n def\n " ]
2005+ test doc (Position 5 8 ) " foo" Nothing [" *Defined at line 5, column 1 in this module*\n * * *\n\n\n abcabc \n\n def\n " ]
20062006 , testSession " extern empty doc" $ do
20072007 doc <- createDoc " A.hs" " haskell" $ T. unlines
20082008 [ " module A where"
You can’t perform that action at this time.
0 commit comments