From d92e6e9f3d8843c71ad50ba2407ed4c8d9da4aa3 Mon Sep 17 00:00:00 2001 From: Elizaveta Shashkova Date: Wed, 16 Mar 2016 16:57:46 +0300 Subject: [PATCH] Fix expanding collections with long values in debugger (PY-16866) When we view the value of the long variable, we run Evaluate expression command instead of Get Variable, so we need prepare variables for the Python side. --- .../python/debugger/PyDebugValue.java | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/python/pydevSrc/com/jetbrains/python/debugger/PyDebugValue.java b/python/pydevSrc/com/jetbrains/python/debugger/PyDebugValue.java index b713616424b1..e0962e5f6aea 100644 --- a/python/pydevSrc/com/jetbrains/python/debugger/PyDebugValue.java +++ b/python/pydevSrc/com/jetbrains/python/debugger/PyDebugValue.java @@ -133,15 +133,30 @@ public class PyDebugValue extends XNamedValue { return "__len__".equals(name); } + private static boolean isCollection(@NotNull PyDebugValue parent) { + String type = parent.getType(); + return type.equals("dict") || type.equals("list"); + } + + private static String getChildNamePresentation(@NotNull PyDebugValue parent, @NotNull String childName) { + if (isCollection(parent)) { + return "[".concat(removeId(childName)).concat("]"); + } + else { + return ".".concat(childName); + } + } + private String getFullName() { - String result = myName; + String result = ""; + String curNodeName = myName; PyDebugValue parent = myParent; while (parent != null) { - result = "." + result; - result = parent.getName() + result; + result = getChildNamePresentation(parent, curNodeName).concat(result); + curNodeName = parent.getName(); parent = parent.getParent(); } - return result; + return curNodeName.concat(result); } @Override