Search in sources :

Example 6 with XValueChildrenList

use of com.intellij.xdebugger.frame.XValueChildrenList in project intellij-elixir by KronicDeth.

the class ElixirMappingXValue method computeChildren.

@Override
public void computeChildren(@NotNull XCompositeNode node) {
    XValueChildrenList children = new XValueChildrenList(2);
    addNamedChild(children, getMappingKey(), "key");
    addNamedChild(children, getMappingValue(), "value");
    node.addChildren(children, true);
}
Also used : XValueChildrenList(com.intellij.xdebugger.frame.XValueChildrenList)

Example 7 with XValueChildrenList

use of com.intellij.xdebugger.frame.XValueChildrenList in project intellij-plugins by JetBrains.

the class DartVmServiceStackFrame method addVars.

private void addVars(@NotNull final XCompositeNode node, @NotNull final ElementList<BoundVariable> vars) {
    final XValueChildrenList childrenList = new XValueChildrenList(vars.size());
    for (BoundVariable var : vars) {
        final InstanceRef value = var.getValue();
        if (value != null) {
            final DartVmServiceValue.LocalVarSourceLocation varLocation = "this".equals(var.getName()) ? null : new DartVmServiceValue.LocalVarSourceLocation(myVmFrame.getLocation().getScript(), var.getDeclarationTokenPos());
            childrenList.add(new DartVmServiceValue(myDebugProcess, myIsolateId, var.getName(), value, varLocation, null, false));
        }
    }
    node.addChildren(childrenList, true);
}
Also used : XValueChildrenList(com.intellij.xdebugger.frame.XValueChildrenList)

Example 8 with XValueChildrenList

use of com.intellij.xdebugger.frame.XValueChildrenList in project intellij-elixir by KronicDeth.

the class ElixirStackFrame method computeChildren.

@Override
public void computeChildren(@NotNull XCompositeNode node) {
    XValueChildrenList myVariables = new XValueChildrenList(myTraceElement.getBindings().size());
    for (ElixirVariableBinding binding : myTraceElement.getBindings()) {
        myVariables.add(binding.getName(), getVariableValue(binding.getValue()));
    }
    node.addChildren(myVariables, true);
}
Also used : ElixirVariableBinding(org.elixir_lang.debugger.node.ElixirVariableBinding) XValueChildrenList(com.intellij.xdebugger.frame.XValueChildrenList)

Example 9 with XValueChildrenList

use of com.intellij.xdebugger.frame.XValueChildrenList in project go-lang-idea-plugin by go-lang-plugin-org.

the class DlvStackFrame method computeChildren.

@Override
public void computeChildren(@NotNull XCompositeNode node) {
    send(new DlvRequest.ListLocalVars(myId)).done(variables -> {
        XValueChildrenList xVars = new XValueChildrenList(variables.size());
        for (DlvApi.Variable v : variables) xVars.add(v.name, createXValue(v, GoIcons.VARIABLE));
        send(new DlvRequest.ListFunctionArgs(myId)).done(args -> {
            for (DlvApi.Variable v : args) xVars.add(v.name, createXValue(v, GoIcons.PARAMETER));
            node.addChildren(xVars, true);
        });
    });
}
Also used : XValueChildrenList(com.intellij.xdebugger.frame.XValueChildrenList) DlvApi(com.goide.dlv.protocol.DlvApi)

Example 10 with XValueChildrenList

use of com.intellij.xdebugger.frame.XValueChildrenList in project intellij-plugins by JetBrains.

the class FlexStackFrame method computeChildren.

@Override
public void computeChildren(@NotNull final XCompositeNode node) {
    List<DebuggerCommand> commands = new ArrayList<>();
    commands.add(new MyDebuggerCommand("print this", node, true, FlexValue.ValueType.This));
    commands.add(new MyDebuggerCommand("info arguments", node, false, FlexValue.ValueType.Parameter));
    commands.add(new MyDebuggerCommand("info locals", node, false, FlexValue.ValueType.Variable));
    if (mySourcePosition != null) {
        commands.add(new DebuggerCommand("does not matter", CommandOutputProcessingType.SPECIAL_PROCESSING) {

            @Override
            public void post(FlexDebugProcess flexDebugProcess) throws IOException {
                ensureQName2IdMapLoaded();
                final XValueChildrenList resultChildren = new XValueChildrenList(1);
                Boolean insideFunExpr = ReadAction.compute(() -> {
                    Project project = getDebugProcess().getSession().getProject();
                    PsiElement element = XDebuggerUtil.getInstance().findContextElement(mySourcePosition.getFile(), mySourcePosition.getOffset(), project, true);
                    JSFunction function = PsiTreeUtil.getParentOfType(element, JSFunction.class);
                    return function instanceof JSFunctionExpression;
                });
                if (Boolean.TRUE.equals(insideFunExpr)) {
                    // public function outer(outerArg:String):Function {
                    //     return function middle(middleArg:String):Function {
                    //         return function inner(innerArg:String):String {
                    //             return outerArg + middleArg + innerArg; // [BREAKPOINT]
                    //         }
                    //     }
                    // }
                    //
                    // info scopechain gives following:
                    // 0 = [Object 103989057, class='global']
                    // 1 = [Object 101988361, class='Object']
                    // 2 = [Object 101989657, class='<anonymous>']
                    // 3 = [Object 103989057, class='global']
                    // 4 = [Object 102001417, class='Object']
                    // 5 = [Object 102001873, class='pack::HelloFlex4/outer']
                    // 6 = [Object 106803361, class='pack::HelloFlex4']
                    // 7 = [Object 105768929, class='pack::HelloFlex4$']
                    // 8 = [Object 54750369, class='spark.components::Application$']
                    // 9 = ...
                    // Interesting for us: closures and one object after the last closure,
                    // i.e. in this case #2, #5 and #6.
                    scopeChain = new ArrayList<>(2);
                    String firstTokenAfterLastClosure = null;
                    for (String token : qName2IdMap.keySet()) {
                        final int slashIndex = token.indexOf('/');
                        if (slashIndex != -1 || token.contains(ANONYMOUS)) {
                            final String funName = token.substring(slashIndex + 1);
                            addScopeChainElement(token, funName, resultChildren);
                        } else if (firstTokenAfterLastClosure == null && resultChildren.size() > 0) {
                            firstTokenAfterLastClosure = token;
                        }
                    }
                    if (firstTokenAfterLastClosure != null) {
                        addScopeChainElement(firstTokenAfterLastClosure, firstTokenAfterLastClosure, resultChildren);
                    }
                }
                node.addChildren(resultChildren, false);
            }

            @Override
            public String read(FlexDebugProcess flexDebugProcess) throws IOException {
                return "";
            }

            private void addScopeChainElement(final String token, final String funName, final XValueChildrenList resultChildren) {
                final String id = qName2IdMap.get(token);
                final String path = "#" + validObjectId(id);
                scopeChain.add(path);
                final String name = "Locals of " + funName;
                final String flexValueResult = "[Object " + id + CLASS_MARKER + token + "']";
                resultChildren.add(name, new FlexValue(FlexStackFrame.this, myDebugProcess, mySourcePosition, name, path, flexValueResult, null, FlexValue.ValueType.ScopeChainEntry));
            }
        });
    }
    myDebugProcess.sendCommand(new CompositeDebuggerCommand(node, commands.toArray(new DebuggerCommand[commands.size()])) {

        @Override
        protected void obsolete() {
            super.obsolete();
            node.addChildren(XValueChildrenList.EMPTY, true);
        }

        @Override
        protected void succeeded() {
            super.succeeded();
            node.addChildren(XValueChildrenList.EMPTY, true);
        }
    });
}
Also used : IOException(java.io.IOException) XValueChildrenList(com.intellij.xdebugger.frame.XValueChildrenList) Project(com.intellij.openapi.project.Project)

Aggregations

XValueChildrenList (com.intellij.xdebugger.frame.XValueChildrenList)16 DlvApi (com.goide.dlv.protocol.DlvApi)1 Project (com.intellij.openapi.project.Project)1 XValue (com.intellij.xdebugger.frame.XValue)1 PyDebugValue (com.jetbrains.python.debugger.PyDebugValue)1 IOException (java.io.IOException)1 ElixirVariableBinding (org.elixir_lang.debugger.node.ElixirVariableBinding)1 Nullable (org.jetbrains.annotations.Nullable)1