Skip to content

Commit 2f2916e

Browse files
committed
Prepare for release
1 parent 8936bbf commit 2f2916e

File tree

5 files changed

+152
-78
lines changed

5 files changed

+152
-78
lines changed

.vscodeignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
.gitignore
33
src/**/*
44
out/tests/**/*
5-
node_modules/**/*
65
**/*.js.map

README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
PHP Debug adapter for Visual Studio Code
2+
========================================
3+
4+
![Demo GIF](images/demo.gif)
5+
6+
How to install
7+
--------------
8+
9+
### Install extension:
10+
Press <kbd>F1</kbd>, type `ext install php-debug`.
11+
12+
### Install XDebug:
13+
[Download and install the XDebug extension](http://xdebug.org/download.php).
14+
Then, in addition to `zend_extension=path/to/xdebug`, add these lines to your php.ini to enable remote debugging:
15+
16+
```ini
17+
[XDebug]
18+
xdebug.remote_enable = 1
19+
xdebug.remote_autostart = 1
20+
```
21+
Also, if you haven't already, point your webserver's webroot to your project.
22+
23+
Don't forget to restart your webserver after you made these changes.
24+
Now, everytime you do a request to a PHP file, XDebug will automatically try to connect to port 9000 for debugging.
25+
26+
### Start debugging:
27+
In your project, go to the debugger and hit the little gear icon. Choose PHP. A new launch configuration will be created for you.
28+
Now, if you select this configuration and hit <kbd>F5</kbd>, VS Code will listen on port 9000 for incoming XDebug requests.
29+
Now, when you make a request to `localhost` with your webbrowser, XDebug will connect to VS Code and you can debug your PHP.
30+
31+
What is supported?
32+
------------------
33+
- Line breakpoints
34+
- Step over, step in, step out
35+
- Break on entry
36+
- Breaking on uncaught exceptions and errors / warnings / notices
37+
- Multiple, parallel requests (still a bit buggy but I think these are bugs in VS Code)
38+
- Stack traces, scope variables, superglobals, user defined constants
39+
- Arrays & objects (including classname, private and static properties)
40+
- Debug console
41+
- Watches
42+
43+
What is not supported?
44+
----------------------
45+
- Conditional breakpoints (not yet implemented)
46+
- Breaking on _caught_ exceptions, this is not supported by XDebug and the setting is ignored
47+
- Attach requests, there is no such thing because the lifespan of PHP scripts is short
48+
49+
FAQ
50+
---
51+
52+
#### How can I get the error message when breaking on an error/warning?
53+
Set a watch for `error_get_last()`
54+
55+
#### Where are the variables of the parent scope?
56+
In opposite to Javascript, PHP does not have closures.
57+
A scope contains only variables that have been declared, parameters and imported globals with `global` or `use`.
58+
If you want to see the variables of the scope of the callee, click on it in the stacktrace.
59+
60+
Contributing
61+
------------
62+
To hack on this adapter, clone the repository and open it in VS Code.
63+
You can debug it (run it in "server mode") by selecting the "Debug adapter" launch configuration and hitting <kbd>F5</kbd>.
64+
Then, open a terminal inside the project, and open the included testproject with VS Code while specifying the current directory as `extensionDevelopmentPath`.
65+
As an example, for Powershell on Windows it could look like this:
66+
67+
```powershell
68+
PS C:\Users\felix\github\vscode-php-debug> code .\testproject\ --extensionDevelopmentPath=$pwd
69+
```
70+
71+
VS Code will open an "Extension Development Host" with the debug adapter running.
72+
Now, you can debug the testproject like specified above and set breakpoints inside your first VS Code instance to step through the adapter code.

images/demo.gif

1020 KB
Loading

images/logo.svg

Lines changed: 1 addition & 0 deletions
Loading

package.json

Lines changed: 79 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,82 @@
11
{
2-
"name": "php-debug",
3-
"displayName": "PHP Debug",
4-
"version": "1.0.0",
5-
"publisher": "felixfbecker",
6-
"description": "Debug support for PHP with XDebug",
7-
"author": {
8-
"name": "Felix Becker",
9-
"email": "[email protected]"
10-
},
11-
"engines": {
12-
"vscode": "^0.10.1"
13-
},
14-
"icon": "images/mock-debug-icon.svg",
15-
"categories": [
16-
"Debuggers"
17-
],
18-
"private": true,
19-
"repository": {
20-
"type": "git",
21-
"url": "https://github.com/felixfbecker/vscode-php-debug.git"
22-
},
23-
"bugs": {
24-
"url": "https://github.com/felixfbecker/vscode-php-debug/issues"
25-
},
26-
"dependencies": {
27-
"iconv-lite": "^0.4.13",
28-
"moment": "^2.10.6",
29-
"vscode-debugadapter": "^1.0.3",
30-
"vscode-debugprotocol": "^1.0.1",
31-
"xmldom": "^0.1.19"
32-
},
33-
"devDependencies": {
34-
"typescript": "^1.6.2",
35-
"mocha": "*"
36-
},
37-
"scripts": {
38-
"compile": "tsc -p ./src",
39-
"watch": "tsc -w -p ./src",
40-
"test": "mocha out/tests"
41-
},
42-
"contributes": {
43-
"debuggers": [
44-
{
45-
"type": "php",
46-
"label": "PHP XDebug",
47-
"enableBreakpointsFor": {
48-
"languageIds": ["php"]
49-
},
50-
"program": "./out/phpDebug.js",
51-
"runtime": "node",
52-
"configurationAttributes": {
53-
"launch": {
54-
"required": [],
55-
"properties": {
56-
"stopOnEntry": {
57-
"type": "boolean",
58-
"description": "Automatically stop after launch.",
59-
"default": true
60-
},
61-
"port": {
62-
"type": "number",
63-
"description": "Port on which to listen for XDebug",
64-
"default": 9000
65-
}
2+
"name": "php-debug",
3+
"displayName": "PHP",
4+
"version": "1.0.0",
5+
"publisher": "felixfbecker",
6+
"description": "Debug support for PHP with XDebug",
7+
"keywords": ["php", "debug", "xdebug"],
8+
"author": {
9+
"name": "Felix Becker",
10+
"email": "[email protected]"
11+
},
12+
"engines": {
13+
"vscode": "^0.10.6"
14+
},
15+
"icon": "images/logo.svg",
16+
"galleryBanner": {
17+
"color": "#6682BA",
18+
"theme": "dark"
19+
},
20+
"categories": ["Debuggers"],
21+
"repository": {
22+
"type": "git",
23+
"url": "https://github.com/felixfbecker/vscode-php-debug.git"
24+
},
25+
"bugs": {
26+
"url": "https://github.com/felixfbecker/vscode-php-debug/issues"
27+
},
28+
"dependencies": {
29+
"iconv-lite": "^0.4.13",
30+
"moment": "^2.10.6",
31+
"vscode-debugadapter": "^1.0.3",
32+
"vscode-debugprotocol": "^1.0.1",
33+
"xmldom": "^0.1.19"
34+
},
35+
"devDependencies": {
36+
"typescript": "^1.6.2",
37+
"mocha": "*"
38+
},
39+
"scripts": {
40+
"compile": "tsc -p ./src",
41+
"watch": "tsc -w -p ./src",
42+
"test": "mocha out/tests"
43+
},
44+
"contributes": {
45+
"debuggers": [
46+
{
47+
"type": "php",
48+
"label": "PHP",
49+
"enableBreakpointsFor": {
50+
"languageIds": ["php"]
51+
},
52+
"program": "./out/phpDebug.js",
53+
"runtime": "node",
54+
"configurationAttributes": {
55+
"launch": {
56+
"required": [],
57+
"properties": {
58+
"stopOnEntry": {
59+
"type": "boolean",
60+
"description": "Automatically stop after launch.",
61+
"default": true
62+
},
63+
"port": {
64+
"type": "number",
65+
"description": "Port on which to listen for XDebug",
66+
"default": 9000
67+
}
68+
}
69+
}
70+
},
71+
"initialConfigurations": [
72+
{
73+
"name": "Listen for XDebug",
74+
"type": "php",
75+
"request": "launch",
76+
"port": 9000
77+
}
78+
]
6679
}
67-
}
68-
},
69-
"initialConfigurations": [
70-
{
71-
"name": "Listen for XDebug",
72-
"type": "php",
73-
"request": "launch",
74-
"port": 9000
75-
}
7680
]
77-
}
78-
]
79-
}
80-
}
81+
}
82+
}

0 commit comments

Comments
 (0)