Caret Plugin::Pretty-JavaScript

A Caret Editor plug-in which allows for Pretty Print for JavaScript.
If you find any issues with the plug-in please open an issue at the GitHub page.
Note:
You will need to configure Caret to see the plugin as it will not automatically. The following will help you configure Caret
api.json
You'll need to add the following to your api.json file, under settings menu. This plugin can pass the same options that JS-Beautify does in the 'options' tag. I left the default 'sampleMessage' in there for the example. Note: the options in Pretty-JavaScript, these can be any of the options from JS Beautifier https://github.com/beautify-web/js-beautify as this plug-in uses it and is just a wrapper for it to work in Caret.
{
"sampleMessage": {
"id": "extension id goes here",
"message": {
"data": "message can be any JSON object passable to chrome.runtime.sendMessageExternal"
}
},
"Pretty-JavaScript": {
"id": "nfkohdggkammeogcdpmiebnlbcgpdcii",
"message": {
"options": {
"indent_size": 1,
"indent_char": "\t",
"max_preserve_newlines": 2,
"brace_style": "collapse",
"jslint_happy": true,
"wrap_line_length": 0
}
},
"sendEditorContext": true
}
}
key.json
You'll want to bind the command to the keyboard, you can select any shortcut combo that you want.
"Ctrl-Shift-H": {
"command": "api:execute",
"argument": "Pretty-JavaScript"
}
menus.json
This is optional, but allows the command to be accessible in menu system.
{
"label": "JavaScript Beautify",
"command": "api:execute",
"argument": "Pretty-JavaScript"
}
The following have contributed works
Without the following, this plug-in would not exist. Thanks to their works.
Caret :: https://github.com/thomaswilburn/Caret
JS-Beautify :: https://github.com/beautify-web/js-beautify