use of com.perl5.lang.perl.idea.run.debugger.PerlDebugThread in project Perl5-IDEA by Camelcade.
the class PerlStackFrame method getEvaluator.
@Nullable
@Override
public XDebuggerEvaluator getEvaluator() {
return new XDebuggerEvaluator() {
@Override
public void evaluate(@NotNull String expression, @NotNull final XEvaluationCallback callback, @Nullable XSourcePosition expressionPosition) {
PerlDebugThread thread = myPerlExecutionStack.getSuspendContext().getDebugThread();
thread.sendCommandAndGetResponse("e", new PerlEvalRequestDescriptor(expression), new PerlDebuggingTransactionHandler() {
@Override
public void run(JsonObject jsonObject, JsonDeserializationContext jsonDeserializationContext) {
PerlEvalResponseDescriptor descriptor = jsonDeserializationContext.deserialize(jsonObject.getAsJsonObject("data"), PerlEvalResponseDescriptor.class);
if (descriptor == null) {
callback.errorOccurred("Something bad happened on Perl side. Report to plugin devs.");
} else if (descriptor.isError()) {
callback.errorOccurred(descriptor.getResult().getValue());
} else {
callback.evaluated(new PerlXNamedValue(descriptor.getResult(), PerlStackFrame.this));
}
}
});
}
};
}
use of com.perl5.lang.perl.idea.run.debugger.PerlDebugThread in project Perl5-IDEA by Camelcade.
the class PerlDebugUtil method requestAndComputeChildren.
public static void requestAndComputeChildren(@NotNull final XCompositeNode node, final PerlStackFrame perlStackFrame, final int[] offset, final int size, String key) {
PerlDebugThread thread = perlStackFrame.getPerlExecutionStack().getSuspendContext().getDebugThread();
final int frameSize = XCompositeNode.MAX_CHILDREN_TO_SHOW;
thread.sendCommandAndGetResponse("getchildren", new PerlValueRequestDescriptor(offset[0], frameSize, key), new PerlDebuggingTransactionHandler() {
@Override
public void run(JsonObject jsonObject, JsonDeserializationContext jsonDeserializationContext) {
PerlValueDescriptor[] descriptors = jsonDeserializationContext.deserialize(jsonObject.getAsJsonArray("data"), PerlValueDescriptor[].class);
XValueChildrenList list = new XValueChildrenList();
for (PerlValueDescriptor descriptor : descriptors) {
list.add(new PerlXNamedValue(descriptor, perlStackFrame));
offset[0]++;
}
boolean isLast = offset[0] >= size;
node.addChildren(list, isLast);
if (!isLast) {
node.tooManyChildren(size - offset[0]);
}
}
});
}
Aggregations