Home
PHP
Tech Tube
MySQL
Linux
CSS&HTML
JavaScript

Visual Studio Code

Visual Studio Code is so far the best free PHP editor that I've ever used. This article will contain some personal reminders on customization, problem-solving, and shortcuts. Common settings: https://code.visualstudio.com/docs/getstarted/settings Ignore directories from monitoring: https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc PHP Intelephense is a great extension for VSC. A useful addon that helps with the documentation, navigation, and the development process as a whole. It contains some premium features but it's OK even without them. https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client Another great extenson is PHP Docblocker. https://marketplace.visualstudio.com/items?itemName=neilbrayfield.php-docblocker You may also consider: https://marketplace.visualstudio.com/items?itemName=MehediDracula.php-namespace-resolver VSC supports a lot of color themes. My favorite theme is "Bluloco light" but some more info is available here: https://code.visualstudio.com/docs/getstarted/themes Work with terminal: https://code.visualstudio.com/docs/editor/integrated-terminal A nice description of file comparison using GitLense extension: https://stackoverflow.com/questions/42112526/how-to-compare-different-branches-in-visual-studio-code A great plugin that allows you to allign the code even faster: https://marketplace.visualstudio.com/items?itemName=wwm.better-align OpenAPI extension: https://marketplace.visualstudio.com/items?itemName=42Crunch.vscode-openapi Bookmarks: https://marketplace.visualstudio.com/items?itemName=alefragnani.Bookmarks Documentor: https://marketplace.visualstudio.com/items?itemName=ronvanderheijden.phpdoc-generator To generate the documentation use the following shortcut when the cursor is on the function name.
Ctrl + Enter
Shortcuts: Open terminal:
Ctrl + `
Comment or uncoment a line:
Ctrl + /
Switch tabs right:
Ctrl + PageUp
Switch tabs left:
Ctrl + PageDown
Close tab:
Ctrl + W
Edit multiple common strings:
Ctrl + D
Search in the project:
Ctrl + Shift + F
Search to replace:
Ctrl + H
Replace all when the search is done:
Ctrl + Alt + Enter
Search by file name:
Ctrl + P
Go to color themes list (in that order):
Ctrl + K + T
Go to settings:
Ctrl+,
Install extension:
Ctrl + Shift + P
Then type "Install extensions" and go on. Format JSON
Shift+Alt+F
Format JSON (Mac)
Shift + Option + F
Browse extensions:
Ctrl + Shift + X
Add / remove bookmark

CMD + SHIFT + K
Or
 type "book toggle" after
CMD + SHIFT + P
Align/order the code (if you use better-align):
ctrl + cmd + =
Add custom shortcuts: https://code.visualstudio.com/docs/getstarted/keybindings#_advanced-customization For external keyboards you may switch the layout if you're switching it between Mac and PC this way:
Fn + O
and wait for 3 seconds. Find All References of a function in VS code
Shift + F12
Go to definition (when the cursor is on the function)
F12
Navigate back and forward On Windows:
Alt + ← 
Alt + → 
On Mac:
Ctrl + -
Ctrl + Shift + -
On Ubuntu Linux:
Ctrl + Alt + -
Ctrl + Shift + -