Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use custom toString() methods to generate object descriptions #1296

Merged
merged 2 commits into from
Jun 9, 2022

Conversation

connor4312
Copy link
Member

Closes #1284

@connor4312 connor4312 added this to the June 2022 milestone Jun 8, 2022
@connor4312 connor4312 requested a review from hediet June 8, 2022 12:12
@connor4312 connor4312 self-assigned this Jun 8, 2022
}

for (const [key, value] of Object.entries(this)) {
if (typeof value === 'object' && value && !String(this.toString).includes('[native code]')) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This detection is a bit ugly. Not sure if there's a more clever way to do this. Simply this.toString === Object.prototype.toString isn't enough because that also incorrectly stringifies boxed types, errors, and arrays.

@connor4312 connor4312 force-pushed the feat/to-string-object-descriptions branch from 9633741 to 44f2dd3 Compare June 8, 2022 12:17
hediet
hediet previously approved these changes Jun 8, 2022
@connor4312 connor4312 merged commit c92cc13 into main Jun 9, 2022
@connor4312 connor4312 deleted the feat/to-string-object-descriptions branch June 9, 2022 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Show toString of Objects In Hover
2 participants