MCPcopy Create free account
hub / github.com/SpartanJ/eepp / evaluate

Method evaluate

src/tools/ecode/plugins/debugger/dap/debuggerclientdap.cpp:922–954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

920}
921
922bool DebuggerClientDap::evaluate(
923 const std::string& expression, const std::string& context, std::optional<int> frameId,
924 std::function<void( const std::string&, const std::optional<EvaluateInfo>& )> cb ) {
925 nlohmann::json arguments{ { DAP_EXPRESSION, expression } };
926 if ( !context.empty() )
927 arguments[DAP_CONTEXT] = context;
928 if ( frameId )
929 arguments[DAP_FRAME_ID] = *frameId;
930
931 makeRequest(
932 "evaluate", arguments,
933 [this, cb = std::move( cb )]( const auto& response, const auto& request ) {
934 auto expression = request.value( DAP_EXPRESSION, "" );
935 if ( response.success ) {
936 EvaluateInfo info( response.body );
937
938 for ( auto listener : mListeners )
939 listener->expressionEvaluated( expression, info, mCurrentSessionId );
940
941 if ( cb )
942 cb( expression, info );
943 } else {
944 for ( auto listener : mListeners )
945 listener->expressionEvaluated( expression, std::nullopt, mCurrentSessionId );
946
947 if ( cb )
948 cb( expression, std::nullopt );
949 }
950 },
951 mCurrentSessionId );
952
953 return true;
954}
955
956bool DebuggerClientDap::setBreakpoints( const std::string& path,
957 const std::vector<dap::SourceBreakpoint>& breakpoints,

Callers 2

onMouseMoveMethod · 0.80
evaluateExpressionMethod · 0.80

Calls 3

expressionEvaluatedMethod · 0.80
emptyMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected