SublimeJSCSFormatter
SublimeJSCSFormatter copied to clipboard
Make formatting only selected area.
What do you think?
I think people would enjoy being able to format a selected region. I'm not sure JSCS would work with this if you select a region that isn't valid code on it's own. @mikesherov @markelog, any ideas?
Esprima would throw an error and jscs would propagate it, you could check for the parser error and do the nop otherwise autofix it.
this is a tough problem. Not sure how best to proceed...
Oleg's solution seems to work well. You could possibly pipe the selected text into jscs or construct a temp file with the selected text and feed the filename in.
On Wed, Apr 29, 2015 at 12:05 PM, Mike Sherov [email protected] wrote:
this is a tough problem. Not sure how best to proceed...
— Reply to this email directly or view it on GitHub https://github.com/TheSavior/SublimeJSCSFormatter/issues/28#issuecomment-97481733 .
Come to think of it, there is another way to try, take user selection, if it has parser bugs - iteratively increase the selection until it stops showing parser bugs, limit that increase to two-three lines so it wouldn't take too much, but don't show the new selection to the user, try to autofix that, otherwise do the nop.