0 | module Protocol.IDE.FileContext
4 | import public Libraries.Text.Bounded
9 | record FileContext where
10 | constructor MkFileContext
15 | SExpable FileContext where
18 | [ SymbolAtom "filename", toSExp fc.file ]
19 | , SExpList [ SymbolAtom "start"
20 | , IntegerAtom (cast fc.range.startLine)
21 | , IntegerAtom (cast fc.range.startCol)
23 | , SExpList [ SymbolAtom "end"
24 | , IntegerAtom (cast fc.range.endLine)
25 | , IntegerAtom (cast fc.range.endCol)
30 | FromSExpable FileContext where
31 | fromSExp (SExpList [ SExpList
32 | [ SymbolAtom "filename", filenameSExp ]
33 | , SExpList [ SymbolAtom "start"
34 | , IntegerAtom startLine
35 | , IntegerAtom startCol
37 | , SExpList [ SymbolAtom "end"
38 | , IntegerAtom endLine
39 | , IntegerAtom endCol
41 | ]) = do file <- fromSExp filenameSExp
42 | pure $
MkFileContext {file, range = MkBounds
43 | { startLine = cast startLine
44 | , startCol = cast startCol
45 | , endLine = cast endLine
46 | , endCol = cast endCol
48 | fromSExp _ = Nothing