Remove redundant dependencies
Supress some hlints
Prep cabal file
+dist
+dist-newstyle
+cabal.project.local*
+.ghc.environment.*
- 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.
+import Control.Applicative.Combinators
+import Control.Monad.IO.Class
import Language.Haskell.LSP.Test
import Language.Haskell.LSP.Types
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"
main = runSession "hie --lsp" "test/recordings/renamePass" $ do
docItem <- openDoc "Desktop/simple.hs" "haskell"
hs-source-dirs: src
exposed-modules: Language.Haskell.LSP.Test
, Language.Haskell.LSP.Test.Replay
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
default-language: Haskell2010
build-depends: base >= 4.7 && < 5
, haskell-lsp >= 0.4
, aeson
, ansi-terminal
, bytestring
, conduit
, conduit-parse
, bytestring
, conduit
, conduit-parse
, hspec
, lens
, data-default
, hspec
, lens
, data-default
- , directory
- , haskell-lsp-test
- , conduit
- , conduit-parse
, aeson
, unordered-containers
, text
default-language: Haskell2010
, aeson
, unordered-containers
, text
default-language: Haskell2010
+executable lsp-test-example
hs-source-dirs: example
main-is: Main.hs
default-language: Haskell2010
build-depends: base >= 4.7 && < 5
, haskell-lsp-test
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
, loggingNotification
, publishDiagnosticsNotification
-- * Combinators
, loggingNotification
, publishDiagnosticsNotification
-- * Combinators
- , choice
- , option
- , optional
- , between
- , some
- , many
- , sepBy
- , sepBy1
- , sepEndBy1
- , sepEndBy
- , endBy1
- , endBy
- , count
- , manyTill
- , skipMany
- , skipSome
- , skipManyTill
- , skipSomeTill
- , (<|>)
, satisfy
-- * Utilities
, initializeResponse
, satisfy
-- * Utilities
, initializeResponse
-import Control.Applicative
import Control.Applicative.Combinators
import Control.Concurrent
import Control.Monad
import Control.Applicative.Combinators
import Control.Concurrent
import Control.Monad
message :: forall a. (Typeable a, FromJSON a) => Session a
message =
let parser = decode . encodeMsg :: FromServerMessage -> Maybe a
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
-- | Matches if the message is a notification.
anyNotification :: Session FromServerMessage
import Data.Default
import qualified Data.HashMap.Strict as HM
import qualified Data.Text as T
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
import Control.Concurrent
import Control.Monad.IO.Class
import Control.Monad
import Language.Haskell.LSP.Test
import Language.Haskell.LSP.Test.Replay
import Language.Haskell.LSP.Types.Capabilities
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)
+{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}
+{-# ANN module ("HLint: ignore Unnecessary hiding" :: String) #-}
+
main = hspec $ do
describe "Session" $ do
it "fails a test" $
main = hspec $ do
describe "Session" $ do
it "fails a test" $
noDiagnostics
contents <- documentContents doc
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" $
describe "getDocumentEdit" $
it "automatically consumes applyedit requests" $
reqParams = ExecuteCommandParams "applyrefact:applyOne" (Just (List [args]))
sendRequest_ WorkspaceExecuteCommand reqParams
contents <- getDocumentEdit doc
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" $
noDiagnostics
describe "getAllCodeActions" $