Reexport modules via cabal
authorLuke Lau <luke_lau@icloud.com>
Wed, 11 Jul 2018 00:51:31 +0000 (01:51 +0100)
committerLuke Lau <luke_lau@icloud.com>
Wed, 11 Jul 2018 00:51:31 +0000 (01:51 +0100)
Remove redundant dependencies
Supress some hlints
Prep cabal file

.gitignore
README.md
example/Main.hs
haskell-lsp-test.cabal
src/Language/Haskell/LSP/Test.hs
src/Language/Haskell/LSP/Test/Parsing.hs
test/Test.hs
test/data/refactor/Main.hs

index 730460f1f6029d007516cb41eb01e707e0c689c0..93b38a2e49816a46a6d51cde5922449b36114bff 100644 (file)
@@ -1,3 +1,8 @@
 .stack-work
+dist
+dist-newstyle
+cabal.project.local*
+.ghc.environment.*
 **/.DS_Store
 *.swp
+
index 0af386e54c3a75c8be2f2af3af767ff6fb2693ce..dd715067b74e46686c53ab3e4a7415ccf9009fac 100644 (file)
--- a/README.md
+++ b/README.md
@@ -7,8 +7,8 @@ runSession "session/root/dir" $ do
   
   skipMany notification
 
-  sendRequest TextDocumentDocumentSymbol (DocumentSymbolParams doc)
-              
-  rspSymbols <- response :: DocumentSymbolsResponse
-  let (List symbols) = fromJust (rspSymbols ^. result)
+  symbols <- getDocumentSymbols doc
 ```
+
+## Developing
+To test make sure you have [haskell-ide-engine](https://github.com/haskell/haskell-ide-engine) installed.
index 0318ce8c04f47243f3946bd1d755c336cc08e3e7..c992b8ea67390760497b6fdee187078c428489a8 100644 (file)
@@ -1,8 +1,8 @@
+import Control.Applicative.Combinators
+import Control.Monad.IO.Class
 import Language.Haskell.LSP.Test
 import Language.Haskell.LSP.Types
 
-import Control.Monad.IO.Class
-
 main = runSession "hie --lsp" "test/recordings/renamePass" $ do
   docItem <- openDoc "Desktop/simple.hs" "haskell"
   
index 9c21b77511fe8b57a5677edb946eb8ea61cf0c30..860c29b59057ea387e9e11c6eb22b647271da9d1 100644 (file)
@@ -19,12 +19,14 @@ library
   hs-source-dirs:      src
   exposed-modules:     Language.Haskell.LSP.Test
                      , Language.Haskell.LSP.Test.Replay
+  reexported-modules:  haskell-lsp:Language.Haskell.LSP.Types
+                     , haskell-lsp:Language.Haskell.LSP.Types.Capabilities
+                     , parser-combinators:Control.Applicative.Combinators
   default-language:    Haskell2010
   build-depends:       base >= 4.7 && < 5
                      , haskell-lsp >= 0.4
                      , aeson
                      , ansi-terminal
-                     , async
                      , bytestring
                      , conduit
                      , conduit-parse
@@ -63,23 +65,16 @@ test-suite tests
                      , hspec
                      , lens
                      , data-default
-                     , directory
-                     , haskell-lsp-test
                      , haskell-lsp >= 0.4
-                     , conduit
-                     , conduit-parse
+                     , haskell-lsp-test
                      , aeson
                      , unordered-containers
                      , text
   default-language:    Haskell2010
 
-executable example
+executable lsp-test-example
   hs-source-dirs:      example
   main-is:             Main.hs
   default-language:    Haskell2010
   build-depends:       base >= 4.7 && < 5
                      , haskell-lsp-test
-                     , haskell-lsp >= 0.4
-                     , lens
-                     , text
-                     , directory
index 427b6172674e0dce35ede6689e1c0b25b992aac5..3ba86905c2d48d6c015812421253fa7319f3a3e6 100644 (file)
@@ -39,25 +39,6 @@ module Language.Haskell.LSP.Test
   , loggingNotification
   , publishDiagnosticsNotification
   -- * Combinators
-  , choice
-  , option
-  , optional
-  , between
-  , some
-  , many
-  , sepBy
-  , sepBy1
-  , sepEndBy1
-  , sepEndBy
-  , endBy1
-  , endBy
-  , count
-  , manyTill
-  , skipMany
-  , skipSome
-  , skipManyTill
-  , skipSomeTill
-  , (<|>)
   , satisfy
   -- * Utilities
   , initializeResponse
@@ -83,7 +64,6 @@ module Language.Haskell.LSP.Test
   , applyEdit
   ) where
 
-import Control.Applicative
 import Control.Applicative.Combinators
 import Control.Concurrent
 import Control.Monad
index 3ecc53888b31f5090b64344a866d512b5dd1460b..36349dae864f4fbd63aa82c6016d87da1bd52084 100644 (file)
@@ -53,9 +53,8 @@ satisfy pred = do
 message :: forall a. (Typeable a, FromJSON a) => Session a
 message =
   let parser = decode . encodeMsg :: FromServerMessage -> Maybe a
-  in named (T.pack $ show $ head $ snd $ splitTyConApp $ last $ typeRepArgs $ typeOf parser) $ do
-    x <- satisfy (isJust . parser)
-    return $ castMsg x
+  in named (T.pack $ show $ head $ snd $ splitTyConApp $ last $ typeRepArgs $ typeOf parser) $
+    castMsg <$> satisfy (isJust . parser)
 
 -- | Matches if the message is a notification.
 anyNotification :: Session FromServerMessage
index 845f6e46aecdc732c5a465b51c42faead0907486..1a09b294c60a16dcfd5d33976e69f631971fab48 100644 (file)
@@ -8,6 +8,7 @@ import           Data.Aeson
 import           Data.Default
 import qualified Data.HashMap.Strict as HM
 import qualified Data.Text as T
+import           Control.Applicative.Combinators
 import           Control.Concurrent
 import           Control.Monad.IO.Class
 import           Control.Monad
@@ -17,9 +18,12 @@ import           Language.Haskell.LSP.Messages
 import           Language.Haskell.LSP.Test
 import           Language.Haskell.LSP.Test.Replay
 import           Language.Haskell.LSP.Types.Capabilities
-import           Language.Haskell.LSP.Types hiding (message, capabilities)
+import           Language.Haskell.LSP.Types hiding (capabilities, message)
 import           System.Timeout
 
+{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}
+{-# ANN module ("HLint: ignore Unnecessary hiding" :: String) #-}
+
 main = hspec $ do
   describe "Session" $ do
     it "fails a test" $
@@ -157,7 +161,7 @@ main = hspec $ do
         noDiagnostics
 
         contents <- documentContents doc
-        liftIO $ contents `shouldBe` "main :: IO Int\nmain = return 42"
+        liftIO $ contents `shouldBe` "main :: IO Int\nmain = return 42\n"
 
   describe "getDocumentEdit" $
     it "automatically consumes applyedit requests" $
@@ -170,7 +174,7 @@ main = hspec $ do
             reqParams = ExecuteCommandParams "applyrefact:applyOne" (Just (List [args]))
         sendRequest_ WorkspaceExecuteCommand reqParams
         contents <- getDocumentEdit doc
-        liftIO $ contents `shouldBe` "main :: IO Int\nmain = return 42"
+        liftIO $ contents `shouldBe` "main :: IO Int\nmain = return 42\n"
         noDiagnostics
 
   describe "getAllCodeActions" $
Simple merge