File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 1
1
module Idris.REPL.Common
2
2
3
- import Core.Env
4
3
import Core.Context.Log
4
+ import Core.Directory
5
+ import Core.Env
5
6
import Core.InitPrimitives
6
7
import Core.Metadata
7
8
import Core.Primitives
@@ -80,9 +81,19 @@ emitProblem a replDocCreator idemodeDocCreator getFC
80
81
-- TODO: Display a better message when the error doesn't contain a location
81
82
case map toNonEmptyFC (getFC a) of
82
83
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)"
84
95
send f (SExpList [SymbolAtom " warning" ,
85
- SExpList [toSExp ( show file) ,
96
+ SExpList [toSExp {a = String } fname ,
86
97
toSExp (addOne startPos),
87
98
toSExp (addOne endPos),
88
99
toSExp ! (renderWithoutColor msg),
You can’t perform that action at this time.
0 commit comments