Skip to content

Commit c7280b6

Browse files
martin-schulze-viresofelixfbecker
authored andcommitted
feat: add hostname option to set the interface to bind to (#330)
1 parent 59cd7fb commit c7280b6

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

.travis.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ language: php
22

33
php:
44
- '5.6'
5-
- '7.0'
5+
- '7.1'
66
env:
77
global:
88
- NODE_VERSION=8.9.3
@@ -45,11 +45,17 @@ jobs:
4545
before_install:
4646
# Fix ruby error https://github.com/Homebrew/brew/issues/3299
4747
- brew update
48-
- brew install php@7.0
49-
- brew link --force --overwrite php@7.0
48+
- brew install php@7.1
49+
- brew link --force --overwrite php@7.1
50+
- mkdir -p /usr/local/etc/php/7.1/conf.d
51+
- cp travis-php.ini /usr/local/etc/php/7.1/conf.d/
52+
# see per https://javorszky.co.uk/2018/05/03/getting-xdebug-working-on-php-7-2-and-homebrew/
53+
# avoid problems with brew's symlink and pecl's recursive mkdir
54+
- rm /usr/local/Cellar/php@7.1/7.1.26/pecl
5055
- pecl install xdebug-$XDEBUG_VERSION
51-
- mkdir -p /usr/local/etc/php/7.0/conf.d
52-
- cp travis-php.ini /usr/local/etc/php/7.0/conf.d/
56+
# make xdebug.so available at pecl's expected location
57+
- ln -s /usr/local/Cellar/php@7.1/7.1.26/pecl/ /usr/local/lib/php/pecl
58+
- php -i
5359
- source ~/.nvm/nvm.sh
5460
- nvm install $NODE_VERSION
5561
- nvm use $NODE_VERSION

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ In your project, go to the debugger and hit the little gear icon and choose _PHP
4545
#### Supported launch.json settings:
4646

4747
- `request`: Always `"launch"`
48+
- `hostname`: The address to bind to when listening for XDebug (default: all IPv6 connections if available, else all IPv4 connections)
4849
- `port`: The port on which to listen for XDebug (default: `9000`)
4950
- `stopOnEntry`: Wether to break at the beginning of the script (default: `false`)
5051
- `pathMappings`: A list of server paths mapping to the local source paths on your machine, see "Remote Host Debugging" below

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,11 @@
175175
"description": "Environment variables passed to the program.",
176176
"default": {}
177177
},
178+
"hostname": {
179+
"type": "string",
180+
"description": "Address to bind to when listening for XDebug",
181+
"default": "::"
182+
},
178183
"port": {
179184
"type": "number",
180185
"description": "Port on which to listen for XDebug",

src/phpDebug.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ function formatPropertyValue(property: xdebug.BaseProperty): string {
5050
* This interface should always match the schema found in the mock-debug extension manifest.
5151
*/
5252
interface LaunchRequestArguments extends VSCodeDebugProtocol.LaunchRequestArguments {
53+
/** The address to bind to for listening for XDebug connections (default: all IPv6 connections if available, else all IPv4 connections) */
54+
hostname?: string
5355
/** The port where the adapter should listen for XDebug connections (default: 9000) */
5456
port?: number
5557
/** Automatically stop target after launch. If not specified, target does not stop. */
@@ -310,7 +312,11 @@ class PhpDebugSession extends vscode.DebugSession {
310312
this.sendEvent(new vscode.OutputEvent(util.inspect(error) + '\n'))
311313
this.sendErrorResponse(response, <Error>error)
312314
})
313-
server.listen(args.port || 9000, (error: NodeJS.ErrnoException) => (error ? reject(error) : resolve()))
315+
server.listen(
316+
args.port || 9000,
317+
args.hostname,
318+
(error: NodeJS.ErrnoException) => (error ? reject(error) : resolve())
319+
)
314320
})
315321
try {
316322
if (!args.noDebug) {

0 commit comments

Comments
 (0)