Kaede Akatsuki

中二病也要开发 Android

IDEA 注释优化插件:Comment Formatter

1
2
3
4
5
6
7
8
9
10
11
12
13
14
//               +---------------------------------------------+
// | public static final FiledA mFiledA; // xxx |
// | private static final FiledB mFiledB; // xxx |
// | public FiledC mFiledC; // xxx |
// | protected final FiledD mFiledD; // xxx |
// | FiledE mFiledE; // xxx |
// | | |
// | v |
// | public static final FiledA mFiledA; // xxx |
// | private static final FiledB mFiledB; // xxx |
// | public FiledC mFiledC; // xxx |
// | protected final FiledD mFiledD; // xxx |
// | FiledE mFiledE; // xxx |
// +---------------------------------------------+

Comment Formatter is an IntelliJ IDEA plugin (also works in Android Studio) that formats comments as above. It will force all the comments to align to the longest one.

Getting Started

  1. Install CommentFormatter from release or IntelliJ Plugin Repository.
  2. Select all the lines which you wanna format.
  3. Select Tool - Format comment or toggle Ctrl + Cmd + L to format.

Check it out.