mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-21 16:05:25 +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:
parent
165fd275fb
commit
15479e9095
2 changed files with 18 additions and 1 deletions
|
@ -4920,7 +4920,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
}
|
}
|
||||||
} else if (onPos != -1 && onPos > offPos) {
|
} else if (onPos != -1 && onPos > offPos) {
|
||||||
if (inInactiveCode) {
|
if (inInactiveCode) {
|
||||||
int inactiveCodeEnd = nodeLocation.getNodeOffset() + nodeLocation.getNodeLength();
|
int inactiveCodeEnd = nodeLocation.getNodeOffset();
|
||||||
positions.add(new InactivePosition(inactiveCodeStart, inactiveCodeEnd - inactiveCodeStart, false));
|
positions.add(new InactivePosition(inactiveCodeStart, inactiveCodeEnd - inactiveCodeStart, false));
|
||||||
}
|
}
|
||||||
inInactiveCode = false;
|
inInactiveCode = false;
|
||||||
|
|
|
@ -4717,4 +4717,21 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
public void testEnumWithAttributes_Bug559545() throws Exception {
|
public void testEnumWithAttributes_Bug559545() throws Exception {
|
||||||
assertFormatterResult();
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue