1

Is it possible to automatic add semicolon in sublime?

// 1
Route::get(|
// 2
Route::get(|);

After closing bracket insert ; at the end of line?

1
  • You'd have to delete that semicolon every time you type if (...) or for (...) or while (...) and such.
    – gronostaj
    Jul 3, 2014 at 13:09

2 Answers 2

2

You can do that with the Auto Semi-Colon plugin. It does exactly what you ask for, and it works with version 2 and version 3 of Sublime Text.

1
  • And it works very well too, taking action in function call syntax but not getting confused by a for(;;) construct. Typing a semicolon inside a string doesn't get interpreted specially though, which is fair enough, so binding a key sequence to a macro that goes to the end of line and inserts the semicolon would handle that case.
    – Nick
    Sep 6, 2015 at 23:15
1

I seriously doubt that this useful. Text editor has no way of knowing where are you going to end the line. Closing bracket does not indicate the end of the line. I am not sure what language are you programming in. But in most languages that use (), there are multiple scenarios when you would continue the line after closing bracket. Consider following examples in C:

if(condition)
{
   statement;
}

also

variable = functionA() + functionB();

and finally

object.methodReturningObject().method();

As you can see, you will end up manually deleting semicolon in all these cases (and many more)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .