Open FezVrasta opened 10 years ago
AngularJS proposes a coding style which could possibly be easier to implement. How about that?
$someModule.
doStuff().
doMoreStuff();
Would be still better then the current behavior.
This has to be implemented in CodeMirror.
Reviewed. One way we could do this is by making .
an electric char when it's at the beginning of a line in JS. Not sure if we would also have to make changes in the CM mode though.
Marking low priority to me.
.
is a very "not specific" character and make it electric could interfere with other stuff...
Remember we have to handle even when someone uses alias for the $
char, example:
jQuery('#sth')
.remove();
or
var sth = $;
sth('#something')
.remove();
I guess it would be ok to just check whether the previous line ends with a semicolon or not.
@SAPlayer, that's a perfectly simple idea in my opinion. Less is more.
Works also for the AngularJS coding style.
The only problem I see is that some developers still don't use semicolons at the end of the line. Perhaps the behaviour you propose could be toggled by using strict mode? That would also encourage some of those sloppier devs to switch to coding in strict mode :)
@tomekwi I don't think strict mode requires semicolons, unfortunately.
Yeah, it seems like this would require two changes:
@peterflynn I guess it's better implemented in CM (maybe with an option) 'cause it's valid JS coding style, which should also be supported by pure CM.
When I write Javascript jQuery code I get this automatic indentation:
Instead, following the jQuery line guides it should be:
There are chances this problem will be fixed? Thanks