Plugin "JS Format"

This is command plugin for SynWrite editor.
It allows to format source code for lexers JavaScript and JSON, using Python engine from jsbeautifier.org. If selection is made (only normal selection supported) then only selection is formatted, otherwise entire file is formatted.

Plugin has few commands in SynWrite menu "Tools - Plugins".

Configuration

Plugin has configuration file "jsformat.cfg", which can be edited using two "Configure" commands.

indent_size                Indentation size [4]
indent_char                Indentation character [" "]
indent_with_tabs           Indent with tabs, overrides -s and -c
preserve_newlines          Preserve line-breaks (--no-preserve-newlines disables)
max_preserve_newlines      Number of line-breaks to be preserved in one chunk [10]
space_in_paren             Add padding spaces within paren, ie. f( a, b )
e4x                        Pass E4X xml literals through untouched
jslint_happy               Enable jslint-stricter mode
brace_style                [collapse|expand|end-expand] ["collapse"]
keep_array_indentation     Preserve array indentation
keep_function_indentation  Preserve function indentation
unescape_strings           Decode printable characters encoded in xNN notation
wrap_line_length           Wrap lines at next opportunity after N characters [0]
break_chained_methods      Break chained method calls across subsequent lines

How to install

Just open plugin's zip-file in SynWrite, and confirm installation.
Default hotkey Ctrl+Alt+F can be changed using SynWrite command "Options - Advanced - Edit file SynPlugins.ini".

About

Author: Alexey T. (SynWrite author)