Skip to content

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

doc/editors.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,49 @@
1919
#### PHPStan
2020

2121
- [Configuration and usage with PhpStorm](https://www.jetbrains.com/help/phpstorm/using-phpstan.html).
22+
23+
## Visual Studio Code
24+
25+
### Debugging
26+
27+
#### Requirements
28+
29+
- PHP Debug (`xdebug.php-debug`) extension for VSCode by *Xdebug*.
30+
31+
#### Setup
32+
33+
Create file `.vscode/launch.json` with contents:
34+
35+
{
36+
// Use IntelliSense to learn about possible attributes.
37+
// Hover to view descriptions of existing attributes.
38+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
39+
"version": "0.2.0",
40+
"configurations": [
41+
{
42+
"name": "Listen for Xdebug",
43+
"type": "php",
44+
"request": "launch",
45+
"port": 9003,
46+
"pathMappings": {
47+
"/app": "${workspaceRoot}"
48+
}
49+
}
50+
]
51+
}
52+
53+
To make it possible to go directly to a line and file in VSCode by clicking on the filenames that Xdebug shows in stack traces in Symfony Profiler in `./etc/frankenphp/conf.d/20-app.dev.ini` comment out line starting with `xdebug.file_link_format=` and add this bellow it:
54+
55+
xdebug.file_link_format='vscode://file/%f:%l&/app><PATH_TO_APP_ON_HOST>'
56+
57+
Path to app in container `/app` will be mapped to `<PATH_TO_APP_ON_HOST>` outside container.
58+
59+
After making changes to `20-app.dev.ini` run `make restart`.
60+
61+
#### Debug
62+
63+
In VSCode [set breakpoint](https://code.visualstudio.com/docs/editor/debugging#_breakpoints), after that in menu click on `Run > Start Debugging`.
64+
65+
Add the `XDEBUG_SESSION=1` query parameter to the URL of the page you want to debug (e.g. [http://localhost/?XDEBUG_SESSION=1](http://localhost/?XDEBUG_SESSION=1)), or use [other available triggers](https://xdebug.org/docs/step_debug#activate_debugger)
66+
67+
Alternatively, you can use [the **Xdebug extension**](https://xdebug.org/docs/step_debug#browser-extensions) for your preferred web browser.

0 commit comments

Comments
 (0)