From 4de38ca8032c1bce8311a7a4b4febe1507aee347 Mon Sep 17 00:00:00 2001 From: Damjan Cvetko Date: Wed, 16 Feb 2022 05:32:35 +0100 Subject: [PATCH] feat: add key binding to start debugging and stop on entry. (#724) * Add key binding to start debugging and stop on entry. * Docs update. --- CHANGELOG.md | 4 ++++ README.md | 6 ++++-- package.json | 20 +++++++++++++++++++- src/extension.ts | 10 ++++++++++ 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c1e67bb..21a27909 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/README.md b/README.md index 72683c9a..4a41afe4 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/package.json b/package.json index 52bee478..539585aa 100644 --- a/package.json +++ b/package.json @@ -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": { @@ -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'" } ] } diff --git a/src/extension.ts b/src/extension.ts index 5d04d18b..8dbd4585 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -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, + }, + }) + }) + ) }