Skip to content

Extensible customDescriptionGenerator by default #1773

@hediet

Description

@hediet

I just discovered customDescriptionGenerator - I love it! I just wished it would be easier to configure.

At the moment, I have to stop and start a new debug session every time I change this property. It would be very nice if I could just change that property and it would update immediately!

Also, that property is not very well suited for more complex description generators. To work around this, I set a custom description generator that just delegates to globalThis.$$customDescription and then used my debug visualizer extension to inject a custom script into the debugger that sets this property.

Generally, I think it would make sense to have a default customDescriptionGenerator that can be overriden by setting a globalThis property - then extensions override this property at runtime without having to instruct the user to adjust the launch configuration.


This is how it looks currently:
Code_-_Insiders_1E5wQ7CtFK

This is what I managed to get with a customDescriptionGenerator:
UxPw3qXQbM

(maybe it makes sense to investigate if we can get this behavior by default, can we support custom description generators for property values in objects?)

I used this code:

globalThis.customDescription = (obj, def) => {
    if (Object.getPrototypeOf(obj) !== Object.getPrototypeOf({})) {
        return def;
    }

    const body = Object.entries(obj).map(([key, val]) => {
        return `${key}: ${val}`
    }).join(", ");
    return `{${body}}`;
}

And this custom description generator:

"customDescriptionGenerator": "function (def) { return globalThis.customDescription ? globalThis.customDescription(this, def) : def }"

Metadata

Metadata

Assignees

Labels

*duplicateIssue identified as a duplicate of another issue(s)feature-requestRequest for new features or functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions