LoginSignup
6
3

More than 5 years have passed since last update.

Riderでコードスタイルの設定を行う方法

Posted at

普段Unityで開発を行う際のコードエディタとしてJetbrainsのRiderをガンガン使わせていただいていますが、
ある日、private変数名は_(アンダースコア)のprefixを付けよう派(Resharper使用派)と付けない派(Resharper未使用派)で意見が分かれたことがありました。
もしprefix付けないことになった場合、Riderのデフォルト設定では以下のようにエディタ上にワーニングが出てしまうので、コードスタイルの設定方法を備忘録の意味も含め書いておきます。

Hoge_cs_-_Gun_-____Projects_UnityProjects_Gun_Gun_sln__-_Rider_1_0_EAP.png

設定方法

「Preferences」の[Editor]-[Code Style]-[C#]の[Naming]タブをを開くと、以下のように「Instance field (private)」が"lowerCamelCase"となっているので、[Pre...]に設定されている"_"を削除します。

Preferences.png

すると、以下のようにエディタ上にワーニングが出なくなります。

Hoge_cs_-_Gun_-____Projects_UnityProjects_Gun_Gun_sln__-_Rider_1_0_EAP.png

ワーニングがいっぱいあるとエディタが重くなるようなので、チームのコーディングルールに合わせて正しく設定するほうが良いようです。

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