Skip to content

Commit cb1c6ea

Browse files
committed
style: run prettier on markdown
Prevents accidental formatting changes
1 parent 71699a5 commit cb1c6ea

8 files changed

Lines changed: 1298 additions & 1280 deletions

File tree

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ insert_final_newline = true
77
end_of_line = lf
88
charset = utf-8
99

10-
[*.{json,yml}]
10+
[{*.json,*.yml,.prettierrc}]
1111
indent_size = 2
1212

1313
[*.md]

.prettierrc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66
"bracketSpacing": true,
77
"singleQuote": true,
88
"printWidth": 120,
9+
"proseWrap": "preserve",
910
"overrides": [
1011
{
11-
"files": "{*.js?(on),.prettierrc}",
12+
"files": "{*.js?(on),.prettierrc,*.md}",
1213
"options": {
13-
"parser": "json",
1414
"tabWidth": 2
1515
}
16+
},
17+
{
18+
"files": ".prettierrc",
19+
"options": {
20+
"parser": "json"
21+
}
1622
}
1723
]
1824
}

ISSUE_TEMPLATE.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
PHP version:
22
XDebug version:
3-
Adapter version:
3+
Adapter version:
44

55
Your launch.json:
6-
XDebug php.ini config:
6+
XDebug php.ini config:
77

88
XDebug logfile (from setting `xdebug.remote_log` in php.ini):
9-
Adapter logfile (from setting `"log": true` in launch.json):
9+
Adapter logfile (from setting `"log": true` in launch.json):
10+
11+
Code snippet to reproduce:
1012

11-
Code snippet to reproduce:
1213
```php
1314

1415
```

README.md

Lines changed: 75 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,112 @@
1-
PHP Debug Adapter for Visual Studio Code
2-
========================================
1+
# PHP Debug Adapter for Visual Studio Code
32

43
[![vs marketplace](https://img.shields.io/vscode-marketplace/v/felixfbecker.php-debug.svg?label=vs%20marketplace)](https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug) [![downloads](https://img.shields.io/vscode-marketplace/d/felixfbecker.php-debug.svg)](https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug) [![rating](https://img.shields.io/vscode-marketplace/r/felixfbecker.php-debug.svg)](https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug) [![windows build](https://img.shields.io/appveyor/ci/felixfbecker/vscode-php-debug/master.svg?label=windows+build)](https://ci.appveyor.com/project/felixfbecker/vscode-php-debug)
54
[![macos/linux build](https://img.shields.io/travis/felixfbecker/vscode-php-debug/master.svg?label=macos/linux+build)](https://travis-ci.org/felixfbecker/vscode-php-debug) [![codecov](https://codecov.io/gh/felixfbecker/vscode-php-debug/branch/master/graph/badge.svg)](https://codecov.io/gh/felixfbecker/vscode-php-debug) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![chat: on gitter](https://badges.gitter.im/felixfbecker/vscode-php-debug.svg)](https://gitter.im/felixfbecker/vscode-php-debug?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
65

76
![Demo GIF](images/demo.gif)
87

9-
Installation
10-
------------
8+
## Installation
119

1210
Install the extension: Press `F1`, type `ext install php-debug`.
1311

1412
This extension is a debug adapter between VS Code and [XDebug](https://xdebug.org/) by Derick Rethan. XDebug is a PHP extension (a `.so` file on Linux and a `.dll` on Windows) that needs to be installed on your server.
1513

16-
1. [Install XDebug](https://xdebug.org/docs/install)
17-
***I highly recommend you make a simple `test.php` file, put a `phpinfo();` statement in there, then copy the output and paste it into the [XDebug installation wizard](https://xdebug.org/wizard.php). It will analyze it and give you tailored installation instructions for your environment.*** In short:
14+
1. [Install XDebug](https://xdebug.org/docs/install)
15+
**_I highly recommend you make a simple `test.php` file, put a `phpinfo();` statement in there, then copy the output and paste it into the [XDebug installation wizard](https://xdebug.org/wizard.php). It will analyze it and give you tailored installation instructions for your environment._** In short:
1816
- On Windows: [Download](https://xdebug.org/download.php) the appropiate precompiled DLL for your PHP version, architecture (64/32 Bit), thread safety (TS/NTS) and Visual Studio compiler version and place it in your PHP extension folder.
1917
- On Linux: Either download the source code as a tarball or [clone it with git](https://xdebug.org/docs/install#source), then [compile it](https://xdebug.org/docs/install#compile).
20-
2. [Configure PHP to use XDebug](https://xdebug.org/docs/install#configure-php) by adding `zend_extension=path/to/xdebug` to your php.ini. The path of your php.ini is shown in your `phpinfo()` output under "Loaded Configuration File".
21-
3. Enable remote debugging in your php.ini:
18+
2. [Configure PHP to use XDebug](https://xdebug.org/docs/install#configure-php) by adding `zend_extension=path/to/xdebug` to your php.ini. The path of your php.ini is shown in your `phpinfo()` output under "Loaded Configuration File".
19+
3. Enable remote debugging in your php.ini:
2220

23-
```ini
24-
[XDebug]
25-
xdebug.remote_enable = 1
26-
xdebug.remote_autostart = 1
27-
```
28-
There are other ways to tell XDebug to connect to a remote debugger than `remote_autostart`, like cookies, query parameters or browser extensions. I recommend `remote_autostart` because it "just works". There are also a variety of other options, like the port (by default 9000), please see the [XDebug documentation on remote debugging](https://xdebug.org/docs/remote#starting) for more information.
21+
```ini
22+
[XDebug]
23+
xdebug.remote_enable = 1
24+
xdebug.remote_autostart = 1
25+
```
26+
27+
There are other ways to tell XDebug to connect to a remote debugger than `remote_autostart`, like cookies, query parameters or browser extensions. I recommend `remote_autostart` because it "just works". There are also a variety of other options, like the port (by default 9000), please see the [XDebug documentation on remote debugging](https://xdebug.org/docs/remote#starting) for more information.
2928

30-
4. If you are doing web development, don't forget to restart your webserver to reload the settings
31-
5. Verify your installation by checking your `phpinfo()` output for an XDebug section.
29+
4. If you are doing web development, don't forget to restart your webserver to reload the settings
30+
5. Verify your installation by checking your `phpinfo()` output for an XDebug section.
3231

3332
### VS Code Configuration
33+
3434
In your project, go to the debugger and hit the little gear icon and choose _PHP_. A new launch configuration will be created for you with two configurations:
35-
- **Listen for XDebug**
36-
This setting will simply start listening on the specified port (by default 9000) for XDebug. If you configured XDebug like recommended above, everytime you make a request with a browser to your webserver or launch a CLI script XDebug will connect and you can stop on breakpoints, exceptions etc.
37-
- **Launch currently open script**
38-
This setting is an example of CLI debugging. It will launch the currently opened script as a CLI, show all stdout/stderr output in the debug console and end the debug session once the script exits.
35+
36+
- **Listen for XDebug**
37+
This setting will simply start listening on the specified port (by default 9000) for XDebug. If you configured XDebug like recommended above, everytime you make a request with a browser to your webserver or launch a CLI script XDebug will connect and you can stop on breakpoints, exceptions etc.
38+
- **Launch currently open script**
39+
This setting is an example of CLI debugging. It will launch the currently opened script as a CLI, show all stdout/stderr output in the debug console and end the debug session once the script exits.
3940

4041
#### Supported launch.json settings:
41-
- `request`: Always `"launch"`
42-
- `port`: The port on which to listen for XDebug (default: `9000`)
43-
- `stopOnEntry`: Wether to break at the beginning of the script (default: `false`)
44-
- `pathMappings`: A list of server paths mapping to the local source paths on your machine, see "Remote Host Debugging" below
45-
- `log`: Wether to log all communication between VS Code and the adapter to the debug console. See _Troubleshooting_ further down.
46-
- `ignore`: An optional array of glob patterns that errors should be ignored from (for example `**/vendor/**/*.php`)
47-
- `xdebugSettings`: Allows you to override XDebug's remote debugging settings to fine tuning XDebug to your needs. For example, you can play with `max_children` and `max_depth` to change the max number of array and object children that are retrieved and the max depth in structures like arrays and objects. This can speed up the debugger on slow machines.
48-
For a full list of feature names that can be set please refer to the [XDebug documentation](https://xdebug.org/docs-dbgp.php#feature-names).
49-
- `max_children`: max number of array or object children to initially retrieve
50-
- `max_data`: max amount of variable data to initially retrieve.
51-
- `max_depth`: maximum depth that the debugger engine may return when sending arrays, hashs or object structures to the IDE.
52-
- `show_hidden`: This feature can get set by the IDE if it wants to have more detailed internal information on properties (eg. private members of classes, etc.) Zero means that hidden members are not shown to the IDE.
42+
43+
- `request`: Always `"launch"`
44+
- `port`: The port on which to listen for XDebug (default: `9000`)
45+
- `stopOnEntry`: Wether to break at the beginning of the script (default: `false`)
46+
- `pathMappings`: A list of server paths mapping to the local source paths on your machine, see "Remote Host Debugging" below
47+
- `log`: Wether to log all communication between VS Code and the adapter to the debug console. See _Troubleshooting_ further down.
48+
- `ignore`: An optional array of glob patterns that errors should be ignored from (for example `**/vendor/**/*.php`)
49+
- `xdebugSettings`: Allows you to override XDebug's remote debugging settings to fine tuning XDebug to your needs. For example, you can play with `max_children` and `max_depth` to change the max number of array and object children that are retrieved and the max depth in structures like arrays and objects. This can speed up the debugger on slow machines.
50+
For a full list of feature names that can be set please refer to the [XDebug documentation](https://xdebug.org/docs-dbgp.php#feature-names).
51+
- `max_children`: max number of array or object children to initially retrieve
52+
- `max_data`: max amount of variable data to initially retrieve.
53+
- `max_depth`: maximum depth that the debugger engine may return when sending arrays, hashs or object structures to the IDE.
54+
- `show_hidden`: This feature can get set by the IDE if it wants to have more detailed internal information on properties (eg. private members of classes, etc.) Zero means that hidden members are not shown to the IDE.
5355

5456
Options specific to CLI debugging:
55-
- `program`: Path to the script that should be launched
56-
- `args`: Arguments passed to the script
57-
- `cwd`: The current working directory to use when launching the script
58-
- `runtimeExecutable`: Path to the PHP binary used for launching the script. By default the one on the PATH.
59-
- `runtimeArgs`: Additional arguments to pass to the PHP binary
60-
- `externalConsole`: Launches the script in an external console window instead of the debug console (default: `false`)
61-
- `env`: Environment variables to pass to the script
62-
63-
Features
64-
--------
65-
- Line breakpoints
66-
- Conditional breakpoints
67-
- Function breakpoints
68-
- Step over, step in, step out
69-
- Break on entry
70-
- Breaking on uncaught exceptions and errors / warnings / notices
71-
- Multiple, parallel requests
72-
- Stack traces, scope variables, superglobals, user defined constants
73-
- Arrays & objects (including classname, private and static properties)
74-
- Debug console
75-
- Watches
76-
- Run as CLI
77-
- Run without debugging
78-
79-
Remote Host Debugging
80-
---------------------
57+
58+
- `program`: Path to the script that should be launched
59+
- `args`: Arguments passed to the script
60+
- `cwd`: The current working directory to use when launching the script
61+
- `runtimeExecutable`: Path to the PHP binary used for launching the script. By default the one on the PATH.
62+
- `runtimeArgs`: Additional arguments to pass to the PHP binary
63+
- `externalConsole`: Launches the script in an external console window instead of the debug console (default: `false`)
64+
- `env`: Environment variables to pass to the script
65+
66+
## Features
67+
68+
- Line breakpoints
69+
- Conditional breakpoints
70+
- Function breakpoints
71+
- Step over, step in, step out
72+
- Break on entry
73+
- Breaking on uncaught exceptions and errors / warnings / notices
74+
- Multiple, parallel requests
75+
- Stack traces, scope variables, superglobals, user defined constants
76+
- Arrays & objects (including classname, private and static properties)
77+
- Debug console
78+
- Watches
79+
- Run as CLI
80+
- Run without debugging
81+
82+
## Remote Host Debugging
83+
8184
To debug a running application on a remote host, you need to tell XDebug to connect to a different IP than `localhost`. This can either be done by setting [`xdebug.remote_host`](https://xdebug.org/docs/remote#remote_host) to your IP or by setting [`xdebug.remote_connect_back = 1`](https://xdebug.org/docs/remote#remote_connect_back) to make XDebug always connect back to the machine who did the web request. The latter is the only setting that supports multiple users debugging the same server and "just works" for web projects. Again, please see the [XDebug documentation](https://xdebug.org/docs/remote#communcation) on the subject for more information.
8285

8386
To make VS Code map the files on the server to the right files on your local machine, you have to set the `pathMappings` settings in your launch.json. Example:
87+
8488
```json
8589
// server -> local
8690
"pathMappings": {
8791
"/var/www/html": "${workspaceRoot}/www",
8892
"/app": "${workspaceRoot}/app"
8993
}
9094
```
95+
9196
Please also note that setting any of the CLI debugging options will not work with remote host debugging, because the script is always launched locally. If you want to debug a CLI script on a remote host, you need to launch it manually from the command line.
9297

93-
Troubleshooting
94-
---------------
95-
- Ask a question on [Gitter](https://gitter.im/felixfbecker/vscode-php-debug)
96-
- If you think you found a bug, [open an issue](https://github.com/felixfbecker/vscode-php-debug/issues)
97-
- Make sure you have the latest version of this extension and XDebug installed
98-
- Try out a simple PHP file to recreate the issue, for example from the [testproject](https://github.com/felixfbecker/vscode-php-debug/tree/master/testproject)
99-
- In your php.ini, set [`xdebug.remote_log = /path/to/logfile`](https://xdebug.org/docs/remote#remote_log)
100-
(make sure your webserver has write permissions to the file)
101-
- Set `"log": true` in your launch.json
102-
103-
Contributing
104-
------------
98+
## Troubleshooting
99+
100+
- Ask a question on [Gitter](https://gitter.im/felixfbecker/vscode-php-debug)
101+
- If you think you found a bug, [open an issue](https://github.com/felixfbecker/vscode-php-debug/issues)
102+
- Make sure you have the latest version of this extension and XDebug installed
103+
- Try out a simple PHP file to recreate the issue, for example from the [testproject](https://github.com/felixfbecker/vscode-php-debug/tree/master/testproject)
104+
- In your php.ini, set [`xdebug.remote_log = /path/to/logfile`](https://xdebug.org/docs/remote#remote_log)
105+
(make sure your webserver has write permissions to the file)
106+
- Set `"log": true` in your launch.json
107+
108+
## Contributing
109+
105110
To hack on this adapter, clone the repository and open it in VS Code. You need NodeJS and typings installed (`npm install -g typings`). Install dependencies by running `npm install` and `typings install`.
106111

107112
You can debug the extension (run it in "server mode") by selecting the "Debug adapter" launch configuration and hitting `F5`. Then, open a terminal inside the project, and open the included testproject with VS Code while specifying the current directory as `extensionDevelopmentPath`:

0 commit comments

Comments
 (0)