editorconfig / editorconfig-visualstudio

EditorConfig Visual Studio Addin
http://editorconfig.org
Other
352 stars 74 forks source link

Apply insert_final_newline setting to csproj files #43

Open 501st-alpha1 opened 8 years ago

501st-alpha1 commented 8 years ago

When I modify a setting in Visual Studio that modifies the project file (<something>.csproj), that file is saved without a final newline, even though my .editorconfig contains insert_final_newline = true.

Since I occasionally edit the file outside of Visual Studio, my current workaround is to disable the final newline for the project file, but it would be nice to not have to do this.

robertcoltheart commented 8 years ago

Project and solution files are not currently being processed. This is definitely a bug, but as yet I haven't found a solution.

For technical reasons unknown, .csproj and .sln items are in the IVsRunningDocumentTable table at save time, but do not have a text buffer associated with them, likely because they do not have an active open window (?). Thus the plugin sees that project and solution files are modified, but can't intercept the text buffer to apply editorconfig rules.

One way around this would be to listen to the OnAfterSave event and then modify the project/solution files straight from the disk. However the side-effect would be that VS would get 'project changed' notifications, so this is far from ideal.

I'm still searching for a solution to this.