Skip to content

Variables' types not taken into account in for loop #360

@rstk

Description

@rstk

Seems to be related to #337

I have a long for loop with explicitly typed variables like this:

for _id: number, transform: Components.Transform, angularControls: Components.AngularControls, characterModel: Components.CharacterModel in world:query(Transform, AngularControls, CharacterModel) do
    -- ...
end

I would expect stylua to format the code this way:

for
    _id: number,
    transform: Components.Transform,
    angularControls: Components.AngularControls,
    characterModel: Components.CharacterModel
in world:query(Transform, AngularControls, CharacterModel) do
    -- ...
end

However, it gets formatted like this:

for _id: number, transform: Components.Transform, angularControls: Components.AngularControls, characterModel: Components.CharacterModel in
	world:query(Transform, AngularControls, CharacterModel)
do
	-- ...
end

This still exceeds my defined column_width of 100. If I set column_width to 110, stylua won't modify the code, which is still not desired behavior. If I remove the types and add more variables to match to column width, I get the expected result.

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