Extensions

I’m using vscode for about 6 months. I use some extensions to help me work comfortable. Let’s list them:

Note: I’ll list only the must-have plugins on my list. Themes and extensions that I’m experimenting will be kept out.

Code Runner

This extension can run a piece of code and show you the output on the console. It supports many languages. I use it like Sublime’s build system. Sometimes I want to experiment some function, try an algorithm and see if it works etc. Sometimes I use the mistakes.io to do that too. For PHP, some people use sites like phptester, but having this on the editor is far easier. And you don’t even have to create a file to run it. It creates a temporary file to run.

Git Project Manager

With this extension you can open a different project very fast. You configure in what folders your projects are and it will search for git repos in all subfolders. Then you can open a new window with a different project with a shortcut. Press ctrl+alt+p and it will list the projects. You select the one you want and hit enter. Very handy.

Path Intellisense

It brings autocomplete for paths in the filesystem.

PHP Intellisense

Edit: Since I wrote this post, there’s a new language server for PHP, [PHP] Intelephense. Still a preview, but it works nicely. The autocomplete is very, very fast. I’m using it now and one thing is different in my daily use: “find usages” is not working and I miss it :’(. Edit 2: PHP Intelephense now supports “find usages”. It’s awesome \o/ :)

To work with PHP, this extension is a must-have. It will parse all your project’s file and provide information to the great features of vscode to work with PHP code too, like autocomplete, go to definition, symbol search, code formatting and more.

Tip: sometimes the language server of this extension starts to use a lot of CPU and memory. With Linux + HDD (I don’t use vscode on windows or macOS to know) the machine can freeze and you will need to restart. This happened to me with 2 files in my project over the last few months. But since my work machine was changed by one with SSD, when it happened I was able to kill the language server and get back to work. It’s not very common, but know that it can happen.

There’s three things that bother me:

the autocomplete is very slow;

it doesn’t have signature help, so when I don’t remember the arguments of a function or method, I have to open it to see;

not always it knows the type of the variable that I’m using, so the autocomplete doesn’t work at all. Also doesn’t support type annotation, that often helps with other editors and IDEs;

PHP Debug

This extension add support for PHP in the integrated debugger.

Git Lens

With this extension, you always know who authored the current line of the code you are working on. You can see the history of the files, blame annotations and more.

vscode-icons

We all love icons. This extension show icons in your sidebar!

vscode-jest

If you use jest, this extension is for you. It runs automatically your tests and shows the result for each scenario as you change it. It’s like using the watch option on jest, but you can see the results in the editor instead of the terminal.

Settings Sync

As like the name suggests, you can sync your editor settings, extensions, shortcuts and themes between different machines. It uses a gist on your github account to sync.

Docker

The Docker extension has a lot of features to work with docker, like generation of Dockerfile and docker-compose.yml, snippets and more. It also has linting and provide intellisense for those files, with autocomplete.

Cucumber (Gherkin) Syntax and Snippets

At work, we are using Behat for testing. Thins extension brings syntax highlight and, more important, is a dependency of the next extension.

Behat Checker

I wrote this extension because the only decent tool that I found to work with behat is PHPStorm. On my team, the QA people wrote the features and the developers wrote the contexts to run the features. One problem that we have is that A LOT OF TIMES the features have the same steps, but with different writing. The contexts and steps reuse is one of the best features of the behat, IMHO, so fix this steps on feature files was a very boring task. And we can’t blame the QA people for this, because PHP Storm is expensive to buy only to write feature files. So this extension reads the contexts of the project and highlights the ones in the feature files that aren’t implemented. This way, the QA people can ask themselves “this step is really new or it’s just a different writing than before?”.

The plan is to add more features in the future, but for now it helps a little.