- Published on
PHPStorm vs VS Code
- Kevin McKee
I'm taking Caleb Porzio's Make VS Code Awesome course and trying to decide if I want to switch from PHPStorm or just implement all the best keybindings from his recommendations into my PHPStorm workflow.
This is just a stream of consciousness blog on all the things I'm coming across that are different, and which I prefer.
I have customized PHPStorm quite a bit over the years and so I don't actually know if the keybindings I have are default or my own customizations, so if you see anything that doesn't make sense, feel free to tell me on Twitter.
Code Commenting -
Cmd + / to comment a line of code, in PHPStorm it automatically takes me to the next line. I love this because a lot of times I need to comment a few lines one after the other.
In VS Code, when I comment the code, it stays on that line. :sadface:
UPDATE: There is a VS Code plugin that adds this functionality. Just install Comment Line Down and it works. Thanks @kenonb
Toggle Font Size and Line Height - VS Code
One of the thing that blew me away from Caleb's course was the ability to use a quick shortcut to switch from what I'd call "coding view" to "summary view". One of his custom keybindings allows you to change the font-size and line height so easily.
The closest I could find to this in PHPStorm is a keybinding to increase or decrease font size. I couldn't find anything to change the line height.
The other option in PHPStorm would be to switch to a different theme (which could be exactly the same as your current theme, just with a different font size and line height), but you can't switch themes with a fast shortcut. You can "Quick Switch Scheme", then you need to choose Color Scheme, then the one you want.
This is a big win for VS Code in my opinion.
Access The Last File - VS Code
If I want to go to the most recent file I had open before, I can hit
Cmd + P P and it takes me right back to that file. I don't have to hit enter.
In PHPStorm, I use the shortcut
Cmd + E, but I have to hit "Enter" to go to that file. I used to be able to just release Cmd + E and it would take me to the file I wanted, but at some point that stopped working and I don't know how to fix it.
Not a huge difference, but one I like a little better for VS Code.
Search for Class -
The overall search is great in both PHPStorm and VS Code.
Cmd + P and you can find lots of stuff. However, I like to filter my search to just PHP classes ("Go to Class" in the Keymap), and I can do that easily in PHPStorm using
Cmd + O.
I can also search for "Symbols" in PHPStorm, which is basically searching for methods throughout the whole codebase. This is really cool. Watch the difference in trying to find a "strip_http" method in VS Code vs PHPStorm:
UPDATE: After going further in Caleb's course, it looks like this is just as easy in VS Code once you download the Intelliphense plugin.
Cmd + Shift + R gives you a global symbol search. I deleted my VS Code gif since it was wrong. I left the PHPStorm but VS Code works basically the same way.
See File Structure - PHPStorm
When I'm in a file, I can quickly see and search for every variable or method and go directly to it very quickly. I can also see every inherited variable or method as well.
This is really important when I'm using Laravel because typically my classes extend other classes and implement traits and more. I can see all of this in one place so easily in PHPStorm.
As far as I know, VS Code doesn't have this.
UPDATE: It looks like VS Code does have this with the Intellephense plugin using
Cmd + R, but it doesn't seem to have the inherited methods. The inherited methods are the most valuable piece to me, so I'm going to still call this a win for PHPStorm unless someone can tell me how to get the inherited stuff.
Auto Rename Closing Tag -
When I change an opening tag, of course I want to change the closing tag too. This works out of the box with PHPStorm, but it looks like there is an extension for this in VS Code. Since it's a simple customization, I call it a tie.
Want to talk about this post? Connect with me on Twitter →