IntelliJ Community . AutoFormatText

 
AutoFormatText 

HOME INDEX SEARCH CHANGES GO  

Auto-Format Text



What's This?

The Auto-Format Text 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 Auto-Format Text, 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 Auto-Format 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.4.1 (released June 18, 2003):

    • wrapper-1.4.1.jar (JAR File only)
    • wrapper-src-1.4.1.zip (complete, with source)
    • Fixed a but that was causing IntelliJ to always ask if the changes should be saved in the IDE settings, even though nothing was changed
    • Fixed a null pointer exception on some versions of IntelliJ older than 3.0.4 that was rendered the whole IDE unusable with a modal dialog that could not be closed

  • Version 1.4 (released June 13, 2003):

    • wrapper-1.4.jar (JAR File only)
    • wrapper-src-1.4.zip (complete, with source)
    • Fixed some issues with version 3.0.4 of IntelliJ.
    • Source code comes with an Ant build.xml.
    • The maximum line width can now be set in the IDE Setting

  • 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 Auto-Format Text the Code menu.
  • Optionally, you might want to assign a keyboard shortcut for this command (see Options | Keymaps).

-- AlessandroVernet - 12 Jun 2003


IntelliJPluginWebForm
IntelliJPluginName: Auto-Format Text
IntelliJPluginVersion: 1.4.3
IntelliJPluginVendor: AlessandroVernet
IntelliJPluginBinary:
IntelliJPluginSource:
IntelliJPluginClassification: DocHelper?, Other
TopicClassification: IntelliJPluginPackage
TopicShortDescription: This plug-in adds a Auto-Format Text entry in the Code menu. Reformatting text is particularly useful when editing Javadoc comments or files with free text paragraphs (like text or XML document).
TestedOnOS:
ShouldRunOnOS:

e d i t a t t a c h r e f - b y d i f f s m o r e
Have ideas, requests, problems regarding this site? Send feedback.
Copyright © 2000-2003 by the contributing authors. All materials at intellij.org are the property of the contributing authors.