Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 403bd80

Browse files
authored
Expose send and sendRaw functions (#3)
1 parent 435bd34 commit 403bd80

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎dap/src/DAP/Adaptor.hs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ module DAP.Adaptor
6767
, getNextSourceReferenceId
6868
, getSourcePathBySourceReferenceId
6969
, addSourcePathBySourceReferenceId
70+
-- * Internal use
71+
, send
72+
, sendRaw
7073
) where
7174
----------------------------------------------------------------------------
7275
import Control.Concurrent ( ThreadId )
@@ -226,6 +229,16 @@ getAppStore = gets appStore
226229
getCommand :: Adaptor app Command
227230
getCommand = command <$> gets request
228231
----------------------------------------------------------------------------
232+
-- | 'sendRaw' (internal use only)
233+
-- Sends a raw JSON payload to the editor. No "seq", "type" or "command" fields are set.
234+
-- The message is still encoded with the ProtocolMessage Header, byte count, and CRLF.
235+
--
236+
sendRaw :: ToJSON value => value -> Adaptor app ()
237+
sendRaw value = do
238+
handle <- getHandle
239+
address <- getAddress
240+
writeToHandle address handle value
241+
----------------------------------------------------------------------------
229242
-- | Function for constructing a payload and writing bytes to a socket.
230243
-- This function takes care of incrementing sequence numbers
231244
-- and setting fields automatically that are required for 'response' messages.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /