@@ -88,10 +88,24 @@ getConfig = do
88
88
let
89
89
hostDefault = " 127.0.0.1"
90
90
portDefault = 4711
91
+ capabilities = defaultCapabilities
92
+ { supportsConfigurationDoneRequest = True
93
+ , supportsHitConditionalBreakpoints = True
94
+ , supportsEvaluateForHovers = False
95
+ , supportsModulesRequest = True
96
+ , additionalModuleColumns = [ defaultColumnDescriptor
97
+ { columnDescriptorAttributeName = " Extra"
98
+ , columnDescriptorLabel = " Label"
99
+ }
100
+ ]
101
+ , supportsValueFormattingOptions = True
102
+ , supportTerminateDebuggee = True
103
+ , supportsLoadedSourcesRequest = True
104
+ }
91
105
ServerConfig
92
106
<$> do fromMaybe hostDefault <$> lookupEnv " DAP_HOST"
93
107
<*> do fromMaybe portDefault . (readMaybe =<< ) <$> do lookupEnv " DAP_PORT"
94
- <*> pure defaultCapabilities
108
+ <*> pure capabilities
95
109
<*> pure True
96
110
----------------------------------------------------------------------------
97
111
-- | VSCode arguments are custom for attach
@@ -211,15 +225,6 @@ handleDebuggerExceptions e = do
211
225
sendTerminatedEvent (TerminatedEvent False )
212
226
sendExitedEvent (ExitedEvent 1 )
213
227
214
- pathToName path =
215
- case splitFileName (cs path) of
216
- (init -> moduleName, takeExtension -> " .ghccore" ) ->
217
- cs (moduleName <> " .core" )
218
- (init -> moduleName, takeExtension -> " .stgbin" ) ->
219
- cs (moduleName <> " .stg" )
220
- (init -> moduleName, takeExtension -> ext) ->
221
- cs (moduleName <> ext)
222
-
223
228
----------------------------------------------------------------------------
224
229
-- | Clears the currently known breakpoint set
225
230
clearBreakpoints :: Adaptor ESTG ()
@@ -431,7 +436,6 @@ talk CommandSource = do
431
436
sendSourceResponse (SourceResponse source Nothing )
432
437
----------------------------------------------------------------------------
433
438
talk CommandThreads = do
434
- resetObjectLifetimes
435
439
allThreads <- IntMap. toList . ssThreads <$> getStgState
436
440
sendThreadsResponse
437
441
[ Thread
@@ -481,6 +485,18 @@ talk CommandSetExceptionBreakpoints = sendSetExceptionBreakpointsResponse []
481
485
talk CommandSetFunctionBreakpoints = sendSetFunctionBreakpointsResponse []
482
486
talk CommandSetInstructionBreakpoints = sendSetInstructionBreakpointsResponse []
483
487
----------------------------------------------------------------------------
488
+ talk CommandEvaluate = do
489
+ EvaluateArguments {.. } <- getArguments
490
+ sendEvaluateResponse EvaluateResponse
491
+ { evaluateResponseResult = " evaluated value for " <> evaluateArgumentsExpression
492
+ , evaluateResponseType = " evaluated type for " <> evaluateArgumentsExpression
493
+ , evaluateResponsePresentationHint = Nothing
494
+ , evaluateResponseVariablesReference = 1
495
+ , evaluateResponseNamedVariables = Just 1
496
+ , evaluateResponseIndexedVariables = Nothing
497
+ , evaluateResponseMemoryReference = Nothing
498
+ }
499
+ ----------------------------------------------------------------------------
484
500
talk cmd = logInfo $ BL8. pack (" GOT cmd " <> show cmd)
485
501
----------------------------------------------------------------------------
486
502
@@ -620,13 +636,15 @@ generateScopesForTopStackFrame frameIdDesc closureId env = do
620
636
scopeVarablesRef <- getVariablesRef $ VariablesRef_StackFrameVariables frameIdDesc
621
637
setVariables scopeVarablesRef
622
638
[ defaultVariable
623
- { variableName = cs binderName <> ( if binderScope == ModulePublic then " " else cs ( ' _ ' : show u))
639
+ { variableName = displayName
624
640
, variableValue = cs variableValue
625
641
, variableType = Just (cs variableType)
642
+ , variableEvaluateName = Just $ displayName <> " evaluate"
626
643
}
627
644
| (Id (Binder {.. }), (_, atom)) <- M. toList env
628
645
, let (variableType, variableValue) = getAtomTypeAndValue atom
629
646
BinderId u = binderId
647
+ displayName = if binderScope == ModulePublic then cs binderName else cs (show u)
630
648
]
631
649
pure
632
650
[ defaultScope
@@ -656,13 +674,15 @@ generateScopes frameIdDesc stackCont@(CaseOf _ closureId env _ _ _) = do
656
674
-- DMJ: for now everything is local.
657
675
-- Inspect StaticOrigin to put things top-level, or as arguments, where applicable
658
676
[ defaultVariable
659
- { variableName = cs binderName <> ( if binderScope == ModulePublic then " " else cs ( ' _ ' : show u))
677
+ { variableName = displayName
660
678
, variableValue = cs variableValue
661
679
, variableType = Just (cs variableType)
680
+ , variableEvaluateName = Just $ displayName <> " evaluate"
662
681
}
663
682
| (Id (Binder {.. }), (_, atom)) <- M. toList env
664
683
, let (variableType, variableValue) = getAtomTypeAndValue atom
665
684
BinderId u = binderId
685
+ displayName = if binderScope == ModulePublic then cs binderName else cs (show u)
666
686
]
667
687
pure
668
688
[ defaultScope
@@ -1101,7 +1121,7 @@ getSourceName qualifiedModuleName = \case
1101
1121
GhcStg -> cs qualifiedModuleName <> " .ghcstg"
1102
1122
Cmm -> cs qualifiedModuleName <> " .cmm"
1103
1123
Asm -> cs qualifiedModuleName <> " .s"
1104
- ExtStg -> cs qualifiedModuleName <> " .stgbin"
1124
+ ExtStg -> cs qualifiedModuleName <> " .stgbin.hs "
1105
1125
FFICStub -> cs qualifiedModuleName <> " _stub.c"
1106
1126
FFIHStub -> cs qualifiedModuleName <> " _stub.h"
1107
1127
ForeignC -> cs qualifiedModuleName
0 commit comments