VisualStudioCode/設定/editorconfig
提供: 初心者エンジニアの簡易メモ
editorconfig設定方法
- 拡張機能のeditorconfig https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig を入れる
- VisualStudioCode/設定/omnisharp [ショートカット] のomnisharp.jsonの以下をtrueにする
"EnableEditorConfigSupport": false,
- プロジェクト直下に.editorconfigファイルを置く
例
# .editorconfig のルート設定 root = true # すべてのファイルに適用 [*] indent_style = space # インデントをスペースにする(tabs にするとタブ) indent_size = 4 # インデント幅(タブの場合は `tab_width = 4`) end_of_line = lf # 改行コード(lf / crlf / cr) charset = utf-8 # 文字エンコーディング trim_trailing_whitespace = true # 行末の空白を削除 insert_final_newline = true # ファイルの最後に改行を追加 # C#(.cs)の設定 [*.cs] indent_style = space indent_size = 4 dotnet_diagnostic.IDE0055.severity = suggestion # コードフォーマットの警告を提案レベルにする # C# コードフォーマット設定 csharp_indent_case_contents = true # switch の case 内をインデント csharp_indent_braces = false # `{}` をインデント csharp_new_line_before_else = true # `else` の前に改行 csharp_new_line_before_catch = true # `catch` の前に改行 csharp_new_line_before_finally = true # `finally` の前に改行 csharp_space_after_keywords_in_control_flow_statements = true # if や for の後にスペース csharp_space_before_open_square_brackets = false # `array[index]` の `[` の前にスペースを入れない csharp_space_within_square_brackets = false # `array[ index ]` のような空白を入れない # JSON ファイルの設定 [*.json] indent_style = space indent_size = 2 # JSON は一般的にスペース 2 が推奨