File tree Expand file tree Collapse file tree 4 files changed +19
-7
lines changed
RubberduckTests/SmartIndenter Expand file tree Collapse file tree 4 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -87,8 +87,14 @@ private void ExtractEndOfLineComment()
87
87
}
88
88
89
89
public string Original { get ; private set ; }
90
+
90
91
public string EndOfLineComment { get ; private set ; }
91
92
93
+ public IEnumerable < string > Segments
94
+ {
95
+ get { return _segments ; }
96
+ }
97
+
92
98
public string ContinuationRebuildText
93
99
{
94
100
get
Original file line number Diff line number Diff line change @@ -35,7 +35,9 @@ public int NextLineIndents
35
35
get
36
36
{
37
37
RebuildContinuedLine ( ) ;
38
- return _rebuilt . NextLineIndents ;
38
+ return _rebuilt . Segments . Count ( ) < 2
39
+ ? _rebuilt . NextLineIndents
40
+ : _rebuilt . Segments . Select ( s => new AbsoluteCodeLine ( s , _settings ) ) . Select ( a => a . NextLineIndents ) . Sum ( ) ;
39
41
}
40
42
}
41
43
@@ -44,7 +46,12 @@ public int Outdents
44
46
get
45
47
{
46
48
RebuildContinuedLine ( ) ;
47
- return _rebuilt . Outdents ;
49
+ if ( _rebuilt . Segments . Count ( ) < 2 )
50
+ {
51
+ return _rebuilt . Outdents ;
52
+ }
53
+ var baseSegment = new AbsoluteCodeLine ( _rebuilt . Segments . First ( ) , _settings ) ;
54
+ return baseSegment . Outdents ;
48
55
}
49
56
}
50
57
Original file line number Diff line number Diff line change @@ -261,7 +261,7 @@ public void RemsWithLineContinuationsWork()
261
261
Assert . IsTrue ( code . SequenceEqual ( actual ) ) ;
262
262
}
263
263
264
- [ TestMethod , Ignore ] // Broken in VB6 SmartIndenter. Should be same fix as IfThenElseOnSameLineWorks()
264
+ [ TestMethod ] // Broken in VB6 SmartIndenter.
265
265
[ TestCategory ( "Indenter" ) ]
266
266
public void DoWhileOnTwoLinesWorks ( )
267
267
{
@@ -274,12 +274,11 @@ public void DoWhileOnTwoLinesWorks()
274
274
"End Sub"
275
275
} ;
276
276
277
- //TODO: Not sure if this is what should be expected...
278
277
var expected = new [ ]
279
278
{
280
279
"Public Sub Test()" ,
281
280
" Do _" ,
282
- " While X < 10: X = X + 1: Loop" ,
281
+ " While X < 10: X = X + 1: Loop" ,
283
282
" Debug.Print X" ,
284
283
"End Sub"
285
284
} ;
@@ -289,7 +288,7 @@ public void DoWhileOnTwoLinesWorks()
289
288
Assert . IsTrue ( expected . SequenceEqual ( actual ) ) ;
290
289
}
291
290
292
- [ TestMethod ] // Broken in VB6 SmartIndenter.
291
+ [ TestMethod ] // Broken in VB6 SmartIndenter.
293
292
[ TestCategory ( "Indenter" ) ]
294
293
public void ContinuedIfThenWorks ( )
295
294
{
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ public void UnmatchedEnumsNotIndent()
68
68
Assert . IsTrue ( code . SequenceEqual ( actual ) ) ;
69
69
}
70
70
71
- [ TestMethod , Ignore ] // Broken in VB6 SmartIndenter. Should be same fix as DoWhileOnTwoLinesWorks()
71
+ [ TestMethod ] // Broken in VB6 SmartIndenter.
72
72
[ TestCategory ( "Indenter" ) ]
73
73
public void IfThenElseOnSameLineWorks ( )
74
74
{
You can’t perform that action at this time.
0 commit comments