Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax error when formatting luau return type and trailing comment #608

Closed
filiptibell opened this issue Oct 22, 2022 · 1 comment · Fixed by #612
Closed

Syntax error when formatting luau return type and trailing comment #608

filiptibell opened this issue Oct 22, 2022 · 1 comment · Fixed by #612
Labels
bug Something isn't working

Comments

@filiptibell
Copy link
Contributor

Formatting a function with a comment after a single return type enclosed in parentheses formats the code from something like this:

function foo(): (
	nil -- Some comment
)
	return nil
end

To this:

function foo(): (nil -- Some comment)
	return nil
end

The closing parentheses is now part of the comment and produces a syntax error.
StyLua could either enforce no parentheses on single return types or format it as the original code block when parentheses are found, either solution works IMO.

@JohnnyMorganz JohnnyMorganz added the bug Something isn't working label Oct 22, 2022
@JohnnyMorganz
Copy link
Owner

JohnnyMorganz commented Oct 27, 2022

Going to separate out the parentheses removal as a separate feature request: #611

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants