「VisualStudioCode/設定/editorconfig」の版間の差分
提供: 初心者エンジニアの簡易メモ
| 行1: | 行1: | ||
==editroconfig設定方法== | ==editroconfig設定方法== | ||
| − | プロジェクト直下に.editorconfigファイルを置く | + | #[VisualStudioCode/設定/omnisharp]] [ショートカット] のomnisharp.jsonの |
| + | #プロジェクト直下に.editorconfigファイルを置く | ||
例 | 例 | ||
2025年3月2日 (日) 00:45時点における版
editroconfig設定方法
- [VisualStudioCode/設定/omnisharp]] [ショートカット] のomnisharp.jsonの
- プロジェクト直下に.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 = true # `{}` をインデント
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 が推奨
