Skip to content

stylua: ignore comment not respected in table #1134

Description

@eamonburns

I have a table that is a list of command line arguments, and I would like flags and their values to be on the same line so that it is more readable.

local args = {
	"--foo", "foo",
	"--bar", "bar",
	"pos1",
	"pos2",
}

Understandably, stylua formats this with each item on its own line:

local args = {
	"--foo",
	"foo",
	"--bar",
	"bar",
	"pos1",
	"pos2",
}

So, I add -- stylua: ignore start and -- stylua: ignore end:

local args = {
	-- stylua: ignore start
	"--foo", "foo",
	"--bar", "bar",
	"pos1",
	"pos2",
	-- stylua: ignore end
}

But it messes up the formatting:

local args = {
	-- stylua: ignore start
	"--foo",
"foo",
	"--bar",
"bar",
	"pos1",
	"pos2",
	-- stylua: ignore end
}

The expected behavior is to not touch anything from the -- stylua: ignore start and the newline after --stylua: ignore end.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions