haskell-lsp 0.8.1.0 → 0.8.2.0
raw patch · 4 files changed
+40/−2 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +6/−0
- haskell-lsp.cabal +2/−1
- src/Language/Haskell/LSP/Core.hs +7/−1
- test/WorkspaceEditSpec.hs +25/−0
ChangeLog.md view
@@ -1,5 +1,11 @@ # Revision history for haskell-lsp +## 0.8.2.0 -- 2019-04-11++* Add `applyTextEdit` and `editTextEdit` helpers+* Set the typedefinitionProvider capability if it has a handler+* Add stack files for GHC 8.4.4 and 8.6.4+ ## 0.8.1.0 -- 2019-02-28 * Update Handler to delegate to typeDefinitionHandler instead of
haskell-lsp.cabal view
@@ -1,5 +1,5 @@ name: haskell-lsp-version: 0.8.1.0+version: 0.8.2.0 synopsis: Haskell library for the Microsoft Language Server Protocol description: An implementation of the types, and basic message server to@@ -99,6 +99,7 @@ ServerCapabilitiesSpec URIFilePathSpec VspSpec+ WorkspaceEditSpec WorkspaceFoldersSpec build-depends: base , aeson
src/Language/Haskell/LSP/Core.hs view
@@ -600,6 +600,12 @@ supported (Just _) = Just True supported Nothing = Nothing + -- If a dynamic setting is provided use it, else set a+ -- static True if there is a handler.+ static (Just d) _ = Just d+ static _ (Just _) = Just (J.GotoOptionsStatic True)+ static _ Nothing = Nothing+ sync = case textDocumentSync o of Just x -> Just (J.TDSOptions x) Nothing -> Nothing@@ -618,7 +624,7 @@ , J._completionProvider = completionProvider o , J._signatureHelpProvider = signatureHelpProvider o , J._definitionProvider = supported (definitionHandler h)- , J._typeDefinitionProvider = typeDefinitionProvider o+ , J._typeDefinitionProvider = static (typeDefinitionProvider o) (typeDefinitionHandler h) , J._implementationProvider = implementationProvider o , J._referencesProvider = supported (referencesHandler h) , J._documentHighlightProvider = supported (documentHighlightHandler h)
+ test/WorkspaceEditSpec.hs view
@@ -0,0 +1,25 @@+{-# LANGUAGE OverloadedStrings #-}+module WorkspaceEditSpec where++import Test.Hspec+import Language.Haskell.LSP.Types++spec :: Spec+spec = do+ describe "applyTextEdit" $ do+ it "inserts text" $+ let te = TextEdit (Range (Position 1 2) (Position 1 2)) "foo"+ in applyTextEdit te "lorem\nipsum\ndolor" `shouldBe` "lorem\nipfoosum\ndolor"+ it "deletes text" $+ let te = TextEdit (Range (Position 0 2) (Position 1 2)) ""+ in applyTextEdit te "lorem\nipsum\ndolor" `shouldBe` "losum\ndolor"+ it "edits a multiline text" $+ let te = TextEdit (Range (Position 1 0) (Position 2 0)) "slorem"+ in applyTextEdit te "lorem\nipsum\ndolor" `shouldBe` "lorem\nsloremdolor"++ describe "editTextEdit" $+ it "edits a multiline text edit" $+ let orig = TextEdit (Range (Position 1 1) (Position 2 2)) "hello\nworld"+ inner = TextEdit (Range (Position 0 3) (Position 1 3)) "ios\ngo" + expected = TextEdit (Range (Position 1 1) (Position 2 2)) "helios\ngold"+ in editTextEdit orig inner `shouldBe` expected