Smart Semicolon


As a developer who's trying to level up my coding every day, I love finding little optimizations to increase my productive. This is a little gem that helps me out without thinking about it.

The Smart Semicolon extension for VS Code is just that... Smart.

All you do is press ; and it adds a semicolon to the end of the line. Super simple, but super helpful for languages like PHP.

A little bonus

To prevent yourself from having to do a lot of cursor movements when typing an anonymous function, add the ; before you break to a new line. You got what you need without having to move down a line and add it manually.

# Step 1 - Write an anonymous function
Route::get('foo', function() {|})

# Step 2 - Add the semicolon
Route::get('foo', function() {|});

# Step 3 - Press return
Route::get('foo', function() {
  |
});

This seems obvious, but it took me way to long to figure out. When I moved to VS Code I couldn't find a quick way to do this. I tried using the Vim extension, an old macro extension that didn't work. So I thought I was stuck doing the annoyingly slow (arrow down, add semicolon, arrow up, tab) movements by hand everytime.

Do you have any optimizations that increase your productivity? I would love to hear about them. Tweet me.



Other posts you might enjoy...
22 Oct, 2021
Closing Multiple Panels in VS Code
11 May, 2021
Mac Mail error occurred while moving messages to mailbox
23 Mar, 2025
Upgrading to PHP 8.1