自動偵測專案的技術棧與主流工具,產生或補齊 .editorconfig 設定,保留既有自訂偏好。
掃描專案根目錄,識別使用的語言與工具:
| 偵測依據 | 識別技術 |
|---|---|
*.csproj、*.sln | C# / .NET |
package.json | JavaScript / TypeScript / Node.js |
tsconfig.json | TypeScript |
*.vue | Vue 3 |
vite.config.* | Vite |
*.py、pyproject.toml | Python |
go.mod | Go |
Dockerfile、docker-compose*.yml | Docker |
*.md、*.json、*.yaml、 |
*.yml| 標記語言 / 設定檔 |
若 .editorconfig 已存在:
indent_size、end_of_line 等)。若不存在,從空白開始建立。
依偵測到的技術棧組合對應規則,套用下列各段落:
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
[*.cs]
indent_size = 4
[*.{csproj,props,targets}]
indent_size = 2
[*.{sln}]
indent_style = tab
[*.ps1]
charset = utf-8-bom
end_of_line = crlf
indent_size = 4
[*.csv]
charset = utf-8-bom
trim_trailing_whitespace = false
[*.py]
indent_size = 4
max_line_length = 88
[*.go]
indent_style = tab
indent_size = 4
[*.md]
trim_trailing_whitespace = false
max_line_length = off
[*.{yaml,yml,json,toml}]
indent_size = 2
[*.sh]
end_of_line = lf
indent_size = 2
[Dockerfile]
indent_size = 4
已存在 .editorconfig:使用 Merge 模式,將缺少的段落插入適當位置,不移動或覆蓋已有內容。
不存在 .editorconfig:依上述順序建立完整的新檔。
輸出: