Visual Studio Code (VS Code) extension that makes it easy to debug code on a remote host by using a generic way.
In many scenarios you are not able to install debuggers like XDebug.
Another (additional) reason could be, that you and your constributors work on the same server for different reasons.
This is why you need a simple way to debug your code in VS Code on many systems with an optional list of constributors and the possibility to send data over a TCP socket to you.
How does it work?
The extension listens on a TCP port and waits for binary packages (debug messages) which contain UTF-8 formatted JSON data with all debug information that should be displayed in your editor.
The system / server you would like to debug has to send these information to your debugger instance when it is executed.
The extension stores these information and makes it possible to switch between all received debug messages.
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter:
Open the root directory of the project you would like to debug and select the environment
Customize the initial configuration (if needed):
And start debugging:
The following environments and frameworks are supported:
No library found?
The implementation of such a debugger message is quite simple.
The first 4 bytes store the length of the JSON data. It represents an unsinged 32-bit value in little endian order. In Node.js it looks like this:
The rest contains the JSON data with the debug information:
Look at the following interfaces in the contracts.ts to get an idea how a message is structured:
Additional you should look at the RemoteDebugger class to see how a server machine sends data to Visual Studio Code.
If the debugger instance is running, you can use the "Debugger console" (CTRL + SHIFT + Y) of VS Code which provides a lot of handy and useful commands: