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

JS debug console gives errors on a couple common Array functions #1201

Closed
kruchkamgar opened this issue Feb 10, 2022 · 14 comments
Closed

JS debug console gives errors on a couple common Array functions #1201

kruchkamgar opened this issue Feb 10, 2022 · 14 comments
Assignees
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@kruchkamgar
Copy link

simple Array functions, executed in the JS debug console, appear to result in errors. (sample shown below)

[1,2,3].find(key => key > 2)
Uncaught SyntaxError: Invalid destructuring assignment target
[1,2,3].filter(key => key > 2)
Uncaught SyntaxError: Invalid destructuring assignment target

To Reproduce
Steps to reproduce the behavior:

  1. run a JS file with a debugger statement
  2. when it stops on debugger statement, try to enter an Array function in the JS debug console

Log File

VS Code Version:
Version: 1.64.1
Commit: d6ee99e4c045a6716e5c653d7da8e9ae6f5a8b03
Date: 2022-02-07T17:26:08.977Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 20.6.0

Additional context
Add any other context about the problem here.

@kruchkamgar kruchkamgar added the bug Issue identified by VS Code Team member as probable bug label Feb 10, 2022
@connor4312
Copy link
Member

connor4312 commented Feb 10, 2022

I can't repro this on Node 10-16. Please collect a log using the instructions in the issue template.

image

@connor4312 connor4312 added the info-needed Issue requires more information from poster label Feb 10, 2022
@alexhalme
Copy link

I've had the same issue for months. Extremely annoying. [1, 2, 3].map(x => x) will cause the error, then changing the variable will work temporarily → e.g. [1, 2, 3].map(xx => xx) will work for a while, then need to change var name again.

@connor4312
Copy link
Member

@alexhalme Please collect a log file using the instructions in the issue template.

@kruchkamgar
Copy link
Author

@connor4312, I initially tried to add "trace": true to my settings file and launch.json file and neither resulted in any output to debug console.

@connor4312
Copy link
Member

Can you collect a gif of what you see, using https://gifcap.dev/ for example

@kruchkamgar
Copy link
Author

Recording 2022-03-02 at 17 54 21

looks like it happens with jest only. I tried it without jest and it worked fine.

@connor4312 connor4312 reopened this Mar 3, 2022
@connor4312
Copy link
Member

Ok, what you want to do to get a trace log from there is add this to your user settings:

  "debug.javascript.terminalOptions": {
    "trace": true
  },

You'll then want to reopen or create a new Debug Terminal, and that should get you the trace log

@kruchkamgar
Copy link
Author

vscode-debugadapter-6b752bf8.json.zip

trace log..
second action taken: 'find((key)...'

@connor4312
Copy link
Member

connor4312 commented Mar 8, 2022

Got it, thanks!

image

We should not try to expand renames in the context of call arguments

@connor4312 connor4312 removed the info-needed Issue requires more information from poster label Mar 8, 2022
@connor4312 connor4312 added this to the April 2022 milestone Mar 31, 2022
@connor4312
Copy link
Member

The next nightly build will have the fix, please let me know whether you run into this again!

@meganrogge
Copy link

with

let x = 5;
// eslint-disable-next-line no-debugger
debugger;

It's not stopping at the debugger line at all for me. Maybe because of eslint or what am I doing wrong?

@meganrogge meganrogge added the verification-found Issue verification failed label Apr 27, 2022
@connor4312
Copy link
Member

@meganrogge can you grab a gif? THat sounds unrelated to this issue

@connor4312 connor4312 removed the verification-found Issue verification failed label Apr 28, 2022
@connor4312
Copy link
Member

Also, mm, verification of this will be quite tricky. I can craft a sample source and sourcemap that could hit this but it would be useful if @kruchkamgar could confirm whether this worked for them!

@meganrogge meganrogge added the author-verification-requested Issues potentially verifiable by issue author label Apr 28, 2022
@connor4312
Copy link
Member

connor4312 commented Apr 29, 2022

Verification instructions:

Create a file minified.js

const o=42;const c=43;debugger;console.log(o,c);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9yaWdpbmFsLmpzIl0sIm5hbWVzIjpbInJlbmFtZWRWYXIiLCJhbm90aGVyUmVuYW1lZFZhciIsImNvbnNvbGUiLCJsb2ciXSwibWFwcGluZ3MiOiJBQUFBLE1BQU1BLEVBQWEsR0FDbkIsTUFBTUMsRUFBb0IsR0FDMUIsU0FDQUMsUUFBUUMsSUFBSUgsRUFBWUMifQ==

and also a file original.js

const renamedVar = 42;
const anotherRenamedVar = 43;
debugger;
console.log(renamedVar, anotherRenamedVar); 

Debug minified.js, with a launch config or in the debug terminal.

Once there, play around the REPL. Verify you can evaluate renamedVar and anotherRenamedVar as expected. For this particular issue, use the renamed name as a parameter, for instance [1, 2, 3].find(renamedVar => renamedVar === 2)

@meganrogge meganrogge added the verified Verification succeeded label Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants