Visual Studio Code Tips and Tricks

Here are some of the most used key combinations and plugins we like for Visual Studio Code

Collapse Outline

<Ctrl> + <LeftArrow> will collapse the entire list making browsing so much easier.

How to remove extra line breaks

The key to removing line breaks is mastering Visual Studio’s search / replace box. Once you have opened the box wit Ctrl+h, then you must switch to regular expression with Alt+r. It’s best to experiment because different use cases present different solutions. For example, you could try these regular expressions:


replace with


Multiple Cursors

Probably one of the most useful used shortcuts for web design. Please ESCAPE when done not ENTER.

Choose Next In Selection

Ctrl + D

Everything in Selection

You can add additional cursors to all occurrences of the current selection with Ctrl+Shift+L.

Do your thing then press ESCAPE, not ENTER.

Reference Editing Hacks:

Close All Files

Ctrl+K W

Duplicate Line

Ctrl+C + Ctrl+V on empty line

Import a class file

Alt Ctrl+I (I for India)

Quickly Jump to Any File

Ctrl+P allows you to search for any file

Align Equals Signs

Use the Better Align plugin, then invoke “Align” on the command palette

Invoke the Command Palette


Format the Document (and fix indentation)


Refactor Code Block

In our experience this is document for Visual Studio code but doesn’t work as well as PHPStorm. Install this plugin:

The official documentation is here:

And refers to a PHP plugin we don’t use (it has a poor rating):

Other Plugins

  • Caleb Better PHPUnit – allows you to run test under cursor
  • Align =>


Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top