What formatter option can I change to stop my arrays being formatted onto one line [message #1748386] |
Tue, 22 November 2016 16:23 |
James Yeoman Messages: 5 Registered: November 2016 |
Junior Member |
|
|
I am working on some OpenGL but it is extremely annoying that, rather than just putting
float [] verts = {
-0.5f , -0.5f ,
0.0f , 0.5f ,
-0.5f , 0.5f
};
for the vertices of a triangle, I have to use
//@formatter:off
float [] verts = {
-0.5f , -0.5f ,
0.0f , 0.5f ,
-0.5f , 0.5f
};
//@formatter:on
which, not only looks horrible, also is inefficient and requires moving the opening and closing formatter tags if I later decide to put another array in there. How do I go about making the formatter accept the first format rather than the "wrapped onto one line" format?
|
|
|
Re: What formatter option can I change to stop my arrays being formatted onto one line [message #1748505 is a reply to message #1748386] |
Wed, 23 November 2016 17:01 |
|
Hello James,
you can modify Eclipse Java Formatter:
- Window -> Preferences -> Java -> Code Style -> Formatter
- Edit...
- Line Wrapping tab
- in the tree, select Expressions -> Array initializers
- in the "Settings for array initializers" group, use "Wrap all elements, every element on the same line" (or another one which is matching what you want exactly)
regards,
Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
|
|
|
Powered by
FUDForum. Page generated in 0.09445 seconds