Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一排if-elseif的换行问题 #141

Open
CppCXY opened this issue Sep 12, 2023 Discussed in #140 · 2 comments
Open

一排if-elseif的换行问题 #141

CppCXY opened this issue Sep 12, 2023 Discussed in #140 · 2 comments

Comments

@CppCXY
Copy link
Owner

CppCXY commented Sep 12, 2023

Discussed in #140

Originally posted by MrZ626 September 12, 2023

if a then a()
elseif b then b()
elseif c then c()
else d()
end

有时候我会这么写,但是目前的格式化风格好像不允许这种写法?翻了一圈没找着
会被格式化成

if a then
    a()
elseif b then
    b()
elseif c then
    c()
else
    d()
end

就太长了
还有一些形如function() a() b() end的包含两个语句的短行我也不希望被拆开,可以考虑加个选项不拆分这些情况吗?
最终需求应该是,允许控制每种语句块(if for while)后换行的条件:always必定换行,smart单条语句不换行,never永不主动换行

@CppCXY (不知道discussion会不会通知 保险at一下)

@CppCXY CppCXY added enhancement New feature or request feature request labels Sep 12, 2023
@CppCXY
Copy link
Owner Author

CppCXY commented Sep 12, 2023

要不要给你个机会自己实现 @MrZ626

@MrZ626
Copy link
Contributor

MrZ626 commented Sep 12, 2023

可以试下,不过最近这周比较忙,之后就来再细看看

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants