millermedeiros / esformatter

ECMAScript code beautifier/formatter
MIT License
970 stars 91 forks source link

infer options based on sample file(s) #299

Open millermedeiros opened 9 years ago

millermedeiros commented 9 years ago

this feature request came up on IRC a couple days ago, basically so you don't need to write a config file and can start working on legacy projects.

this should be really hard to implement properly (style can be ambiguous/mixed, hard to make it accurate) but we could probably achieve good results by replacing the rocambole-linebreak and rocambole-whitespace modules with something that just counts the amount of LineBreak and WhiteSpace but does not update it.

the way that detect-indent decides what style to pick is pretty smart.

this is definitely low priority since there are other things that are way more important and most people will probably just end up using some preset (like standard-format or jQuery style guide) and/or overwriting minimal settings on the config file.

PS: I don't have any plans to start working on this feature anytime soon.. -- in fact I might never do it -- but would be happy if someone found a clean solution for this problem :D

millermedeiros commented 9 years ago

looks like codepainter is still under development and they do support this feature.