diff --git a/src/main/kotlin/org/domaframework/doma/intellij/formatter/block/SqlLineCommentBlock.kt b/src/main/kotlin/org/domaframework/doma/intellij/formatter/block/SqlLineCommentBlock.kt index 77cf9491..9dac5b0a 100644 --- a/src/main/kotlin/org/domaframework/doma/intellij/formatter/block/SqlLineCommentBlock.kt +++ b/src/main/kotlin/org/domaframework/doma/intellij/formatter/block/SqlLineCommentBlock.kt @@ -55,7 +55,7 @@ open class SqlLineCommentBlock( return it.indent.groupIndentLen.minus(2) } } - return 1 + return it.indent.indentLen } return 1 } diff --git a/src/test/testData/sql/formatter/FormattedSelect.sql b/src/test/testData/sql/formatter/FormattedSelect.sql index c728a915..5bff1601 100644 --- a/src/test/testData/sql/formatter/FormattedSelect.sql +++ b/src/test/testData/sql/formatter/FormattedSelect.sql @@ -15,7 +15,9 @@ SELECT COUNT(DISTINCT (x)) , ISNULL(s.fiberid , 0) AS fiberid FROM phototag p + -- Line1 JOIN usno u + -- Line2 ON p.objid = u.objid /** Join */ LEFT OUTER JOIN specobj s @@ -24,9 +26,11 @@ SELECT COUNT(DISTINCT (x)) AND p.plate = s.plate /** Where */ WHERE p.TYPE = DBO.FPHOTOTYPE('Star') + -- Line3 OR (p.flags & DBO.FPHOTOFLAGS('EDGE') = 0 AND (p.psfmag_g - p.extinction_g) BETWEEN 15 AND 20) /*%if status == 2 */ + -- Line4 AND u.propermotion > 2. /** And Group */ AND (p.psfmag_g - p.extinction_g + 5 * LOG(u.propermotion / 100.) + 5 > 16.136 + 2.727 * (p.psfmag_g - p.extinction_g - (p.psfmag_i - p.extinction_i)) diff --git a/src/test/testData/sql/formatter/Select.sql b/src/test/testData/sql/formatter/Select.sql index c586ef65..adfbba6d 100644 --- a/src/test/testData/sql/formatter/Select.sql +++ b/src/test/testData/sql/formatter/Select.sql @@ -15,9 +15,9 @@ SELECT COUNT( DISTINCT (x)),o.* , 0) AS fiberid FROM phototag p - +-- Line1 JOIN usno u - +-- Line2 ON p.objid = u.objid /** Join */ LEFT OUTER JOIN specobj s @@ -25,11 +25,12 @@ SELECT COUNT( DISTINCT (x)),o.* ON p.objid = s.bestobjid AND p.plate = s.plate /** Where */ WHERE p.TYPE = DBO.FPHOTOTYPE('Star') - + -- Line3 OR (p.flags & DBO.FPHOTOFLAGS('EDGE') = 0 AND (p.psfmag_g - p.extinction_g) BETWEEN 15 AND 20) /*%if status == 2 */ +-- Line4 AND u.propermotion > 2. /** And Group */ AND (p.psfmag_g - p.extinction_g + 5 * LOG(u.propermotion / 100.) + 5 > 16.136 + 2.727 * (p.psfmag_g - p.extinction_g - (p.psfmag_i - p.extinction_i))