Skip to content

repr () not used in window displays (Issue #1661 continued) #114

Description

@mrolle45

In safe_repr.py, ptvsd estimates whether repr (obj) might be too long to send to the IDE. In my code, I have a class derived from list, and if I have more than two levels of nesting, it is considered too long.

Please consider the following solution: If the obj being displayed has a method called 'safe_repr', then this is called directly. I put the following in my local copy of safe_repr.py:
def call(self, obj):

  •    try: return obj.__safe_repr__ ()
    
  •    except Exception: pass
    

The name 'safe_repr' is something I made up. You might want to provide some other way to tell SafeRepr (obj) that repr (obj) is OK to use.

Environment data

  • VS Code version: 2017
  • OS and version: Windows 10
  • Python version: 3.7

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions