Skip to content

Comment pattern when styled introduces syntax error #995

@nightcycle

Description

@nightcycle

In a project I work on, this is how the code was originally formatted

local Dictionary: {[string]: number} -- comment
	= {
	["A"] = 1
	["B"] =2,
	["C"] = c
}

After running through stylua, it converted it into this, causing a syntax error:

local Dictionary: { [string]: number } -- comment =
	{
		["A"] = 1,
		["B"] = 2,
		["C"] = 3,
	}

I've shortened some variable names a bit for the example, I can provide the original in DMs if necessary. I'm using v2.1.0 with the following config:

column_width = 80
line_endings = "Unix"
indent_type = "Tabs"
indent_width = 4
quote_style = "AutoPreferDouble"
call_parentheses = "Always"
collapse_simple_statement = "Never"
syntax = "Luau"

[sort_requires]
enabled = false

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions