mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-06 06:21:16 +07:00
[AutoDetectIndent] getTotalLinesWithLeadingSpaces returns value needed, no need in subtracting
This commit is contained in:
+1
-2
@@ -99,8 +99,7 @@ public class IndentOptionsDetectorImpl implements IndentOptionsDetector {
|
||||
}
|
||||
|
||||
if (maxUsedIndentSize <= MAX_INDENT_TO_DETECT) {
|
||||
int totalUsagesWithoutZeroIndent = stats.getTotalLinesWithLeadingSpaces() - stats.getTimesIndentUsed(0);
|
||||
double usageRate = (double)maxUsedIndentInfo.getTimesUsed() / totalUsagesWithoutZeroIndent;
|
||||
double usageRate = (double)maxUsedIndentInfo.getTimesUsed() / stats.getTotalLinesWithLeadingSpaces();
|
||||
if (usageRate > RATE_THRESHOLD) {
|
||||
return maxUsedIndentSize;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# Assignment:
|
||||
number = 42
|
||||
opposite = true
|
||||
|
||||
# Conditions:
|
||||
number = -42 if opposite
|
||||
|
||||
# Functions:
|
||||
square = (x) -> x * x
|
||||
|
||||
# Arrays:
|
||||
list = [1, 2, 3, 4, 5]
|
||||
|
||||
# Objects:
|
||||
math =
|
||||
root: Math.sqrt
|
||||
square: square
|
||||
cube: (x) -> x * square x
|
||||
|
||||
# Existence:
|
||||
alert "I knew it!" if elvis?
|
||||
|
||||
# Array comprehensions:
|
||||
cubes = (math.cube num for num in list)
|
||||
+2
@@ -74,6 +74,8 @@ public class IndentAutoDetectionTest extends LightPlatformCodeInsightTestCase {
|
||||
doTestIndentSize(4);
|
||||
}
|
||||
|
||||
public void testManyZeroIndents() { doTestIndentSize(2); }
|
||||
|
||||
public void testSpacesToNumbers() throws Exception {
|
||||
String text = " i\n" +
|
||||
" a\n" +
|
||||
|
||||
Reference in New Issue
Block a user