Skip to content

Allow newlines within ParameterList and ImportStatement#26

Open
cr7pt0gr4ph7 wants to merge 2 commits into
konodyuk:masterfrom
obsidian-typing:allow-newlines
Open

Allow newlines within ParameterList and ImportStatement#26
cr7pt0gr4ph7 wants to merge 2 commits into
konodyuk:masterfrom
obsidian-typing:allow-newlines

Conversation

@cr7pt0gr4ph7
Copy link
Copy Markdown

@cr7pt0gr4ph7 cr7pt0gr4ph7 commented Apr 11, 2025

Allow newlines in certain places to allow spliting very large field types and import lists across multiple lines while making sure the grammar remains unambiguous.

Newlines are now allowed in the following places:

  1. Directly after the opening bracket [ of a parameter list resp. directly after the opening brace { of an imported name list.
  2. Directly after (but not before) a comma , within a parameter list or imported name list.
  3. Directly before the closing bracket ] of a parameter list resp. directly before the closing brace } of an imported name list.
  4. As before: To terminate a syntactically valid declaration or line comment
  5. As before: Before, after and between the declarations within a section
  6. As before: Within triple-quoted strings

So these are valid:

Tip

Valid Examples:

Note[
    "TypeA",
    "TypeB"
]
Note
Note["TypeA"]
Note["TypeA"
]
Note[
    "TypeA"]

While all of these are not:

Caution

Invalid Examples:

Note
["TypeA"]
Note[
    "TypeA"
    , "TypeB"
]

Allow newlines in certain places to allow spliting very large field types
and import lists across multiple lines while making sure the grammar
remains unambiguous.

Newlines are now allowed in the following places:

1) Directly after the opening bracket "[" of a parameter list resp.
   directly after the opening brace "{" of an imported name list.

2) Directly after (but not before) a comma "," within a parameter list or
   imported name list.

3) Directly before the closing bracket "]" of a parameter list resp.
   directly before the closing brace "}" of an imported name list.

4) As before: To terminate a syntactically valid declaration or line comment
5) As before: Before, after and between the declarations within a section
6) As before: Within triple-quoted strings

So this is valid:

    Note[
        "TypeA",
        "TypeB"
    ]

    Note

    Note["TypeA"]

    Note["TypeA"
    ]

    Note[
        "TypeA"]

While all of these are not:

    Note
    ["TypeA"]

    Note[
        "TypeA"
        , "TypeB"
    ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant