2 posts
Annotations and indentation in java
Edited by Jonas on Reason: Initial post
Hi!

I was wondering if there is an easy way to fix the indentation after annotations in java files. As per now, it indents the next line. I have been looking through the customization code, but I am at a bit of a loss of what to do. Could anyone help me out?

Right now it looks like this.
 1 2 3 @Override public void method() { } 

I would like it to look like this.
 1 2 3 @Override public void method() { } 
Allen Webster
473 posts / 4 projects
Heyo
Annotations and indentation in java
First, it depends on in you're using virtual whitespace. Virtual whitespace is on if you can't delete and insert individual spaces at the beginning of a line. If you are using it, there's nothing you can do, it's not customizable.

You can disable virtual whitespace in config.4coder if that's what you want.

If you've disable virtual whitespace then you're looking at the text level indenter. In that case there is something you can do by editing 4coder_auto_indent.cpp. Lines 504 through 506 add extra indentation whenever the parser thinks it has seen an incomplete statement. Either just comment that out, or enhance the parser to think of @Override as the end of a statement, which is not necessarily an easy task, but possible somehow I'm sure.
2 posts
Annotations and indentation in java
Edited by Jonas on
I am using virtual whitespace, and I don't really want to disable it. It's not a problem for me as I'm not really working that much with java. I was just curious if there was a somewhat easy fix somewhere in the customization code.

Anyways, thanks for the quick response. :)
Maciek
10 posts
Annotations and indentation in java
Hey. Create your custom 4coder command that’s replacing return key. Firstly exec command that’s currently bound to it, and secondly, remowe the whitespace. That’s really easy to do with 4coder api.