Skip to content

Commit

Permalink
fix sqlfmt breaks up depends_on statements across multiple lines, cau…
Browse files Browse the repository at this point in the history
…sing an error in parsing #628
  • Loading branch information
ryantimjohn committed Nov 12, 2024
1 parent e9205a9 commit afbd944
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/sqlfmt/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit afbd944

Please sign in to comment.