Warning: Function registration failed - duplicate name - xslt_create in /home/avernet/public_html/misc/controller.php on line 2

Warning: Function registration failed - duplicate name - xslt_set_sax_handlers in /home/avernet/public_html/misc/controller.php on line 2

Warning: Function registration failed - duplicate name - xslt_set_scheme_handlers in /home/avernet/public_html/misc/controller.php on line 2

Warning: Function registration failed - duplicate name - xslt_set_error_handler in /home/avernet/public_html/misc/controller.php on line 2

Warning: Function registration failed - duplicate name - xslt_set_base in /home/avernet/public_html/misc/controller.php on line 2

Warning: Function registration failed - duplicate name - xslt_set_encoding in /home/avernet/public_html/misc/controller.php on line 2

Warning: Function registration failed - duplicate name - xslt_set_log in /home/avernet/public_html/misc/controller.php on line 2

Warning: Function registration failed - duplicate name - xslt_process in /home/avernet/public_html/misc/controller.php on line 2

Warning: Function registration failed - duplicate name - xslt_error in /home/avernet/public_html/misc/controller.php on line 2

Warning: Function registration failed - duplicate name - xslt_errno in /home/avernet/public_html/misc/controller.php on line 2

Warning: Function registration failed - duplicate name - xslt_free in /home/avernet/public_html/misc/controller.php on line 2

Warning: Function registration failed - duplicate name - xslt_set_object in /home/avernet/public_html/misc/controller.php on line 2

Warning: Function registration failed - duplicate name - xslt_setopt in /home/avernet/public_html/misc/controller.php on line 2

Warning: Function registration failed - duplicate name - xslt_getopt in /home/avernet/public_html/misc/controller.php on line 2

Warning: Function registration failed - duplicate name - xslt_backend_version in /home/avernet/public_html/misc/controller.php on line 2

Warning: Function registration failed - duplicate name - xslt_backend_name in /home/avernet/public_html/misc/controller.php on line 2

Warning: Function registration failed - duplicate name - xslt_backend_info in /home/avernet/public_html/misc/controller.php on line 2

Warning: xslt: Unable to register functions, unable to load in Unknown on line 0
Free Text Wrapper for IntelliJ

Free Text Wrapper
for IntelliJ

Alessandro Vernet
Last Modified: November 3, 2002

What's This?

The Free Text Wrapper is a plug-in for IntelliJ. It will add to IntelliJ the ability to rewrap free text. This is particularly useful when editing Javadoc comments or files with free text paragraphs (like text or XML document). This functionality is inspired by the incredibly convenient fill-paragraph function of Emacs (usually bound to alt-q or esc-q).

What's Free Text Formatting?

Imagine that you're documenting a method in Javadoc. After a few modifications to your comment, it might look like this:

Some lines will be too long, others too short. Having to move words from one line to the other to make the paragraph look better and easier to read is just annoying. The Free Text Wrapper does this automatically. After running the Free Text Formatter, the text looks like:

How Does It Work?

To run it, you can:

  • Either select the paragraph you want to reformat and run the command (menu item Rewrap Free Text in the Code menu).
  • Or just place the cursor somewhere inside the paragraph and run the command. In this case a heuristic will be used to determine the beginning and the end of the paragraph. (Only the "current" paragraph will be rewrapped, not the entire file.)

Download

  • Version 1.3 (released November 13, 2002):
    • wrapper-1.3.jar (JAR File only)
    • wrapper-src-1.3.zip (complete, with source)
    • Fixed a NullPointerException due to a recent change in the IntelliJ Open API (issue first reported by Jason Horman).
    • Updated the plugin version number in the plugin.xml (issue reported by Dave Kriewall).
    • Fixed bug where paragraphs are incorrectly merged when there is an empty line between the paragraphs and that empty line starts with a number of spaces corresponding to the same indentation as the paragraphs.

  • Version 1.2 (released November 3, 2002):
    • wrapper-1.2.jar (JAR File only)
    • wrapper-src-1.2.zip (complete, with source)
    • The Free Text Wrapper now works fine on a selection, even if the selection does not start and end at the beginning of a line.
    • Comments are correctly reformatted both when each line starts with a '*' and when each line starts with a '//'. For instance if there is only one line starting with '//' which is too long and the Free Text Wrapper is run with the cursor somewhere in the middle of the line, two lines (or more will be created, each starting with '//'). Note that this is done only with Java files.
    • Removed debug code unintentionally present in version 1.1.
    • Paragraphs that start with a "bullet" (a character like '*', '-' or '#') are recognized and they will be correctly reformatted. I.e. the bullet will be only on the first line of the paragraph and the subsequent line will be aligned with the text (after the bullet) on the first line. It is typically easy to reformat paragraphs that look like:

    • Similarly to the "bullets", enumerations like '1)', 'a)', '(A)', etc are recognized and the paragraph is reformatted appropriately. It is typically easy to reformat paragraphs that look like:

  • Version 1.1 (released November 2, 2002):
    • wrapper-1.1.jar (JAR File only)
    • wrapper-src-1.1.zip (complete, with source)
    • Fix for IDEA 670 (patch submitted by Brian Goetz)
    • Don't try to reformat read-only files (bug report submitted by Marion Bass)
    • When the text is reformatted and no block is selected, the cursor will be repositioned as it was before (i.e. relatively to the surrounding text)

  • Version 1.0 (released October 27, 2002):

Install

  • Download the JAR file listed above.
  • Copy it in the plugins directory where you installed IntelliJ.
  • Restart IntelliJ.
  • You will now find a new menu item Rewrap Free Text in the Code menu.
  • Optionally, you might want to assign a keyboard shortcut for this command (see Options | Keymaps).

References