Code Editors - Visual Studio Code

My favorite feature so far is in the form of an extension. The vscode-php-debug extension works better than any free PHP debugging solution I have tried, such as Eclipse, Netbeans or SublimeTextXdebug. In order to use the debugger, the Xdebug PHP extension will need to be installed for your version of PHP. Here are some Xdebug installation resources:

User Settings

My VS Code user preferences – I am not thrilled with the existing VS Code Git integration, I prefer the command line tools for this, so I have it disabled in my settings. Another setting I changed from the default, "workbench.editor.enablePreview": true – When this is set to true, a subsequent file open will close the previous file if it has not been double clicked or edited. I wanted to keep the files open, so I set this to false.

~\AppData\Roaming\Code\User\settings.json
// Place your settings in this file to overwrite the default settings
{
    "editor.renderWhitespace": true,
    "editor.fontFamily": "Fira Code",
    "editor.fontLigatures": true,
    "editor.fontSize": 13,
    "editor.lineHeight": 22,

    "files.trimTrailingWhitespace": true,

    // Is git enabled
    "git.enabled": false,

    "window.zoomLevel": 0,

    "workbench.editor.enablePreview": false
}

Extensions

Here is a list of my favorite VS Code extensions

PHP Debug

Remote debugging with xdebug – As noted in the Remote Host Debugging section, To make VS Code map the files on the server to the local machine, add the serverSourceRoot and localSourceRoot settings in the project .vscode/launch.json file. For example,

launch.json
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "serverSourceRoot": "/var/www/html",
            "localSourceRoot": "${workspaceRoot}"
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
    ]
}

Resources