Skip to content

Conversation

@JohnnyMorganz
Copy link
Owner

When a single-line comment appeared between an index suffix (like .foo) and a table call argument ({}), the formatter would place the opening parenthesis/brace on the same line as the comment, causing it to be commented out and producing invalid Lua syntax.

For example, foo.bar -- comment { x } was being formatted as:

foo
    .bar -- comment({
        x,
    })

Now the anonymous call is correctly placed on a new line when the previous suffix has trailing single-line comments:

foo
    .bar -- comment
    ({
        x,
    })

Fixes #873

When a single-line comment appeared between an index suffix (like `.foo`)
and a table call argument (`{}`), the formatter would place the opening
parenthesis/brace on the same line as the comment, causing it to be
commented out and producing invalid Lua syntax.

For example, `foo.bar -- comment { x }` was being formatted as:
```
foo
    .bar -- comment({
        x,
    })
```

Now the anonymous call is correctly placed on a new line when the
previous suffix has trailing single-line comments:
```
foo
    .bar -- comment
    ({
        x,
    })
```
@JohnnyMorganz JohnnyMorganz enabled auto-merge (squash) January 24, 2026 16:07
@JohnnyMorganz JohnnyMorganz merged commit f02a235 into main Jan 24, 2026
21 checks passed
@JohnnyMorganz JohnnyMorganz deleted the anonymous-call-inline-comments branch January 24, 2026 16:08
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.

Output AST generated a syntax error

2 participants