Polystyle
Multi-Edit includes a fully licensed copy of Polystyle, a source code beautifier, which installs as an Add-On, giving you the ability to format source files directly within Multi-Edit. Polystyle includes support for a number of languages including:
- ASP
- C/C++
- C#
- CMac
- CSS
- HTML
- Java
- JavaScript
- JSP
- PHP
- Pascal/Delphi
- Perl
- Python
- VB
You can select to use one of its predefined styles, modify one to your liking, or simply create your own from scratch.
This section covers the basics of installing the bundled copy of Polystyle and using it in Multi-Edit. For more specific usage information, see Polystyle's help, or visit its web site, http://www.polystyle.com.
Installing And Updating Polystyle
You install Polystyle during Multi-Edit installation, by simply choosing it from the checklist of options (see the Installation Guide for more on installation).
Since Polystyle is an actively-evolving third party product, you should check the Polystyle web site occasionally for new versions (http://www.polystyle.com). The version to download is the Windows Upgrade version (the full version will also work, but is larger to download). Unzip it directly into your Multi-Edit install directory (not the Polystyle subdirectory, or anywhere else).
Multi-Edit should be shut down when you do this.
If you've run Polystyle since booting your machine, you may have to reboot to get a successful unpack; in some instances a Polystyle-related shell DLL may still be running, making it impossible to overwrite.
Customizing Polystyle To Suit Your Coding Style
There are two kinds of customization information Polystyle uses: example files, which affect specific languages; and global preferences, which affect all languages Polystyle can handle.
Example Files
Example files are basically collections of “dummy” samples that tell Polystyle how to format a file of a given type. You can choose one of the supplied example file sets and simply use it as-is, or you can modify one of them to suit yourself by several methods. One thing to note is that Polystyle organizes collections of example files into “suites,” which include not only a set of example files for each language, but a version of the global settings; if you don't ever create a new suite, any changes you make to example files affect the default suite that's created on installation. If you want different suites, create them.
If none of the supplied styles is exactly what you want, there are two methods by which you can modify the example files. First, Polystyle's Graphical Styler supplies a dialog-based interface for each language; by setting the dialog controls the way you want, you modify the example files without having to edit them. Second, you can open example files and edit them directly. While you can achieve some finer control this way, it's obviously a method for experts. If you do it this way, there are some things to observe.
If you've created new suites, they'll appear in separate, named directories beneath the main example directory; be sure you know which file you're editing.
You shouldn't ever edit any of the supplied styles. Within example files, comments are null, and affect nothing; all that matters is spacing, both inserted whitespace and blank lines. That's all you should edit. If you want to experiment, be sure to do it on a copy, and run test-formats on unimportant files.
Global Preferences
The global preferences are simply a group of settings that are applied to all languages in a suite, such as tab settings and margins. Where you've selected a suite based on a particular tab length, the global tab length must be the same.
Formatting Files
To format a file, open it in Multi-Edit and either select Tools | Format Code from the main menu or press 'Alt+Shift+F' (in the default keymap). Upon successful completion, your file will be modified in place and saved, and a backup created in the same location with ”.polystyle.backup” appended to its filename.
If for any reason Polystyle is unable to parse your file, it will display a dialog showing a portion of the code around the area it was unable to parse, with a dashed line and a caret beneath the problem line to show exactly where it hit the problem, as well as the line and column number. As with any language parser, you should be aware that the actual cause of the misparse may be earlier in the file, as Polystyle will continue to parse so long as some interpretation is possible.
Fix the problem code and rerun Polystyle; as with all debugging, you may have to iterate a few times to get it right. It's not billed as a feature, but you can actually use Polystyle as a simple debugger in this fashion.
Getting Support For Polystyle
Polystyle is a third-party product so you should direct any support issues other than ones involving Multi-Edit's Polystyle integration to their support staff (www.polystyle.com).
Direct questions concerning the Multi-Edit integration (i.e., “Nothing happens when I select Format Code,” “Polystyle says it's a trial copy,” etc.) to our team at support@multieditsoftware.com.