VSCode IDE Setup
Setting up the Visual Studio Code editor to work well with Drupal
Add XDebug

Under Extensions
in the left sidebar, search for "PHP Debug" and click "Install"
Edit
.vscode/launch.jsonAdd the following configuration:
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"pathMappings": {
"/app/": "${workspaceRoot}/",
}
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}Add Drupal coding standards

Under Extensions
in the left sidebar, search for "phpcs" and click "Install"
Click in top navbar navigate to
file > preferences > settingsUnder
Workspace Settingsexpand theExtensionsoptionLocate
PHP CodeSniffer configurationand scroll down to theStandardsection and click the "Edit in settings.json" linkAdd the following configuration to your
Workspace Settings:
{
"phpcs.standard": "vendor/drupal/coder/coder_sniffer/Drupal",
}Last updated
Was this helpful?