You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need to clarify the indent_size specification option. Maybe we can think about adding new non-normative section as well.
Assume we have these .editorconfig settings:
indent_style = space
indent_size = 2
And we also have the following Java code:
1. package com.something.other;
2.
3. import java.util.function.Consumer;
4.
5. public class TestJavaClass {
6.
7. public static final String PARAM = "PARAM";
8.
9. private static final Consumer<Object> MY_CONS = o ->
10. System.out.println(o);
11.
12. public static void main(String[] args) {
13. System.out.println("Hey!");
14.
15. String property = System
16. .getProperties()
17. .getProperty(PARAM);
18.
19. if (property == null)
20. return;
21.
22. System.out.println(property);
23. }
24.}
The problem is that the spec does not specify the exact indentation rules. For instance, I can implicitly infer the rule, that the intention size of the line must be either the same as the previous (which is, let's say, equal to X), or it should be of the value X + indent_size. That is fine, but there are a couple of problems:
What is the indent size of the line 19 should be? The problem is that we do not have a previous line to look up the indentation according to the rule I described above. We can of course track the indentation of the latest non-empty new line, and then apply the rule above, but this is not mentioned in the spec. It should be somehow clarified.
What is the indentation size of the line 23 should be? On the one hand, this bracket closes the main() method, but it can equally close some if/else statement. The spec does not specify this behavior. But it should
The text was updated successfully, but these errors were encountered:
We need to clarify the
indent_size
specification option. Maybe we can think about adding new non-normative section as well.Assume we have these
.editorconfig
settings:And we also have the following Java code:
The problem is that the spec does not specify the exact indentation rules. For instance, I can implicitly infer the rule, that the intention size of the line must be either the same as the previous (which is, let's say, equal to
X
), or it should be of the valueX + indent_size
. That is fine, but there are a couple of problems:What is the indent size of the line 19 should be? The problem is that we do not have a previous line to look up the indentation according to the rule I described above. We can of course track the indentation of the latest non-empty new line, and then apply the rule above, but this is not mentioned in the spec. It should be somehow clarified.
What is the indentation size of the line 23 should be? On the one hand, this bracket closes the main() method, but it can equally close some if/else statement. The spec does not specify this behavior. But it should
The text was updated successfully, but these errors were encountered: