vscode-js-debug icon indicating copy to clipboard operation
vscode-js-debug copied to clipboard

Support evaluateName for all variable references

Open hediet opened this issue 1 year ago • 0 comments

Sometimes, there can be anonymous variable references, like this:

image

It would be nice if these variable references also have an evaluateName that can act as a js variable name for evaluate calls.

This evaluateName should be safe to use in expression, e.g. myFunction(${myVar.evaluateName}). This means, before evaluating expressions, these evaluateNames have to be pre-processed. If you use replaceAll, make sure the evaluateName is long enough (256 bits should be fine) to avoid any accidental replacements.

To be consistent, the evaluateName only works for the given frame id, so you cannot mix variables from different frame ids in one expression.

CDP has these things that might be helpful:

  • https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#type-RemoteObjectId
  • https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#method-callFunctionOn

hediet avatar Jan 24 '24 10:01 hediet