Our website is undergoing maintenance. You may experience some unexpected updates or outages. We appreciate your patience as we work to improve your online experience.
In Microsoft Visual Studio version 16.4 a new feature was, I was going to say introduced, but snuck in might be more appropriate way of describing things. There was no mention of the new feature in any release notes that we can find, and an internet search for the name of the new feature currently returns no useful matches!
The feature is called Adaptive Formatting and apparently what it does is allows code editor windows to “heuristically determine if the current file should use tabs or spaces for indentation”. Previously this behavior was determined by a language specific setting, and those settings are still present, but if Adaptive Formatting is enabled (which it is by default by the way), then it wins!
So if your code is indented with tabs, and suddenly Visual Studio decides to start using spaces instead (or vice-versa) then it’s probably Adaptive Formatting getting it wrong! Thankfully this new feature can be disabled by going into Tools > Options > Text Editor > Advanced and un-checking the Use adaptive formatting option.
Happy coding everyone!
Additional information from a MS employee on Adaptive Formatting at the following link, see Post #5.