[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua code formatters and beautifiers
- From: Martin <eden_martin_fuhrspam@...>
- Date: Sat, 10 Jun 2017 23:17:27 -0700
On 06/10/2017 09:07 AM, Russell Haley wrote:
> An option to NOT discard the comments (or perhaps a secondary api call?) sounds like a great little 'tweak' to the core library that would provide a desirable benefit. How much effort would that so called 'little tweak' be (just curious, not volunteering)?
For me the problem in code formatter with comments is what to do with
them? They can occur at any whitespace, and in many cases I see no way
to represent them in formatted code nicely. (There are some personally
disguising formatting styles in a wild which do not conform with style
reformatter wish.)
For example:
local function
-- bla-blah
foo( a -- parameter "a"
, b -- parameter "b"
)
return -- "return" returns values
a -- ref to "a"
+ -- plus means sum
b -- b!
end
More mad cases may be constructed:
local t = { [ --[[ hey, why not place comment here? ]] 1] = 1}
Simplest option is to drop comments at all. Other way is to group them
before parent statement. (I'm going to try latter in my code formatter
"lcf" someday.)
-- Martin