I am Itoh from ATL. We have released a RedPen IntelliJ IDEA plug-in as an environment allowing one to easily use RedPen. IntelliJ IDEA is a Java integrated development environment provided by the JetBrains company. The RedPen IntelliJ IDEA plug-in can also be used with other IDE provided by JetBrains.

When you use the RedPen plug-in, errors in the text file being edited will be highlighted just like they are in Microsoft Word. Also, an error message will pop up if you align the cursor with the highlighted areas. The following is the screen of the RedPen IntelliJ IDEA plug-in.

image

In the image it is English that is being edited, but the plug-in of course also works with Japanese.

If you would like for errors to be listed, either press Alt+Shift+R or specify Analyze → RedPen in IDEA and a list of errors will appear in a pop-up window.

Installation Method

The plug-in is registered to the plug-in repository provided by JetBrains. Therefore, it can be installed the same way as other plug-ins for IDEA. In concrete terms, this means open Settings → Plugins → Browse Repository, and search for RedPen. After you search for it, the RedPen plug-in will be displayed. Click “Install.”

Input Data Format

The RedPen plug-in supports the following formats.

  • Plaintext
  • Java property files
  • Markdown
  • AsciiDoc

Language Support

Currently the plug-in supports Japanese (ja and its derivations) and English (en). The language in which each file is written is automatically identified, but you can manually edit it using the status bar located in the lower part of the window. The language information for each manually selected file is stored in .idea/redpen/files.xml.

Language Support

Quick Fix

Quick fix is one of the features of the RedPen IntelliJ plug-in. The user can place the cursor over errors and execute the quick fix command (Alt+Enter) to edit errors. The content subject to quick fix differs from function to function. Unfortunately, only some of the functions currently support quick fix. If you try to use quick fix on errors output by functions that do not support it, you will be asked whether to remove the errors.

Quick Fix

Quick Fix Evaluation

The quickfix function was the last to be added, but it seems to be highly regarded. For example, it was praised by Mr. Hariri from JetBrains.

Settings

Karen RedPen is characterized by the flexibility of its settings The user can add or delete functions to use, or adjust settings to conform to the terms of service. This flexibility is not impaired in the RedPen IntelliJ plug in. A UI is used to change settings in the RedPen IntelliJ plug-in. The RedPen settings screen is displayed in this order: Settings → Editor → RedPen.

設定画面

The plug-in will not use functions for which their checkboxes have not been selected. To edit the properties of each function, click the “Properties” area and edit it directly. You can select multiple properties, and set them apart with semicolons. Dictionary file locations and the like can be specified in the properties.

Settings can be also be created in detail for symbols (characters) in the same manner as the RedPen command. Open the “Symbols” tab of the settings window to make settings for symbols. The following image is a screen in which the symbols have been set. For details on RedPen simple settings, refer to the RedPen documentation.

文字設定

When settings are completed, the settings file .idea/redpen/<language>.xml will be created. If the language is Japanese, the name of the file will be .idea/redpen/ja.xml. Also, there are three types of variations to the Japanese language settings. Note that a settings file will be automatically created for each detected variation. For example, even in the Japanese language document, .idea/redpen/ja-hankaku.xml will be created for text that uses half-width periods. Also, note that settings files will not be created until the default settings in the settings screen have been edited.

Importing and Exporting Settings

The user can import settings in RedPen settings files that the user already possesses. To import, press the “Import” button, and then specify the path of the settings file.

You can press the “Export” button to export the current settings to the specified location. In the future, use the “Export” button when you want to make use of settings. After the user changes the settings, the settings will be saved under the .idea/redpen directory. Therefore, when you would like to use settings as a team, it’s best to add a version management system to each .idea.

Adding Functions with JavaScript

The RedPen IntelliJ IDEA plug-in also supports extensions of functionality using JavaScript. For information on methods for creating function extensions using JavaScript, see here. IntelliJ IDEA loads JavaScript files that exist in the .idea/redpen/js directory by default. Also, you can use the script_path property to change the directory that reads the function extensions.

Direct Editing of Settings Files

These are saved under the RedPen settings file (XML) .idea/redpen directory. The project must be restarted whenever you reload settings after direct editing. The new settings will be applied immediately after you perform this editing from the settings screen of the RedPen plug-in.

Dictionary Support

Most of the functions provided by RedPen supports dictionaries, and provide “list” and “dict” properties. The “list” property is used as a small-scale dictionary. The various elements are set apart by commas as in the following example.

Save the dictionary file specified by the “dict” property to .idea/redpen. After saving to the dictionary, specify a file with the “dict” property. The following is an example of dictionary specification settings.

Sample

The IDEA project written about in this blog post has been placed here. Refer to the directory configuration and the like. The following is the window in which this blog is edited with IntelliJ.

redpen-ja-sample

The writing of this blog was done in combined used with the IntelliJ Markdown plug-in. If you use the Markdown plug-in, the markdown review screen can be viewed conveniently while you write.

markdown-preview-sample

Also, when used in combination with the AsciiDoc plug-in, AsciiDoc document previews are displayed in the same manner as the Markdown plug-in.

Released Together with RedPen v1.5.

We released RedPen v1.5 together with theRedPen IntelliJ plug-in. Two significant enhancements have been made to v1.5.

  • Java property files are supported as an input format.
  • A Wiki parser outputs offset information for errors.

In the future, I would like to add more functions, and make it compatible with Re:VIEW.

The Future of the RedPen IntelliJ Plug-in

Development of the RedPen IntelliJ will settle down for a while. Actually, while developing the IntelliJ plug-in, we place too much emphasis on English-language compatibility, and as a result there are some undesirable aspects to the default Japanese language settings. For the time being, we intend to improve these problems little by little.

TAGS: