fredrikekre / Runic.jl

A code formatter for Julia with rules set in stone.
MIT License
92 stars 2 forks source link

Line continuation indent for triple-strings #45

Closed fredrikekre closed 3 weeks ago

fredrikekre commented 3 weeks ago

This patch introduces line continuation based indent for triple strings, which typically span multiple lines without any explicit newlines in the syntax tree (since they are hidden inside the string).

This result in the following changes, some of which are clearly bugfixes:

Operator chains:

 """
 abc
 """ * """
-def
-"""
+    def
+    """

Operator chain as assignment right hand side:

 x = """
-abc
-""" * """
-def
-"""
+    abc
+    """ * """
+    def
+    """

Implicit tuples:

 """
 abc
 """,
   """
-def
-"""
+    def
+    """

Note that single triple strings as a right hand side is excluded from the indent rule, similar to having if/try/let/... blocks as a right hand side.