Flag used to include the comments during the formatting of the code snippet.
This flag can be combined with the following kinds:
Note also that it has an effect only when one or several format comments options for javadoc , block orline are set to true while calling format(int, String, int, int, int, String) or format(int, String, IRegion[], int, String) methods
For example, with the Eclipse default formatter options, the formatting of the following code snippet using K_COMPILATION_UNIT:
public class X {
/**
* This is just a simple example to show that comments will be formatted while processing a compilation unit only if the constant flag flag is set.
* @param str The input string
*/
void foo(String str){}}
F_INCLUDE_COMMENT will produce the following output:
public class X {
/**
* This is just a simple example to show that comments will be formatted while processing a compilation unit only if the constant flag flag is set.
*
* @param str The input string
*/
void foo(String str){
}
}
F_INCLUDE_COMMENT Adding this flavor to the kind given while formatting the same source (e.g.
K_COMPILATION_UNIT |
F_INCLUDE_COMMENTS) will produce the following output instead:
public class X {
/**
* This is just a simple example to show that comments will be formatted
* while processing a compilation unit only if the constant flag
* flag is set.
*
* @param str
* The input string
*/
void foo(String str){
}
}
F_INCLUDE_COMMENT
Note: Although we're convinced that the formatter should always include the comments while processing a kind of compilation unit, we have decided to add a specific flag to fix this formatter incorrect behavior. This will prevent all existing clients (e.g. 3.3 and previous versions) using theK_COMPILATION_UNIT kind to be broken while formatting.