Give Visual Studio Code a try

I started with Netbeans for PHP many years ago, then turned to PhpStorm (or WebStorm for pure JS projects) and they both were very helpful and fulfilled all my developer requirements. During last year, in some cases and latest versions, performance started to be compromised. More and more memory was required, performance on my machine began to become compromised and the CPU temperature was high most of the time and get worst when I opened more than one Project. So I looked for an alternative and Started using Visual Studio Code.

The IDE is very lightweight, fast and customizable. The main problem I face when started with it was I am very used to PhpStorm’s shortcuts and theme. I am very lucky that both “issues” can be easily fixed by just adding a couple of extensions. The other “problem” (I thought) was the support for PHP, however, a couple of extensions saved my day(s).

So after a couple of weeks of usage, I am very confident to turn to VS Code because of its performance, it works on Windows, Mac, and Linux and finally but not less important, it is FREE!

Here is a list of extensions I use and made the switch less traumatic for not to say painless.

  • bmewburn.vscode-intelephense-client (includes the automatic addition of use  statements for namespaces when adding a class reference)
  • dbaeumer.vscode-eslint
  • eamodio.gitlens (Powerful git support extension)
  • felixfbecker.php-debug
  • felixfbecker.php-intellisense
  • felixfbecker.php-pack
  • formulahendry.auto-close-tag
  • formulahendry.auto-rename-tag
  • k–kato.intellij-idea-keybindings (Php/Web Storm shortcuts
  • octref.vetur (VueJs support)
  • rokoroku.vscode-theme-darcula (Php/Web Storm theme Darcula)
  • xyz.local-history (Local history for edited files)
  • cjhowe7.laravel-blade

Finally, here are some personal Settings I had to edit manually to support certain behavior I’m used to.

What all those settings do?

  • files.autoSave: “onWindowChange” saves all files when VSC window loose focus.
  • files.trimTrainlingWhitespace: true Remove trailing spaces when the file is saved.
  • local-history.path: “/path/to/history/folder” Its the path of the folder where xys.local-history extension stores all file changes. The extension creates one folder for each workspace to keep track of files changes.
  • workbench.editor.enablePreview: false Prevent open files in Preview Mode by clicking on the Explorer Panel. This mode automatically closes the file if not edited
  • window.title: “${activeEditorLong} – ${rootName}” Display full folder path of the active document in the Editor.

I haven’t added any more extensions as I didn’t get into a situation which requires anything exceptional (yet). So far it has been enough with this. I found many posts on who to configure php-debug extension using vagrant so I leave that explanation for them.

In order to install a extension, just look for the extension in the Extension button on the left panel 

or if you are a tough guy/girl, run from command line:

code --install-extension extension.id 

For instance: code –install-extension xyz.local-history

4 thoughts on “Give Visual Studio Code a try

  1. Great post. I also replaced Atom for VSCode 6 months ago. The change was easier than from a full ide (like PHPStorm) but I just noticed the speed increment searching for files.
    The most valuable feature is The git implementation, that comes in the core, it makes much more easy to merge large conflict merges.
    Also the phpcs extension for linting php projects according to the PSR standards.

    Regards and continue doing great things.

  2. Yeah I also switched from Atom to VSCode and so far it’s great. Mainly because it doesn’t suck at VIM key bindings like Atom does.

    Nice article 🙂

  3. Thanks for this post. Do those extensions provide intellisense with type hint support? What about getter/setter generation?

    I’m thinking of leaving Eclipse PDT and use VS Code for Angular and PHP projects 🙂

    1. Hello Rodrigo! I haven’t use it for Angular but I have no complain at all for Laravel/Drupal projects. I think if need support for Artisan, there are plenty of extensions that do it. In my case I use Homestead for Laravel projects so I run Artisan from the vm. I totally recommend the VSC because its lightweight and faster than other IDEs I worked with.

Leave a Reply

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