CppCXY / EmmyLuaCodeStyle

fast, powerful, and feature-rich Lua formatting and checking tool.
MIT License
140 stars 27 forks source link

Improve formatting when line-breaking #67

Closed FlashHit closed 1 year ago

FlashHit commented 2 years ago

If there is a max line-length it breaks the line in a not optimal way.

Example

local s_Guids = { Guid("0000-0000-0000-000000"), Guid("0000-0000-0000-000000") }

there would be cases where it would do:

local s_Guids = { Guid("0000-0000-0000-000000")
    , Guid("0000-0000-0000-000000") }

Instead, if it has to create a line break or if there exists a line break already, it should do:

local s_Guids = {
    Guid("0000-0000-0000-000000"),
    Guid("0000-0000-0000-000000")
}
CppCXY commented 2 years ago

line-breaking is a difficult thing to do, especially under the current framework. but I allow the results of your manual. I am working on a refactoring of this formatter, it need a long time

CppCXY commented 1 year ago

Maybe I should provide a preference series option, what name do you want to give this option

FlashHit commented 1 year ago

What name did it get?

CppCXY commented 1 year ago

https://github.com/CppCXY/EmmyLuaCodeStyle/blob/26f24fc7ab0582ee6192fca4b10c6cb25b17be5d/lua.template.editorconfig#L121