Skip to content

Commit 9512683

Browse files
committed
Recover the original way of sending file contexts to idemode clients
1 parent f0af11a commit 9512683

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/Idris/REPL/Common.idr

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
module Idris.REPL.Common
22

3-
import Core.Env
43
import Core.Context.Log
4+
import Core.Directory
5+
import Core.Env
56
import Core.InitPrimitives
67
import Core.Metadata
78
import Core.Primitives
@@ -80,9 +81,19 @@ emitProblem a replDocCreator idemodeDocCreator getFC
8081
-- TODO: Display a better message when the error doesn't contain a location
8182
case map toNonEmptyFC (getFC a) of
8283
Nothing => iputStrLn msg
83-
Just (file, startPos, endPos) =>
84+
Just (origin, startPos, endPos) => do
85+
fname <- case origin of
86+
PhysicalIdrSrc ident => do
87+
-- recover the file name relative to the working directory.
88+
-- (This is what idris2-mode expects)
89+
let fc = MkFC (PhysicalIdrSrc ident) startPos endPos
90+
catch (nsToSource fc ident) (const $ pure "(File-Not-Found)")
91+
PhysicalPkgSrc fname =>
92+
pure fname
93+
Virtual Interactive =>
94+
pure "(Interactive)"
8495
send f (SExpList [SymbolAtom "warning",
85-
SExpList [toSExp (show file),
96+
SExpList [toSExp {a = String} fname,
8697
toSExp (addOne startPos),
8798
toSExp (addOne endPos),
8899
toSExp !(renderWithoutColor msg),

0 commit comments

Comments
 (0)