@@ -8,6 +8,8 @@ module Idris.Parser(module Idris.Parser,
88
99import Prelude hiding (pi)
1010
11+import qualified System.Directory as Dir (makeAbsolute)
12+
1113import Text.Trifecta.Delta
1214import Text.Trifecta hiding (span, stringLiteral, charLiteral, natural, symbol, char, string, whiteSpace, Err)
1315import Text.Parser.LookAhead
@@ -1244,7 +1246,8 @@ parseImports fname input
12441246 Failure err -> fail (show err)
12451247 Success (x, annots, i) ->
12461248 do putIState i
1247− sendHighlighting (addPath annots fname)
1249+ fname' <- runIO $ Dir.makeAbsolute fname
1250+ sendHighlighting $ addPath annots fname'
12481251 return x
12491252 where imports :: IdrisParser ((Maybe (Docstring ()), [String],
12501253 [ImportInfo],
@@ -1263,7 +1266,7 @@ parseImports fname input
12631266 addPath :: [(FC, OutputAnnotation)] -> FilePath -> [(FC, OutputAnnotation)]
12641267 addPath [] _ = []
12651268 addPath ((fc, AnnNamespace ns Nothing) : annots) path =
1266− (fc, AnnNamespace ns (Just path)) : addPath annots path
1269+ (fc, AnnNamespace ns (Just path)) : addPath annots path
12671270 addPath (annot:annots) path = annot : addPath annots path
12681271
12691272-- | There should be a better way of doing this...
@@ -1390,7 +1393,10 @@ loadSource lidr f toline
13901393 IDR fn -> Just fn
13911394 LIDR fn -> Just fn
13921395 _ -> Nothing
1393− sendHighlighting [(nfc, AnnNamespace ns srcFn)])
1396+ srcFnAbs <- case srcFn of
1397+ Just fn -> fmap Just (runIO $ Dir.makeAbsolute fn)
1398+ Nothing -> return Nothing
1399+ sendHighlighting [(nfc, AnnNamespace ns srcFnAbs)])
13941400 [(re, fn, ns, nfc) | ImportInfo re fn _ ns _ nfc <- imports]
13951401 reportParserWarnings
13961402