Skip to content

Commit 57a98e2

Browse files
authored
Mark native frames and unavailable methods as subtle (microsoft#409)
This causes some clients to display the frames in a different way, e.g by graying them out.
1 parent d1f2da5 commit 57a98e2

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/StackTraceRequestHandler.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ private Types.StackFrame convertDebuggerStackFrameToClient(StackFrame stackFrame
9595
String methodName = formatMethodName(method, true, true);
9696
int lineNumber = AdapterUtils.convertLineNumber(location.lineNumber(), context.isDebuggerLinesStartAt1(), context.isClientLinesStartAt1());
9797
// Line number returns -1 if the information is not available; specifically, always returns -1 for native methods.
98+
String presentationHint = null;
9899
if (lineNumber < 0) {
100+
presentationHint = "subtle";
99101
if (method.isNative()) {
100102
// For native method, display a tip text "native method" in the Call Stack View.
101103
methodName += "[native method]";
@@ -105,7 +107,7 @@ private Types.StackFrame convertDebuggerStackFrameToClient(StackFrame stackFrame
105107
clientSource = null;
106108
}
107109
}
108-
return new Types.StackFrame(frameId, methodName, clientSource, lineNumber, context.isClientColumnsStartAt1() ? 1 : 0);
110+
return new Types.StackFrame(frameId, methodName, clientSource, lineNumber, context.isClientColumnsStartAt1() ? 1 : 0, presentationHint);
109111
}
110112

111113
private Types.Source convertDebuggerSourceToClient(Location location, IDebugAdapterContext context) throws URISyntaxException {

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/protocol/Types.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public static class StackFrame {
4343
public int line;
4444
public int column;
4545
public String name;
46+
public String presentationHint;
47+
4648

4749
/**
4850
* Constructs a StackFrame with the given information.
@@ -57,13 +59,17 @@ public static class StackFrame {
5759
* line number of the stack frame
5860
* @param col
5961
* column number of the stack frame
62+
* @param presentationHint
63+
* An optional hint for how to present this frame in the UI.
64+
* Values: 'normal', 'label', 'subtle'
6065
*/
61-
public StackFrame(int id, String name, Source src, int ln, int col) {
66+
public StackFrame(int id, String name, Source src, int ln, int col, String presentationHint) {
6267
this.id = id;
6368
this.name = name;
6469
this.source = src;
6570
this.line = ln;
6671
this.column = col;
72+
this.presentationHint = presentationHint;
6773
}
6874
}
6975

0 commit comments

Comments
 (0)