VSCode PHP Debug Release September 2021
Tags: vscode, xdebug, php
Published: 2021-10-15 21:29:46

This is a small writeup on the September 2021 release of VSCode PHP Debug adapter extension. A cover issue describing all work can be found on [GitHub issues](https://github.com/xdebug/vscode-php-debug/issues/648).
I intended to do a "release" every month, but I just do incremental releases and write up a monthly (or so) report... It was summer :)

<!-- more -->

 ## No-folder debugging

A large task was the No-folder debugging. This is when VS Code has the purple status bar, no folder is open at that time, and so no launch.json file is available. I was actually [brought to my attention](https://github.com/xdebug/vscode-php-debug/issues/638) by Microsoft's VS Code PM. We had a conf call and discussed what can be done to make PHP debugging in VS Code simpler. Especially the initial setup.

The changes that came out of this are the no-folder debugging and VS Code settings for the location of the PHP binary. And the quick run/debug icon in the editor. The extension had to transition from a pure DAP implementation into a hybrid one. Now there is also native extension code being activated when debugging starts.

![No-folder debugging](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9rjgg68v5idojfmukgfl.png)

There are plans to further improve PHP and Xdebug setup for new users.

## xdebug_notify()

This is a new feature of Xdebug that I helped to define. It is very similar to `console.log()`. If a DBGp connection is active it will send whatever is the parameter to the IDE in the form of a property.
The ide was to provide similar facilities to Windows Debug channels. My initial idea was to use the `stream` concept of Xdebug, but we later decided to go with notify.

![xdebug_notify](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zhozbs1dkhhh3c2trprw.png)

## Logpoints

A long standing Pull Request was cleaned up and merged. Logpoints are like breakpoints but they do not stop execution, just print text to the console.

![Logpoints](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/92ldqxggkv8nccbm2ytf.png)

## Hit-Count conditional breakpoints

Another old Pull Request was cleaned up and merged. Hit-count conditional breakpoints allow the user to set when the breakpoint will actually stop, depending on the number of hits a breakpoint receives. This functionality is provided by Xdebug. Only conditions `>=`, `==` and `%` are available.

![Hi-count conditional breakpoints](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3rjggrrwtn43pqtdicvr.png)

## Facets

With PHP 8 came readonly properties and enums. Xdebug provides this information in the `facets` attribute of the property structure. This is now processed, but does not have a real impact on the UI... yet. Both readonly and enum cannot be edited. Processing this flags allows us to prevent that on the UI.

## Max connections

Another late feature that came in - altho already in october - is the `maxConnections` launch parameter. It restricts how many connections at a time can be active. When max connections are reached any new connection will be dropped and PHP will continue execution without debugging.

![Max connections](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r4s3h7bs7nphoi5exw9b.png)

## Conclusion

I'm always happy about feedback and would always like to know how to make debugging experience better. I'm currently focusing on DBGp Proxy and [Xdebug Cloud](https://xdebug.cloud/) support.