Answer the question
In order to leave comments, you need to log in
How to format code according to my criteria in IntelliJ IDEA?
Let's say we have this code:
static class Request {
private final String data;
public Request(String requestData) {
this.data = requestData;
}
public String getData() {
return data;
}
}
static class Request {
private final String data;
public Request(String requestData) { this.data = requestData; }
public String getData() { return data; }
}
Answer the question
In order to leave comments, you need to log in
Almost everything can be edited in these tabs (in this case, I have php, you will have java):
You don't need to change anything. These features already exist. In your case it is:
Ctrl + "+" - expand the method;
Ctrl + "-" - collapse the method;
You'd be better off following the suggested pattern, because if you refactor all code to be shortened like this, then even large methods that consist of more than one line will be formatted as above, resulting in confusion.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question