X-Git-Url: http://git.lukelau.me/?a=blobdiff_plain;f=src%2FLanguage%2FHaskell%2FLSP%2FTest.hs;h=3b40842dd7ff169c69e3b1bbb3e2210a4d0eaaf0;hb=12f6e7e7c1d2603712de134477a470bfa72ecf4b;hp=b7a746ed26f4999e6b86c73d6a1ec74c01c3ba73;hpb=eab96ad6f11e0f76380d9cc600724f94c4523915;p=lsp-test.git diff --git a/src/Language/Haskell/LSP/Test.hs b/src/Language/Haskell/LSP/Test.hs index b7a746e..3b40842 100644 --- a/src/Language/Haskell/LSP/Test.hs +++ b/src/Language/Haskell/LSP/Test.hs @@ -65,6 +65,7 @@ module Language.Haskell.LSP.Test , getReferences -- ** Definitions , getDefinitions + , getTypeDefinitions -- ** Renaming , rename -- ** Hover @@ -91,9 +92,10 @@ import Data.Default import qualified Data.HashMap.Strict as HashMap import qualified Data.Map as Map import Data.Maybe -import Language.Haskell.LSP.Types hiding +import Language.Haskell.LSP.Types +import Language.Haskell.LSP.Types.Lens hiding (id, capabilities, message, executeCommand, applyEdit, rename) -import qualified Language.Haskell.LSP.Types as LSP +import qualified Language.Haskell.LSP.Types.Lens as LSP import qualified Language.Haskell.LSP.Types.Capabilities as C import Language.Haskell.LSP.Messages import Language.Haskell.LSP.VFS @@ -154,6 +156,10 @@ runSessionWithConfig config serverExe caps rootDir session = do sendNotification Initialized InitializedParams + case lspConfig config of + Just cfg -> sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams cfg) + Nothing -> return () + -- Run the actual test result <- session @@ -489,6 +495,14 @@ getDefinitions doc pos = let params = TextDocumentPositionParams doc pos in getResponseResult <$> request TextDocumentDefinition params +-- | Returns the type definition(s) for the term at the specified position. +getTypeDefinitions :: TextDocumentIdentifier -- ^ The document the term is in. + -> Position -- ^ The position the term is at. + -> Session [Location] -- ^ The location(s) of the definitions +getTypeDefinitions doc pos = + let params = TextDocumentPositionParams doc pos + in getResponseResult <$> request TextDocumentTypeDefinition params + -- | Renames the term at the specified position. rename :: TextDocumentIdentifier -> Position -> String -> Session () rename doc pos newName = do