Open membphis opened 3 years ago
@Koihik can you give me some suggestions about this feature? I want to make a try with it.
I didn't quite understand what you want to achieve.
Could you provide some code samples?
need a way to specify the style(one or two blank lines between the functions):
-- two blank lines between the functions
function x()
print(1)
end
function y()
print(1)
end
-- one blank line between the functions
function x()
print(1)
end
function y()
print(1)
end
We don't have this configuration and at a glance it seems non trivial (perhaps even impossible) to implement
here is my hack way:
https://github.com/Koihik/LuaFormatter/compare/master...membphis:membphis-2blank-func
I do not sure if it is acceptable, if yes, I'll try to submit a PR.
here is my hack way:
master...membphis:membphis-2blank-func
I do not sure if it is acceptable, if yes, I'll try to submit a PR.
If it works out for you then it's fine. The problem is that we can't accept it as is because it would also affect code like this:
set_callback(function ()
-- ...
end)
function foo()
function bar()
end
-- ...
end
local a = function ()
-- ...
end
The visitor pattern that we use to parse the AST can't distinguish the function declaration in these situations without the need for more processing
@tammela Many thx for your remind I'll try to find a better way
I checked the doc: https://github.com/Koihik/LuaFormatter/blob/master/docs/Style-Config.md
I do not find this field.