-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore directories #8
Comments
Hey, I wonder what should be the convention to prevent the formatting because from my understanding of editor configs they work in the way so that the ones in child directories can override the settings defined in root directory. So that if setting Edit:
|
There should not be a difference between what VS does and what |
I forked this repo to demonstrate it here. The format.sln has two projects, dotnet-format.csproj and dotnet-format.UnitTests. In this case I want to format the sln solution file and still prevent dotnet-format from formatting files in the UnitTests project. I replaced the true editorconfig in the solution root with a modified one. I then added a new editorconfig to the UnitTests project directory. This works well for VS2019 as it does not recommend any changes and "format document" doesn't do anything for files in the UnitTests project. When running dotnet-format against the sln solution file however, files are mutated in the UnitTests project. Clone the repo and run dotnet-format against the format.sln. |
Nested .editorconfigs still not supported Why this closed? |
@s-tarasov Can you open a new issue with what you are seeing in more detail? I verified that the behavior described in this issue has been fixed. |
First off, I love this; great work!! I have a few directories I need to exclude. In Visual Studio this is easy to achieve by making editorconfig files in those directories and setting them as root
root = true
and no other content. Visual Studio respects that editorconfig and formatting within that directory applies no changes because it doesn't respect VS default formatting preferences when an editorconfig is present.When running dotnet-format, all projects are formatted, including the projects with these extra editorconfig files set as root and no other content. I presume this is by design because, this repo's readme states that "Preferences will be read from an .editorconfig file, if present, otherwise a default set of preferences will be used.".
I can always undo changes rendered in those problem directories or I can specifically run format for the specific project files and code files via a pre-built exe or powershell script but that seems unnecessary.
Thank you again for this tool, it's great.
The text was updated successfully, but these errors were encountered: