sublimator wrote:Maybe we could create a plugin, that searches the header comments for meta information, such as indentation size? I wonder if things like that will be settable on a per project basis.
There's no reason a plugin couldn't be created that set the tabSize and translateTabsToSpaces settings via onLoad. It's pretty simple to do a reasonably good job at detecting indentation settings:
* Grab the first couple of hundred of lines from the file (Need to do enough so that long header comments don't break things, and not so many that it keels over on million line log files)
* Remove all the lines that start with no white space or only a single space
* Of the remaining lines (assuming there are enough to make a valid attempt, say > 10):
- If the majority start with a tab, set translateTabsToSpaces to be true
- Otherwise, set the tabSize to the highest value such that 90% of the lines have the property numberOfLeadingSpaces % tabSize == 0