Closed
Bug 951622
Opened 10 years ago
Closed 5 years ago
Pretty printing "let x = {};" and other ES6 syntax in Scratchpad results in broken code
Categories
(DevTools Graveyard :: Scratchpad, defect, P3)
DevTools Graveyard
Scratchpad
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: vporof, Unassigned)
References
Details
Pretty printer probably gets confused by the let. This might be a dupe of something.
Comment 1•10 years ago
|
||
We use acorn's lexer, which only supports <= ES5. This is dependent on acorn supporting ES6 and us upgrading acorn.
Comment 2•10 years ago
|
||
Hi, I want to work on this bug. So please can you assign this to me?
Comment 3•10 years ago
|
||
This is dependant on acorn[0] supporting ES6, so if you fix it upstream we will merge it. [0] https://github.com/marijnh/acorn
Comment 4•10 years ago
|
||
Just to state the obvious: same happens for const. Much to my surprise the code still works after I run pretty print and save. When I open another file in scratchpad, then go back to the bady pretty printed file I can see "const " became "const" and now I also get the expected syntax error. Perhaps some caching at work that will be nasty to debug: "hmmh, the file still worked when I last used it".
Pretty Print also doesn't respect "=>" which also refers to ES6: It turns code line "let s = (play) => a.Game;" into "lets = (play) = > a.Game;"
Please, mark this bug as DUPLICATE of bug 938203.
Flags: needinfo?(vporof)
Comment 8•9 years ago
|
||
Hi, I am interested in fixing this bug, can you please assign this bug to me?
Nick, do you know what the status is here? Is this still a valid bug? If so, Anup may need some mentoring. If it's a dupe, let's close it.
Flags: needinfo?(nfitzgerald)
Updated•9 years ago
|
Flags: needinfo?(nfitzgerald)
Reporter | ||
Updated•9 years ago
|
Flags: needinfo?(vporof)
Comment 10•9 years ago
|
||
Acorn now supports ES6. This should be fixable.
Comment 11•9 years ago
|
||
(In reply to Phil Keeling from comment #10) > Acorn now supports ES6. This should be fixable. Awesome! We should update our version of acorn then. Instructions can be found here: \devtools\shared\acorn\UPGRADING.md Looks like our version is quite old: 0.11.1 while 2.6.2 is available.
Comment 12•9 years ago
|
||
Is this bug still valid? Can anyone help with mentoring for fixing this bug?
Comment 13•9 years ago
|
||
(In reply to Anup Kumar from comment #12) > Is this bug still valid? Can anyone help with mentoring for fixing this bug? Yes this is still valid (I tested it last week and it still occurs). I think Nick should be able to help you (I've needinfo'd him now). If already have the repo cloned and the dev-environment set up, you can take a look at the file I mentioned in comment 11, it provides some instructions already.
Flags: needinfo?(nfitzgerald)
Comment 14•9 years ago
|
||
I have a pull request open for pretty-fast that bumps to the latest version: https://github.com/mozilla/pretty-fast/pull/12. We will also need to coordinate an upgrade to tern (Bug 1226810) at the same time since it's using acorn as well.
Comment 16•8 years ago
|
||
Need to wait to upgrade tern (which also relies on latest acorn) in Bug 1226810before merging the new pretty-fast into m-c.
Depends on: 1226810
Comment 17•8 years ago
|
||
Passing { ecmaVersion: 6 } into the options in pretty-fast seems to fix this particular case. Will need to file a PR against pretty-fast for that
Comment 20•7 years ago
|
||
Same here with this code ``` const test = () => { ``` which renders ``` consttest = () = > { ```
Updated•6 years ago
|
Summary: Pretty printing "let x = {};" in Scratchpad results in "letx = { };" → Pretty printing "let x = {};" and other ES6 syntax in Scratchpad results in broken code
Updated•6 years ago
|
Product: Firefox → DevTools
Comment 26•5 years ago
|
||
Scratchpad was removed in Bug 1519103 (Firefox 72). You can check the alternative in https://wiki.developer.mozilla.org/en-US/docs/Tools/Deprecated_tools#Scratchpad .
The Scratchpad bug list was reviewed and I think this bug can be safely closed.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX
Updated•4 years ago
|
Product: DevTools → DevTools Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•