Skip to content

Commit

Permalink
feat: add key binding to start debugging and stop on entry. (#724)
Browse files Browse the repository at this point in the history
* Add key binding to start debugging and stop on entry.

* Docs update.
  • Loading branch information
zobo authored Feb 16, 2022
1 parent aa3a05c commit 4de38ca
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.24.0]

- F10/F11 start debugging with stop on entry.

## [1.23.0]

- When `env` is specified in launch configuration it will be merged the process environment.
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Options specific to CLI debugging:
- Function breakpoints
- Step over, step in, step out
- Break on entry
- Start with Stop on entry (F10/F11)
- Breaking on uncaught exceptions and errors / warnings / notices
- Multiple, parallel requests
- Stack traces, scope variables, superglobals, user defined constants
Expand Down Expand Up @@ -150,9 +151,10 @@ A _Xdebug helper_ browser extension is also recommended. There the request side
- If you think you found a bug, [open an issue](https://github.com/xdebug/vscode-php-debug/issues)
- Make sure you have the latest version of this extension and Xdebug installed
- Try out a simple PHP file to recreate the issue, for example from the [testproject](https://github.com/xdebug/vscode-php-debug/tree/main/testproject)
- In your php.ini, set [`xdebug.remote_log = /path/to/logfile`](https://xdebug.org/docs/remote#remote_log)
- Set `"log": true` in your launch.json and observe Debug Console panel
- In your php.ini, set [`xdebug.log = /path/to/logfile`](https://xdebug.org/docs/step_debug#troubleshoot)
(make sure your webserver has write permissions to the file)
- Set `"log": true` in your launch.json
- Reach out on Twitter [@damjancvetko](https://twitter.com/damjancvetko)

## Contributing

Expand Down
20 changes: 19 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@
"main": "./out/extension.js",
"activationEvents": [
"onDebugResolve:php",
"onCommand:php.debug.debugPhpFile"
"onCommand:php.debug.debugPhpFile",
"onCommand:php.debug.startWithStopOnEntry"
],
"capabilities": {
"untrustedWorkspaces": {
Expand Down Expand Up @@ -489,6 +490,23 @@
"title": "Debug PHP",
"icon": "$(debug-alt-small)",
"enablement": "resourceLangId == php"
},
{
"command": "php.debug.startWithStopOnEntry",
"title": "Start Debugging and Stop on Entry",
"category": "Debug"
}
],
"keybindings":[
{
"command": "php.debug.startWithStopOnEntry",
"key": "F10",
"when": "!inDebugMode && debugConfigurationType == 'php'"
},
{
"command": "php.debug.startWithStopOnEntry",
"key": "F11",
"when": "!inDebugMode && debugConfigurationType == 'php'"
}
]
}
Expand Down
10 changes: 10 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,14 @@ export function activate(context: vscode.ExtensionContext) {
vscode.debug.startDebugging(undefined, { type: '', name: '', request: '' })
})
)

context.subscriptions.push(
vscode.commands.registerCommand('php.debug.startWithStopOnEntry', async (uri: vscode.Uri) => {
vscode.commands.executeCommand('workbench.action.debug.start', {
config: {
stopOnEntry: true,
},
})
})
)
}

0 comments on commit 4de38ca

Please sign in to comment.