1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-19 23:15:24 +02:00

Bug 559669 - Fix formatter on/off tags

Change-Id: Ia481703a0360ec5741d2fb079a75aa13a33bff39
Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
This commit is contained in:
Marco Stornelli 2020-02-01 15:23:59 +01:00
parent 165fd275fb
commit 15479e9095
2 changed files with 18 additions and 1 deletions

View file

@ -4920,7 +4920,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
}
} else if (onPos != -1 && onPos > offPos) {
if (inInactiveCode) {
int inactiveCodeEnd = nodeLocation.getNodeOffset() + nodeLocation.getNodeLength();
int inactiveCodeEnd = nodeLocation.getNodeOffset();
positions.add(new InactivePosition(inactiveCodeStart, inactiveCodeEnd - inactiveCodeStart, false));
}
inInactiveCode = false;

View file

@ -4717,4 +4717,21 @@ public class CodeFormatterTest extends BaseUITestCase {
public void testEnumWithAttributes_Bug559545() throws Exception {
assertFormatterResult();
}
////@formatter:off
// int a;
//
////@formatter:on
// int b;
// int c;
////@formatter:off
// int a;
//
////@formatter:on
//int b;
//int c;
public void testFormatterOnOff_Bug559669() throws Exception {
assertFormatterResult();
}
}