git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #2221 from kRITZCREEK/psc-ide-unicode-enc
11fdef0Phil Freeman
psc-ide-client/Main.hs+6−16
@@ -5,16 +5,15 @@ import Prelude ()
5import Prelude.Compat
5import Prelude.Compat
6
6
7import Control.Exception
7import Control.Exception
8−import Data.Text (Text)
9−import qualified Data.Text as T
8+import qualified Data.ByteString.Char8 as BS8
10−import qualified Data.Text.IO as T
9+import qualified Data.Text.IO as T
11−import Data.Version (showVersion)
10+import Data.Version (showVersion)
12import Network
11import Network
13import Options.Applicative
12import Options.Applicative
14import System.Exit
13import System.Exit
15import System.IO
14import System.IO
16
15
17−import qualified Paths_purescript as Paths
16+import qualified Paths_purescript as Paths
18
17
19data Options = Options
18data Options = Options
20 { optionsPort :: PortID
19 { optionsPort :: PortID
@@ -41,16 +40,7 @@ client port = do
41 ("Couldn't connect to psc-ide-server on port: " ++
40 ("Couldn't connect to psc-ide-server on port: " ++
42 show port ++ " Error: " ++ show e) >>
41 show port ++ " Error: " ++ show e) >>
43 exitFailure)
42 exitFailure)
44− cmd <- T.getLine
45− -- Temporary fix for emacs windows bug
46− let cleanedCmd = removeSurroundingTicks cmd
47− --
48− T.hPutStrLn h cleanedCmd
43+ T.hPutStrLn h =<< T.getLine
49− res <- T.hGetLine h
44+ BS8.putStrLn =<< BS8.hGetLine h
50− putStrLn (T.unpack res)
51 hFlush stdout
45 hFlush stdout
52 hClose h
46 hClose h
53−
54−-- TODO: Fix this in the emacs plugin by using a real process over shellcommands
55−removeSurroundingTicks :: Text -> Text
56−removeSurroundingTicks = T.dropWhile (== '\'') . T.dropWhileEnd (== '\'')
psc-ide-server/Main.hs+4−3
@@ -23,9 +23,11 @@ module Main where
23
23
24import Protolude
24import Protolude
25
25
26+import qualified Data.Aeson as Aeson
26import Control.Concurrent.STM
27import Control.Concurrent.STM
27import "monad-logger" Control.Monad.Logger
28import "monad-logger" Control.Monad.Logger
28import qualified Data.Text.IO as T
29import qualified Data.Text.IO as T
30+import qualified Data.ByteString.Lazy.Char8 as BS8
29import Data.Version (showVersion)
31import Data.Version (showVersion)
30import Language.PureScript.Ide
32import Language.PureScript.Ide
31import Language.PureScript.Ide.Util
33import Language.PureScript.Ide.Util
@@ -121,9 +123,8 @@ startServer port env = withSocketsDo $ do
121 -- $(logDebug) ("Answer was: " <> T.pack (show result))
123 -- $(logDebug) ("Answer was: " <> T.pack (show result))
122 liftIO (hFlush stdout)
124 liftIO (hFlush stdout)
123 case result of
125 case result of
124− -- What function can I use to clean this up?
125− Right r -> liftIO $ T.hPutStrLn h (encodeT r)
126+ Right r -> liftIO $ BS8.hPutStrLn h (Aeson.encode r)
126− Left err -> liftIO $ T.hPutStrLn h (encodeT err)
127+ Left err -> liftIO $ BS8.hPutStrLn h (Aeson.encode err)
127 Nothing -> do
128 Nothing -> do
128 $(logDebug) ("Parsing the command failed. Command: " <> cmd)
129 $(logDebug) ("Parsing the command failed. Command: " <> cmd)
129 liftIO $ do
130 liftIO $ do
purescript.cabal+3
@@ -428,6 +428,8 @@ executable psc-ide-server
428 other-modules: Paths_purescript
428 other-modules: Paths_purescript
429 other-extensions:
429 other-extensions:
430 build-depends: base >=4 && <5,
430 build-depends: base >=4 && <5,
431+ aeson >= 0.8 && < 0.12,
432+ bytestring -any,
431 purescript -any,
433 purescript -any,
432 base-compat >=0.6.0,
434 base-compat >=0.6.0,
433 directory -any,
435 directory -any,
@@ -450,6 +452,7 @@ executable psc-ide-client
450 other-extensions:
452 other-extensions:
451 build-depends: base >=4 && <5,
453 build-depends: base >=4 && <5,
452 base-compat >=0.6.0,
454 base-compat >=0.6.0,
455+ bytestring -any,
453 mtl -any,
456 mtl -any,
454 network -any,
457 network -any,
455 optparse-applicative >= 0.12.1,
458 optparse-applicative >= 0.12.1,