Skip to content

haskell-debugger/dap

Repository files navigation

dap

A Debug Adaptor Protocol (DAP) library.

This library can be used for constructing debug adaptors for any programming language.

Table of Contents

  1. Usage
  2. Build
  3. Develop
  4. Test
  5. Docs

Usage

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"

Build

$ cabal build
$ stack build
$ nix build

Develop

$ nix-shell --run ghcid

Test

$ cabal test
$ stack test

Docs

$ stack haddock
$ cabal haddock

About

Debug Adaptor Protocol (DAP) implementation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published