Skip to content
Browse files

Fix doubly quoted JSON strings for AbsFilePaths.

  • Loading branch information...
1 parent 601c987 commit aec7bcafdb020cd27766010fba9cad294892c4e9 @nominolo committed Jun 23, 2009
Showing with 5 additions and 3 deletions.
  1. +2 −2 lib/Scion/Types/Notes.hs
  2. +3 −1 server/Scion/Server/Commands.hs
View
4 lib/Scion/Types/Notes.hs
@@ -14,7 +14,7 @@ module Scion.Types.Notes
( Location, LocSource(..), mkLocation, mkNoLoc
, locSource, isValidLoc, noLocText, viewLoc
, locStartCol, locEndCol, locStartLine, locEndLine
- , AbsFilePath, mkAbsFilePath
+ , AbsFilePath(toFilePath), mkAbsFilePath
, Note(..), NoteKind(..), Notes
, ghcSpanToLocation, ghcErrMsgToNote, ghcWarnMsgToNote
, ghcMessagesToNotes
@@ -58,7 +58,7 @@ type Notes = MS.MultiSet Note
-- Since relative 'FilePath's depend on the a current working directory we
-- normalise all paths to absolute paths. Use 'mkAbsFilePath' to create
-- absolute file paths.
-newtype AbsFilePath = AFP FilePath deriving (Eq, Ord)
+newtype AbsFilePath = AFP { toFilePath :: FilePath } deriving (Eq, Ord)
instance Show AbsFilePath where show (AFP s) = show s
-- | Create an absolute file path given a base directory.
View
4 server/Scion/Server/Commands.hs
@@ -351,9 +351,11 @@ instance JSON NoteKind where
readJSON _ = fail "note-kind"
instance JSON Location where
+ showJSON loc | not (isValidLoc loc) =
+ makeObject [("no-location", str (noLocText loc))]
showJSON loc | (src, l0, c0, l1, c1) <- viewLoc loc =
makeObject [case src of
- FileSrc f -> ("file", str (show f))
+ FileSrc f -> ("file", str (toFilePath f))
OtherSrc s -> ("other", str s)
,("region", JSArray (map showJSON [l0,c0,l1,c1]))]
readJSON (JSObject obj) = do

0 comments on commit aec7bca

Please sign in to comment.
Something went wrong with that request. Please try again.