diff --git a/src/sqlfmt/comment.py b/src/sqlfmt/comment.py index c526f70..165d7f2 100644 --- a/src/sqlfmt/comment.py +++ b/src/sqlfmt/comment.py @@ -153,6 +153,9 @@ def _split_before(cls, text: str, max_length: int) -> Iterator[str]: """ if len(text) < max_length: yield text.rstrip() + elif re.match(r".*({{.*?}}|{%.*?%}).*", text): + # jinja comments are not split + yield text.rstrip() else: for idx, char in enumerate(reversed(text[:max_length])): if char.isspace():