You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ xdebug ] Add --experimental-unsafe-ide-integration option in Playground CLI (#2777)
## Motivation for the change, related issues
Based on issue
#2763
The current pain we have when we run a Playground CLI command with
Xdebug enabled is the absence of the files located in the VFS in our
IDE.
This pull request gives visibility to the VFS files with the help of a
`.playground-xdebug-root` symlink and the generation of path mappings
inside the developer's IDE.
Only the mounts from inside the current working directory are mapped.
## Implementation details
1. Symlinking > `.playground-xdebug-root`
- It first removes a possibly existing symlink with name
`.playground-xdebug-root` in the current working directory.
- If `--xdebug` and `--experimental-unsafe-ide-integration` options are
present, we symlink the temporary playground cli directory inside the
current working directory.
2. Path mapping in IDEs
- It first clears all the configs named `WP Playground CLI - Listen for
Xdebug` in VSCode and PHPStorm config files.
- If `--xdebug` and `--experimental-unsafe-ide-integration` options are
present, we add IDE configs and path mappings in the related configs.
- PHPStorm : it adds a new `server` with name `WP Playground CLI -
Listen for Xdebug` in `.idea/workspace.xml`.
- VSCode : it adds a new `configuration` with name `WP Playground CLI -
Listen for Xdebug` in `.vscode/launch.json`.
Next steps are reported in the [Xdebug Follow-up
issue](#2315).
## Testing Instructions (or ideally a Blueprint)
Run as follows:
```sh
node --no-warnings=ExperimentalWarning --experimental-strip-types --experimental-transform-types --import ./pac
kages/meta/src/node-es-module-loader/register.mts ./packages/playground/cli/src/cli.ts server --xdebug --experimental-unsafe-ide-integration
```
---------
Co-authored-by: Brandon Payton <[email protected]>
Co-authored-by: Adam Zieliński <[email protected]>
0 commit comments