File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Extension/src/LanguageServer/Providers Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -28,12 +28,18 @@ export class FoldingRangeProvider implements vscode.FoldingRangeProvider {
28
28
}
29
29
const result : vscode . FoldingRange [ ] = [ ] ;
30
30
ranges . ranges . forEach ( ( r : CppFoldingRange , index : number , array : CppFoldingRange [ ] ) => {
31
+ let nextNonNestedIndex : number = index + 1 ; // Skip over nested if's.
32
+ for ( ; nextNonNestedIndex < array . length ; ++ nextNonNestedIndex ) {
33
+ if ( array [ nextNonNestedIndex ] . range . start . line >= r . range . end . line ) {
34
+ break ;
35
+ }
36
+ }
31
37
const foldingRange : vscode . FoldingRange = {
32
38
start : r . range . start . line ,
33
39
// Move the end range up one if it overlaps with the next start range, because
34
40
// VS Code doesn't support column-based folding: https://github.com/microsoft/vscode/issues/50840
35
- end : r . range . end . line - ( index + 1 >= array . length ? 0 :
36
- ( array [ index + 1 ] . range . start . line !== r . range . end . line ? 0 : 1 ) )
41
+ end : r . range . end . line - ( nextNonNestedIndex >= array . length ? 0 :
42
+ ( array [ nextNonNestedIndex ] . range . start . line !== r . range . end . line ? 0 : 1 ) )
37
43
} ;
38
44
switch ( r . kind ) {
39
45
case FoldingRangeKind . Comment :
You can’t perform that action at this time.
0 commit comments