As of now, there are some available extensions: for example Minify or JS & CSS Minifier
Note: You can find extensions on the VS Code Marketplace.
Or directly from VS Code by searching from the Extensions pane, on the left side (Ctrl + Shift + X).
Answer from Supersharp on Stack OverflowAs of now, there are some available extensions: for example Minify or JS & CSS Minifier
Note: You can find extensions on the VS Code Marketplace.
Or directly from VS Code by searching from the Extensions pane, on the left side (Ctrl + Shift + X).
Search for Visual Studio Code Minify Plugins on Google. There are plenty. For example, this, and this.
Videos
Does anyone know how to unminify JavaScript code in VS Code? Currently my JS code looks like. I've found several different suggestions online, but none have worked:
-
ctrl-k, followed by ctrl-d
-
ctrl-e, followed by d
-
alt+shift+f
-
right click on code and select 'format'
I realize I might not be able to recover all data, but I'm looking to at least format the code in a more readable manner.
Thanks in advance.
Install a prettifier extension from the market. Theyβre sometimes called beautifiers, too.
Shift + Alt + F should have gotten you close. Does it only partially format it?
Another solution worth trying might be using the Prettifier extension. That might make the auto formatting better.
After you format it the first time you can manually format parts on your own and rerun the formatter to see if it gets any closer. Using regular expressions for find replace can also do a lot of work for you.
Tool to Unminify / Decompress JavaScript
You cannot truly unminify javascript, as minified javascript replaces variable names with letters, as well as removing code comments - these cannot be "undone" as the original information no longer exists.
It appears that you can at least recreate appropriate spacing, but "real" minified javascript cannot be undone.
You can use Prettier https://prettier.io/docs/en/install.html, to get the script slightly human readable.
If you are having problem with vs code you can add this in your settings.json
"[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
It works for me for mega file...
