editorconfig 0.16.2
dotnet add package editorconfig --version 0.16.2
NuGet\Install-Package editorconfig -Version 0.16.2
<PackageReference Include="editorconfig" Version="0.16.2" />
<PackageVersion Include="editorconfig" Version="0.16.2" />
<PackageReference Include="editorconfig" />
paket add editorconfig --version 0.16.2
#r "nuget: editorconfig, 0.16.2"
#:package editorconfig@0.16.2
#addin nuget:?package=editorconfig&version=0.16.2
#tool nuget:?package=editorconfig&version=0.16.2
EditorConfig .NET Core
The EditorConfig .NET core provides the same functionality as the EditorConfig C Core and EditorConfig Python Core.
Installation
Library (NuGet):
dotnet add package editorconfig
CLI tool:
dotnet tool install --global editorconfig-tool
The tool ships as a native AOT binary for each supported platform. When you
run dotnet tool install, the correct pre-compiled native binary is selected
automatically — no .NET runtime required at invocation time:
| Platform | RID |
|---|---|
| Linux x64 | linux-x64 |
| Linux Arm64 | linux-arm64 |
| Windows x64 | win-x64 |
| Windows Arm64 | win-arm64 |
| macOS Apple Silicon | osx-arm64 |
A framework-dependent fallback (any) is included for other platforms.
Usage
Library
// Recommended: caching and default filesystem
var parser = new EditorConfigParser();
var config = parser.Parse(fileName);
foreach (var kv in config.Properties)
Console.WriteLine("{0}={1}", kv.Key, kv.Value);
Parsing many files efficiently
When processing many files in one run (e.g. a formatter or linter), reuse the
same EditorConfigParser instance. The parser caches both compiled glob matchers
and the resolved .editorconfig chain per directory — so the second and subsequent
files in the same directory cost only a dictionary lookup plus glob matching,
with zero traversal overhead.
var parser = new EditorConfigParser();
// All files share one parser instance; files in the same directory
// share one resolved chain automatically.
var results = parser.Parse(file1, file2, file3 /*, ... */);
For explicit control (e.g. grouping files by directory yourself):
var chain = parser.GetResolvedChain(file1); // traverses once for this directory
var cfg1 = parser.Parse(file1, chain);
var cfg2 = parser.Parse(file2, chain); // zero traversal — same directory
Injecting a file system
Pass an IFileSystem
from System.IO.Abstractions
when you need a testable or virtual file system:
// Caching is enabled automatically
var parser = new EditorConfigParser(myFileSystem);
When fileSystem is omitted the library uses new FileSystem() (the real disk).
Performance
The library is designed to be high-performance and allocation-light.
- Zero-allocation glob matching — the match engine is a
ref structoverReadOnlySpan<char>, so matching produces no heap allocations. - Source-generated regexes — the INI parser uses
[GeneratedRegex]on .NET 7+ for optimal regex throughput. - Per-directory chain cache —
.editorconfigfiles are resolved once per directory per parser instance. For a repository with thousands of source files, the traversal andFile.Existschecks are paid at most once per unique directory. - File-content cache —
EditorConfigFileCache(used by default) caches parsed files by path + modification time + size. Cache hits require only a single metadata stat with no file read.
Benchmark results on Apple M2 Pro · .NET 10 · Arm64:
| Scenario | Time | Allocations |
|---|---|---|
| Single file, warm parser | 1.3 μs | 1.5 KB |
| 50 files, same directory, warm parser | 63 μs | 82 KB |
| Glob match (pre-compiled, per match) | 4.7 μs | 0 B |
Target frameworks
The library targets netstandard2.0, net462, and net10.0. All three targets
are functionally equivalent. The net10.0 target enables additional performance
features (source-generated regexes, AOT compatibility).
CLI tool
You can omit dotnet if installed as a global tool:
> dotnet editorconfig
Usage: editorconfig [OPTIONS] FILEPATH1 [FILEPATH2 FILEPATH3 ...]
EditorConfig .NET Core Version 0.12
Options:
-h, --help output usage information
-V, --version output the version number
-f <path> Specify conf filename other than ".editorconfig"
-b <version> Specify version (used by devs to test compatibility)
Example:
> dotnet editorconfig anatomy.md
charset=utf-8
insert_final_newline=true
end_of_line=lf
tab_width=8
trim_trailing_whitespace=sometimes
Development
Clone the repository and initialise the conformance test submodule:
git clone git@github.com:editorconfig/editorconfig-core-net.git
git submodule init
git submodule update
Build:
dotnet build
Run unit tests (TUnit):
dotnet run --project src/EditorConfig.Tests -c Release
Run the upstream editorconfig conformance suite (requires CMake):
cmake .
ctest .
Run benchmarks (BenchmarkDotNet):
dotnet run -c Release --project benchmarks/EditorConfig.Benchmarks
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- System.IO.Abstractions (>= 22.1.1)
- System.Memory (>= 4.6.3)
-
.NETStandard 2.0
- System.IO.Abstractions (>= 22.1.1)
- System.Memory (>= 4.6.3)
-
net10.0
- System.IO.Abstractions (>= 22.1.1)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on editorconfig:
| Package | Downloads |
|---|---|
|
Credfeto.Tsql.Formatter
TSQL Formatting tool |
|
|
Myriad.Core
Core Myriad library used for developing plugins |
|
|
Fantomas.Extras
Utility package for Fantomas |
|
|
Credfeto.DotNet.Code.Analysis.Overrides
Dotnet code analys rule management utilities |
GitHub repositories (3)
Showing the top 3 popular GitHub repositories that depend on editorconfig:
| Repository | Stars |
|---|---|
|
nightroman/FarNet
Far Manager framework for .NET modules and scripts in PowerShell, F#, JavaScript.
|
|
|
X-Sharp/XSharpPublic
Public repository for the source code for the XSharp Compiler, Runtime, Project System and Tools.
|
|
|
Elders/VSE-FormatDocumentOnSave
Visual Studio - Format Document on Save
|