Skip to content

Commit 0b0b80e

Browse files
committed
feat(debugger): increase the portion of the variable’s value displayed in the debug view
1 parent b0bf5c7 commit 0b0b80e

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

packages/debugger/src/robotcode/debugger/debugger.py

+18-3
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,19 @@ def __repr__(self) -> str:
9595
UNDEFINED = Undefined()
9696

9797

98+
class DebugRepr(reprlib.Repr):
99+
def __init__(self) -> None:
100+
super().__init__()
101+
self.maxtuple = 50
102+
self.maxlist = 50
103+
self.maxarray = 50
104+
self.maxdict = 500
105+
self.maxset = 50
106+
self.maxfrozenset = 50
107+
self.maxdeque = 50
108+
self.maxstring = 500
109+
110+
98111
class EvaluateResult(NamedTuple):
99112
result: str
100113
type: Optional[str] = None
@@ -1374,13 +1387,15 @@ def _new_cache_id(self) -> int:
13741387
self._variables_object_cache.append(o)
13751388
return id(o)
13761389

1390+
debug_repr = DebugRepr()
1391+
13771392
def _create_variable(self, name: str, value: Any) -> Variable:
13781393
if isinstance(value, Mapping):
13791394
v_id = self._new_cache_id()
13801395
self._variables_cache[v_id] = value
13811396
return Variable(
13821397
name=name,
1383-
value=reprlib.repr(value),
1398+
value=self.debug_repr.repr(value),
13841399
type=repr(type(value)),
13851400
variables_reference=v_id,
13861401
named_variables=len(value) + 1,
@@ -1393,15 +1408,15 @@ def _create_variable(self, name: str, value: Any) -> Variable:
13931408
self._variables_cache[v_id] = value
13941409
return Variable(
13951410
name=name,
1396-
value=reprlib.repr(value),
1411+
value=self.debug_repr.repr(value),
13971412
type=repr(type(value)),
13981413
variables_reference=v_id,
13991414
named_variables=1,
14001415
indexed_variables=len(value),
14011416
presentation_hint=VariablePresentationHint(kind="data"),
14021417
)
14031418

1404-
return Variable(name=name, value=repr(value), type=repr(type(value)))
1419+
return Variable(name=name, value=self.debug_repr.repr(value), type=repr(type(value)))
14051420

14061421
if get_robot_version() >= (7, 0):
14071422

0 commit comments

Comments
 (0)