Remove clinet argument.
Since clients communicate using only JSON there is no need for the
argument which was only used to select serialization format.
diff --git a/elisp/shm.el b/elisp/shm.el
index dfb469b..5e9a6de 100644
--- a/elisp/shm.el
+++ b/elisp/shm.el
@@ -36,6 +36,7 @@
(require 'shm-context-menu)
(require 'cl)
+(require 'json)
(defvar shm-current-node-overlay nil
"Overlay to highlight the current node.")
@@ -266,7 +267,7 @@
"Emacs")
((file-error)
(error "Unable to find structured-haskell-mode executable! See README for help.")))))
- (read (buffer-string))))))
+ (json-read-from-string (buffer-string))))))
(defun shm-lint-ast (type start end)
"Get refactor suggestions for the region of TYPE from START to END."
diff --git a/src/HSrcQuery.hs b/src/HSrcQuery.hs
index 3a1a381..fc08f96 100644
--- a/src/HSrcQuery.hs
+++ b/src/HSrcQuery.hs
@@ -68,7 +68,6 @@
pkgConfigDirPath
cabalFilePath
buildTargetName
- client
code
------------------------------------------------------------------------------
@@ -93,22 +92,22 @@
-> FilePath
-> FilePath
-> String
- -> Client
-> String
-> IO String
-runQuery FreeVariables srcFile
- pkgConfigPath
- cabalFilePath
- buildTargetName
- client
- code =
- freeVariables srcFile
+runQuery FreeVariables srcFile
+ pkgConfigPath
+ cabalFilePath
+ buildTargetName
+ code =
+ freeVariables srcFile
pkgConfigPath
cabalFilePath
buildTargetName
- client
code
-runQuery LambdaBody _ _ _ _ _ code = return $ lambdaBody code
-runQuery LambdaArgs _ _ _ _ _ code = return $ lambdaArgs code
-runQuery HLint _ _ _ _ _ code = hlint code
-runQuery ParseAST _ _ _ _ _ code = return $ parseAST code
+runQuery LambdaBody _ _ _ _ code = return $ lambdaBody code
+runQuery LambdaArgs _ _ _ _ code = return $ lambdaArgs code
+runQuery HLint _ _ _ _ code = hlint code
+runQuery ParseAST _ _ _ _ code = return $ parseAST code
+
+------------------------------------------------------------------------------
+fn c = (\a b -> a + b) c
diff --git a/src/Lambda.hs b/src/Lambda.hs
index 29fce06..93b7381 100644
--- a/src/Lambda.hs
+++ b/src/Lambda.hs
@@ -7,14 +7,14 @@
import Data.Generics.Aliases
import Data.Generics.Schemes
import Data.List
+import Data.Char
import Language.Haskell.Exts
------------------------------------------------------------------------------
import HDevTools
-import Client
------------------------------------------------------------------------------
-freeVariables :: FilePath -> FilePath -> FilePath -> String -> Client -> String -> IO String
-freeVariables srcPath pkgConfigPath cabalFilePath buildTargetName client code = case parseExp code of
+freeVariables :: FilePath -> FilePath -> FilePath -> String -> String -> IO String
+freeVariables srcPath pkgConfigPath cabalFilePath buildTargetName code = case parseExp code of
ParseOk ast -> do
names <- dropModuleVariableNames srcPath
pkgConfigPath
diff --git a/src/ParseAST.hs b/src/ParseAST.hs
index 472f820..996e040 100644
--- a/src/ParseAST.hs
+++ b/src/ParseAST.hs
@@ -6,16 +6,17 @@
import Control.Applicative
import Data.Data
+import Data.List
import Data.Maybe
import Language.Haskell.Exts.Annotated
------------------------------------------------------------------------------------------
+------------------------------------------------------------------------------
data D = forall a. Data a => D a
------------------------------------------------------------------------------------------
+------------------------------------------------------------------------------
parseAST :: String -> [Char]
parseAST code = case parseTopLevel parseMode code of
- ParseOk (D ast) -> ("[" ++ concat (genHSE ast) ++ "]")
+ ParseOk (D ast) -> "[" ++ (intercalate "," (genHSE ast)) ++ "]"
ParseFailed _ _ -> "[]"
-----------------------------------------------------------------------------------------
@@ -72,7 +73,7 @@
-----------------------------------------------------------------------------------------
-- | Generate a span from a HSE SrcSpan.
spanHSE :: String -> String -> SrcSpan -> String
-spanHSE typ cons SrcSpan{..} = "[" ++ spanContent ++ "]"
+spanHSE typ cons SrcSpan{..} = "[" ++ (intercalate "," spanContent) ++ "]"
where unqualify = dropUntilLast '.'
spanContent =
unwords [unqualify typ