Skip to content

Commit

Permalink
attempt to improve variables debug in debug server #1389
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrthomas committed Dec 5, 2020
1 parent 20ddb5c commit 43c8a90
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ private List<Map<String, Object>> variables(Number frameId) {
map.put("value", "(unknown)");
}
map.put("type", v.type.name());
switch (v.type) {
case LIST:
case MAP:
map.put("presentationHint", "data");
break;
default:
// do nothing
}
map.put("evaluateName", k);
// if > 0 , this can be used by client to request more info
map.put("variablesReference", 0);
Expand Down Expand Up @@ -196,6 +204,7 @@ private void handleRequest(DapMessage req, ChannelHandlerContext ctx) {
.body("supportsRestartRequest", true)
.body("supportsStepBack", true)
.body("supportsVariableType", true)
.body("supportsValueFormattingOptions", true)
.body("supportsClipboardContext", true));
ctx.write(event("initialized"));
ctx.write(event("output").body("output", "debug server listening on port: " + server.getPort() + "\n"));
Expand Down Expand Up @@ -281,7 +290,7 @@ private void handleRequest(DapMessage req, ChannelHandlerContext ctx) {
String reqContext = req.getArgument("context", String.class);
ScenarioRuntime evalContext = FRAMES.get(evalFrameId.longValue());
String result;
if ("clipboard".equals(reqContext)) {
if ("clipboard".equals(reqContext) || "hover".equals(reqContext)) {
try {
Variable v = evalContext.engine.vars.get(expression);
result = v.getAsPrettyString();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.intuit.karate.debug;

import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* mvn exec:java -Dexec.mainClass="com.intuit.karate.cli.Main" -Dexec.args="-d 4711" -Dexec.classpathScope=test
* @author pthomas3
*/
public class DapServerRunner {
class DapServerRunner {

@Test
public void testDap() {
Expand Down

0 comments on commit 43c8a90

Please sign in to comment.