@@ -72,6 +72,8 @@ module DAP.Types
7272 , PathFormat (.. )
7373 -- * Command
7474 , Command (.. )
75+ -- * Reverse Command
76+ , ReverseCommand (.. )
7577 -- * Event
7678 , EventType (.. )
7779 -- ** Events
@@ -121,6 +123,7 @@ module DAP.Types
121123 , LoadedSourcesResponse (.. )
122124 , ModulesResponse (.. )
123125 , ReadMemoryResponse (.. )
126+ , RunInTerminalResponse (.. )
124127 , ScopesResponse (.. )
125128 , SetExpressionResponse (.. )
126129 , SetVariableResponse (.. )
@@ -153,6 +156,8 @@ module DAP.Types
153156 , RestartArguments (.. )
154157 , RestartFrameArguments (.. )
155158 , ReverseContinueArguments (.. )
159+ , RunInTerminalRequestArguments (.. )
160+ , RunInTerminalRequestArgumentsKind (.. )
156161 , ScopesArguments (.. )
157162 , SetBreakpointsArguments (.. )
158163 , SetDataBreakpointsArguments (.. )
@@ -172,7 +177,6 @@ module DAP.Types
172177 , ThreadsArguments (.. )
173178 , VariablesArguments (.. )
174179 , WriteMemoryArguments (.. )
175- , RunInTerminalResponse (.. )
176180 -- * defaults
177181 , defaultBreakpoint
178182 , defaultBreakpointLocation
@@ -894,8 +898,6 @@ instance ToJSON EventType where
894898----------------------------------------------------------------------------
895899data Command
896900 = CommandCancel
897- | CommandRunInTerminal
898- | CommandStartDebugging
899901 | CommandInitialize
900902 | CommandConfigurationDone
901903 | CommandLaunch
@@ -954,6 +956,24 @@ instance ToJSON Command where
954956 toJSON (CustomCommand x) = toJSON x
955957 toJSON cmd = genericToJSONWithModifier cmd
956958----------------------------------------------------------------------------
959+ data ReverseCommand
960+ = ReverseCommandRunInTerminal
961+ | ReverseCommandStartDebugging
962+ deriving stock (Show , Eq , Read , Generic )
963+ ----------------------------------------------------------------------------
964+ instance FromJSON ReverseCommand where
965+ parseJSON = withText name $ \ command ->
966+ case readMaybe (name <> capitalize (T. unpack command)) of
967+ Just cmd ->
968+ pure cmd
969+ Nothing ->
970+ fail $ " Unknown reverse command: " ++ show command
971+ where
972+ name = show (typeRep (Proxy @ ReverseCommand ))
973+ ----------------------------------------------------------------------------
974+ instance ToJSON ReverseCommand where
975+ toJSON cmd = genericToJSONWithModifier cmd
976+ ----------------------------------------------------------------------------
957977data ErrorMessage
958978 = ErrorMessageCancelled
959979 | ErrorMessageNotStopped
@@ -2688,6 +2708,9 @@ data RunInTerminalRequestArgumentsKind
26882708 | RunInTerminalRequestArgumentsKindExternal
26892709 deriving stock (Show , Eq , Generic )
26902710----------------------------------------------------------------------------
2711+ instance ToJSON RunInTerminalRequestArgumentsKind where
2712+ toJSON = genericToJSONWithModifier
2713+ ----------------------------------------------------------------------------
26912714instance FromJSON RunInTerminalRequestArgumentsKind where
26922715 parseJSON = genericParseJSONWithModifier
26932716----------------------------------------------------------------------------
@@ -2728,6 +2751,9 @@ data RunInTerminalRequestArguments
27282751 --
27292752 } deriving stock (Show , Eq , Generic )
27302753----------------------------------------------------------------------------
2754+ instance ToJSON RunInTerminalRequestArguments where
2755+ toJSON = genericToJSONWithModifier
2756+ ----------------------------------------------------------------------------
27312757instance FromJSON RunInTerminalRequestArguments where
27322758 parseJSON = genericParseJSONWithModifier
27332759----------------------------------------------------------------------------
0 commit comments