StyLua icon indicating copy to clipboard operation
StyLua copied to clipboard

Luau Type Unioning should support Multi-Line formating

Open nightcycle opened this issue 2 years ago • 0 comments

``I recently began using StyLua and love how it's made my functions more readable by moving the parameters to multiple lines when there are too many of them. I believe it should do the same for unioned types, as currently is fits them all into a single line, making it fairly unreadable. Here's an example from a recent project of mine using custom types.

Current StyLua format:

type PseudoEnumItemConstructor =
	(((GuiThemeTypeEnum, string) -> GuiThemeType) & ((GuiBrandTypeEnum, string) -> GuiBrandType) & ((GuiStateModifierEnum, string) -> GuiStateModifier) & ((GuiBrandTypeEnum, string) -> GuiBrandType) & ((GuiStateModifierEnum, string) -> GuiStateModifier) & ((GuiDensityModifierEnum, string) -> GuiDensityModifier) & ((GuiColorPaletteEnum, string) -> GuiColorPalette) & ((GuiTypographyEnum, string) -> GuiTypography) & ((GuiColorTypeEnum, string) -> GuiColorType) & ((ValidityFailTypeEnum, string) -> ValidityFailType) & ((VehicleClassEnum, string) -> VehicleClass) & ((VehiclePurposeEnum, string) -> VehiclePurpose) & ((FuelTypeEnum, string) -> FuelType) & ((LaneTypeEnum, string) -> LaneType) & ((InfrastructureTypeEnum, string) -> InfrastructureType) & ((FoundationTypeEnum, string) -> FoundationType) & ((BiomeTypeEnum, string) -> BiomeType) & ((BuildStateEnum, string) -> BuildState) & ((BuildMethodTypeEnum, string) -> BuildMethodType) & ((CurvePartTypeEnum, string) -> CurvePartType))

Proposed StyLua format:

type PseudoEnumItemConstructor = (
	((GuiThemeTypeEnum, string) -> GuiThemeType) 
	& ((GuiBrandTypeEnum, string) -> GuiBrandType) 
	& ((GuiStateModifierEnum, string) -> GuiStateModifier) 
	& ((GuiBrandTypeEnum, string) -> GuiBrandType) 
	& ((GuiStateModifierEnum, string) -> GuiStateModifier) 
	& ((GuiDensityModifierEnum, string) -> GuiDensityModifier) 
	& ((GuiColorPaletteEnum, string) -> GuiColorPalette) 
	& ((GuiTypographyEnum, string) -> GuiTypography) 
	& ((GuiColorTypeEnum, string) -> GuiColorType) 
	& ((ValidityFailTypeEnum, string) -> ValidityFailType) 
	& ((VehicleClassEnum, string) -> VehicleClass) 
	& ((VehiclePurposeEnum, string) -> VehiclePurpose) 
	& ((FuelTypeEnum, string) -> FuelType) 
	& ((LaneTypeEnum, string) -> LaneType) 
	& ((InfrastructureTypeEnum, string) -> InfrastructureType) 
	& ((FoundationTypeEnum, string) -> FoundationType) 
	& ((BiomeTypeEnum, string) -> BiomeType) 
	& ((BuildStateEnum, string) -> BuildState) 
	& ((BuildMethodTypeEnum, string) -> BuildMethodType) 
	& ((CurvePartTypeEnum, string) -> CurvePartType)
)

Thank you for your time!

nightcycle avatar Aug 12 '22 01:08 nightcycle