问题描述
在Emacs中,使用红宝石模式,我找不到办法阻止这种情况发生:
In Emacs, using ruby-mode, I can't find a way to stop this happening:
foo = if something?
42
else
7
end
我们的内部公约是:
foo = if something?
42
else
7
end
begin..end
和 case..when
)
此外,虽然不太麻烦,但是 case..when
的约定是缩小每个,当
。
Also, while it's less of a nuisance, our convention for case..when
is to indent each when
.
case whatever
when foo
"a"
when bar
"b"
else
"c"
end
我知道人们一般说你应该将与
案件
一致,但这不是我们公司的惯例,有人也知道如何定制这个吗?我可以找到很少定制的红宝石模式。我唯一能够自定义的内容是括号内的缩进。
I know people generally say you should align the when
with the case
, but it's not the convention of our company, so does anybody know how to customize this too? I can find very little customization for ruby-mode. The only thing I've really been able to customize is the indentation inside parentheses.
推荐答案
没有办法自定义。红宝石模式是缩写定制的关键,Matz(其原作者)完全坚持支持缩进标准样式。
There is no way to customize this. ruby-mode is pretty barebone as far as indentation customizations are concerned and Matz (its original author) is totally adamant in supporting the standard style for case indentation.
这篇关于Emacs红宝石模式缩进定制的case..when和从if..else分配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!