LoginSignup
6
3

More than 5 years have passed since last update.

IntelliJ + EditorConfig + erb でインデントがどうにもならない時の解決方法

Posted at

例えば以下の様な.editorconfigをおいた場合、

.editorconfig
[*]
indent_style = space
indent_size = 2

erbが以下のような中途半端なインデントになって気持ち悪くてなんとかしたかった。

sample.erb
<div>
  ここはインデント2
</div>

<%= form_for @form do |f| %>
    <%= f.text_field(:text) %><%-- なぜかここはインデント4 --%>
<% end %>

なんかうまいことやればeditorconfigでなんとかなるかもしれないが、
とりあえずIntelliJの設定画面の
Editor > Code Style > Other File Types
Tab sizeIndentの数字をいじったら解消されることが判明、
一旦それで回避することにしたというメモ。

6
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
3