Why doesn't EditorConfig trim trailing whitespace in Visual Studio 2012?

2

I have EditorConfig installed on my VS 2012 installation. It does not trim trailing whitespace, or add a line at the end of a file the doesn't have one. Here's my .editorconfig file.

The sln file is at this path: D:\production\SecretProjectName\Branches\Root\Unity\

The .editorconfig file is at: D:\production\

# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

[*.{cs,cpp,c,h,hpp}]
insert_final_newline = true
trim_trailing_whitespace = true

Almo

Posted 2015-11-26T19:12:51.237

Reputation: 339

Could you please clarify "Several levels up" in terms of Parent/Child in relation to the files in question? when you open a file, EditorConfig will search the directory, and its parents, until it hits root=true, so if this document is in a child of the directory containing the file, it will not apply. – Frank Thomas – 2015-11-26T19:29:33.083

try putting the file in ...\Unity. Since the plugin is installed in Visual Studio, it may not dig deeper than the solution path. It is unclear from the EditorConfig page whether search stops at the file system root path, or the Project/Solution root path. http://editorconfig.org/

– Frank Thomas – 2015-11-26T19:52:39.410

Answers

1

From the docs:

When opening a file, EditorConfig plugins look for a file named .editorconfig in the directory of the opened file and in every parent directory. A search for .editorconfig files will stop if the root filepath is reached or an EditorConfig file with root=true is found.

I thought this meant the top of the directory structure, or D:\. They mean "where the solution file is". It was not finding my config file, since it was above the folder with the solution file. Moving the config to the folder with the solution file fixed it.

Almo

Posted 2015-11-26T19:12:51.237

Reputation: 339