debug icon indicating copy to clipboard operation
debug copied to clipboard

Omit `#class` for simple values

Open amomchilov opened this issue 2 years ago • 2 comments

Fixes Ruby/vscode-rdbg#37

This PR depends on the changes in https://github.com/ruby/debug/pull/1001. Only this last commit of this PR is unique to this change.

Description

The class of many values is self-evident and just clutters the UI:

Before After
image Screenshot 2023-07-28 at 9 29 43 AM

(false and nil don't have it, because of this bug described here)

This PR omits the usual #class member for instances of these classes:

  • NilClass
  • FalseClass
  • TrueClass
  • Symbol
  • String
  • Integer
  • Float
  • Class
  • Module
  • Array
  • Hash

The result is a much tidier UI you see in the "After" screenshot above.

This change still keeps the #class for other types, including subclasses of these simple types. For example, HashWithIndifferentAccess is a subclass of Hash. For clarity, we preserve its #class, but omit it for regular hashes.

Screenshot 2023-07-28 at 9 31 06 AM

amomchilov avatar Jul 28 '23 13:07 amomchilov

Class and Module is not clear with the names so I want to leave them.

ko1 avatar Jan 19 '24 03:01 ko1