From 2645e9cc1ff42ff306988bcf9f65944c605e022d Mon Sep 17 00:00:00 2001 From: kas-luthor Date: Fri, 1 Sep 2017 09:15:13 +0200 Subject: [PATCH] Look for .editorconfig in cwd and parent directories when readinf from STDIN and no explicit config dir given on command line --- src/dfmt/main.d | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/dfmt/main.d b/src/dfmt/main.d index 8efe767..fb4c415 100644 --- a/src/dfmt/main.d +++ b/src/dfmt/main.d @@ -146,13 +146,21 @@ else { import std.file : getcwd; + auto cwdDummyPath = buildPath(getcwd(), "dummy.d"); + Config config; config.initializeWithDefaults(); if (explicitConfigDir != "") { config.merge(explicitConfig, buildPath(explicitConfigDir, "dummy.d")); } - config.merge(optConfig, buildPath(getcwd(), "dummy.d")); + else + { + Config fileConfig = getConfigFor!Config(getcwd()); + fileConfig.pattern = "*.d"; + config.merge(fileConfig, cwdDummyPath); + } + config.merge(optConfig, cwdDummyPath); if (!config.isValid()) return 1; ubyte[4096] inputBuffer;