Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 26d4c87

Browse files
close #197 by adding section A23: Enforce line break after single line comments.
1 parent 3fe7ff5 commit 26d4c87

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

settings/sql_developer/trivadis_custom_format.arbori

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,7 @@ i9_remove_duplicate_spaces_in_scope:
885885
-- - O11: Line Breaks: On subqueries. Options: true; false. (breakOnSubqueries).
886886
-- - A16: Line break if the parent element uses multiple lines.
887887
-- - R5: Commas in front of separated elements.
888+
-- - A23: Enforce line break after single line comments.
888889
-- - R2: 3 space indention.
889890
-- - R7: SQL keywords are right aligned within a SQL command.
890891
-- - A11: Align parameter names.
@@ -2593,6 +2594,28 @@ r5_commas:
25932594
addSpacesAroundComma(node);
25942595
}
25952596

2597+
-- --------------------------------------------------------------------------------------------------------------------
2598+
-- A23: Enforce line break after single line comments.
2599+
-- --------------------------------------------------------------------------------------------------------------------
2600+
2601+
a23_enforce_line_break_after_single_line_comment:
2602+
runOnce
2603+
-> {
2604+
var keys = newlinePositions.keySet().stream().collect(Collectors.toList()).toArray();
2605+
for (var i in keys) {
2606+
var key = keys[i];
2607+
if (key > 0) {
2608+
var comment = getLastCommentBetweenPos(key-1, key);
2609+
if (comment != null && comment.indexOf("--") == 0) {
2610+
if (value.indexOf("\n") == -1) {
2611+
struct.putNewline(key, theLineSeparator);
2612+
logger.fine(struct.getClass(), "a23_enforce_line_break_after_single_line_comment" + ": at " + key + ".");
2613+
}
2614+
}
2615+
}
2616+
}
2617+
}
2618+
25962619
-- --------------------------------------------------------------------------------------------------------------------
25972620
-- R2: 3 space indention.
25982621
-- --------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)