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

Closure Compiler Generated Source Maps Don't Let Preview Values #73197

Closed
zavr-1 opened this issue May 2, 2019 · 6 comments
Closed

Closure Compiler Generated Source Maps Don't Let Preview Values #73197

zavr-1 opened this issue May 2, 2019 · 6 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues *duplicate Issue identified as a duplicate of another issue(s) info-needed Issue requires more information from poster

Comments

@zavr-1
Copy link

zavr-1 commented May 2, 2019

Issue Type: Bug

The source maps works itself, but I can't hover over variables to get their names. It's not the case in Chrome.

VS Code version: Code 1.33.1 (51b0b28, 2019-04-11T08:22:55.268Z)
OS version: Darwin x64 18.0.0

map.js

This is the source code.

const get = async () => {
  const { hash, port  } = process.env
  return { hash, port }
}
(async () => {
  const res = await get()
  console.log(res)
})()

map1.js

This is the generated source code using Google Closure Compiler.

'use strict';
const c = async() => {
  const {hash:a, port:b} = process.env;
  return {hash:a, port:b};
};
(async() => {
  const a = await c();
  console.log(a);
})();


# sourceMappingURL=map1.js.map

map1.js.map

This is the map produced by the compiler.

{
"version":3,
"file":"t/map-vs/map1.js",
"lineCount":10,
"mappings":"A;AAAA,MAAMA,IAAMA,KAAM,EAANA,IAAY;AACtB,QAAM,CAAE,KAAAC,CAAF,EAAQ,KAAAC,CAAR,CAAA,GAAkBC,OAAAC,IAAxB;AACA,SAAO,CAAEH,KAAAA,CAAF,EAAQC,KAAAA,CAAR,CAAP;AAFsB,CAAxB;AAIC,MAAM,EAAN,IAAY;AACX,QAAMG,IAAM,MAAML,CAAA,EAAlB;AACAM,SAAAC,IAAA,CAAYF,CAAZ,CAAA;AAFW,CAAZ,CAAD,EAAA;;",
"sources":["t/map-vs/map.js"],
"sourcesContent":["const get = async () => {\n  const { hash, port  } = process.env\n  return { hash, port }\n}\n(async () => {\n  const res = await get()\n  console.log(res)\n})()"],
"names":["get","hash","port","process","env","res","console","log"]
}

It's great that the source map works, and I know I can't hover over { hash, port } because of return optimisations, but I should be able to preview res. And it's the simplest example, there's the same problem in more complex code.

IMG_0282

this is the visualisation

@zavr-1
Copy link
Author

zavr-1 commented May 2, 2019

This works in Chrome btw https://contexttesting.github.io/mask/
Screenshot 2019-05-03 at 01 56 40

@isidorn
Copy link
Contributor

isidorn commented May 3, 2019

@zavr-1 When you are stopped at that point do you see a variable res in the variables view?

@isidorn isidorn added debug Debug viewlet, configurations, breakpoints, adapter issues info-needed Issue requires more information from poster labels May 3, 2019
@zavr-1
Copy link
Author

zavr-1 commented May 3, 2019

nope I see a which is closure's variable. you can copy the scripts i've attached you'll be able to reproduce.

@isidorn
Copy link
Contributor

isidorn commented May 3, 2019

Well that is the issue, our debug hover has that limitation that it only looks in the variables view to find variables.
And node debug is returning the closure variable name. Not sure if something can be done here @roblourens

@roblourens
Copy link
Member

This looks like #12066

@roblourens roblourens added the *duplicate Issue identified as a duplicate of another issue(s) label May 3, 2019
@zavr-1
Copy link
Author

zavr-1 commented May 4, 2019

@roblourens @isidorn thanks for looking into it. Didn't know VSCode doesn't support this feature.

@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues *duplicate Issue identified as a duplicate of another issue(s) info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants