A Debug Adaptor Protocol (DAP) library.
This library can be used for constructing debug adaptors for any programming language.
For a real-world implementation see the haskell-estgi-debugger.
module Main where
import DAP
-- | Runs server in main thread
--
main :: IO ()
main = runDAPServer config mockServerTalk
where
capabilities = defaultCapabilities
{ supportsConfigurationDoneRequest = True
, supportsHitConditionalBreakpoints = True
, supportsModulesRequest = True
, additionalModuleColumns = [ defaultColumnDescriptor
{ columnDescriptorAttributeName = "Extra"
, columnDescriptorLabel = "Label"
}
]
, supportsValueFormattingOptions = True
, supportTerminateDebuggee = True
, supportsLoadedSourcesRequest = True
}
config = ServerConfig
{ host = testHost
, port = testPort
, serverCapabilities = capabilities
, debugLogging = False
}
-- | Mock server communication, used in test runner
--
mockServerTalk
:: Command
-> Adaptor app ()
mockServerTalk CommandInitialize = do
sendInitializeResponse
sendInitializedEvent
mockServerTalk CommandConfigurationDone = do
sendConfigurationDoneResponse
sendStoppedEvent defaultStoppedEvent
-- | Sample port shared amongst client and server
--
testPort :: Int
testPort = 8001
-- | Sample host shared amongst client and server
--
testHost :: String
testHost = "localhost"
$ cabal build
$ stack build
$ nix build
$ nix-shell --run ghcid
$ cabal test
$ stack test
$ stack haddock
$ cabal haddock