microsoft / microsoft/vscode-js-debug

Copy, store as `temp` and more from hover: allow global `customPropertiesGenerator` for user macros

Open
#1,779 2 comments 0 reactions 1 assignee View on GitHub

@connor4312 is already working on this.

Since Aug 5, 2023.

feature-request
Dominant language
TypeScript
Stars
2k
Forks
373
Avg merge
1d 9m
Merged PRs (30d)
6

Description

Is your feature request related to a problem? Please describe.

Hi! First of all, I want to thank you for adding this excellent feature (I'm really not sure what its deprecated), I have already added a lot of macros for general and more specific use. For example, when I go deeply when observing the properties of some object I want to store the value in a temp variable so I can call methods with specific arguments, copy its value, etc...

"customPropertiesGenerator": "function () { return {...this, get _storeAsTemp() { globalThis.temp = this; return true; } }",
Screenshot 2023-08-05 at 21 28 50

It could also be a button to call any function without writing a line in the console:

"customPropertiesGenerator": "function __() { const o = { ...this, get _storeAsTemp() { globalThis.temp = this; return true } }; if(typeof this === 'function' && this.length === 0) Object.defineProperty(o, '__functionResult', { get: () => this.apply(this) }); return o; },

Also, it would be useful to have a way to copy the access path to use it in debugging code later e.g. variable.items[0].text, however, it seems impossible with customPropertiesGenerator

Describe the feature you'd like

Probably add a global vscode setting so I add properties like _storeAsTemp to any configuration I launch, including the Node Terminal.

Also, can I have a few questions regarding this feature?

  • How to make it not show in the variables view? I have tried a few different things but didn't find a solution yet
  • I don't understand why it breaks [[Prototype]] property and why the copy function doesn't work in customPropertiesGenerator update: example from documentation is misleading you should never use rest syntax ... because of getters and prototype

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.