diff --git a/service/dap/server.go b/service/dap/server.go index 39e74a82..664944d4 100644 --- a/service/dap/server.go +++ b/service/dap/server.go @@ -1272,7 +1272,7 @@ func (s *Server) convertVariableWithOpts(v *proc.Variable, qualifiedNameOrExpr s // variables, so consider also adding the following: // -- print {expression} - return the result as a string like from dlv cli func (s *Server) onEvaluateRequest(request *dap.EvaluateRequest) { - showErrorToUser := request.Arguments.Context != "watch" + showErrorToUser := request.Arguments.Context != "watch" && request.Arguments.Context != "repl" if s.debugger == nil { s.sendErrorResponseWithOpts(request.Request, UnableToEvaluateExpression, "Unable to evaluate expression", "debugger is nil", showErrorToUser) return diff --git a/service/dap/server_test.go b/service/dap/server_test.go index 73cd7e4b..7c5e3265 100644 --- a/service/dap/server_test.go +++ b/service/dap/server_test.go @@ -197,7 +197,7 @@ func TestLaunchStopOnEntry(t *testing.T) { // 10 >> evaluate, << error client.EvaluateRequest("foo", 0 /*no frame specified*/, "repl") - erResp := client.ExpectVisibleErrorResponse(t) + erResp := client.ExpectErrorResponse(t) if erResp.Seq != 0 || erResp.RequestSeq != 10 || erResp.Body.Error.Id != 2009 { t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=10 Id=2009", erResp) } @@ -323,7 +323,7 @@ func TestAttachStopOnEntry(t *testing.T) { // 10 >> evaluate, << error client.EvaluateRequest("foo", 0 /*no frame specified*/, "repl") - erResp := client.ExpectVisibleErrorResponse(t) + erResp := client.ExpectErrorResponse(t) if erResp.Seq != 0 || erResp.RequestSeq != 10 || erResp.Body.Error.Id != 2009 { t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=10 Id=2009", erResp) }