Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F10 and F11 should start debugging with stopAtEntry:true #49855

Closed
Spongman opened this issue May 14, 2018 · 21 comments · Fixed by #119980
Closed

F10 and F11 should start debugging with stopAtEntry:true #49855

Spongman opened this issue May 14, 2018 · 21 comments · Fixed by #119980
Assignees
Labels
candidate Issue identified as probable candidate for fixing in the next release debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality release-notes Release notes issues verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@Spongman
Copy link

in visual studio (not vscode) you can start debugging and stop at the first line of code by pressing the step over or step into keys. this is distinct from hitting the start debugging key which doesn't stop at main (or wherever). it's incredibly useful to easily choose whether or not to stop at the first line of code, especially for console apps.

can we get similar functionality added to vscode? it's a pain to have to switch debug configurations, or edit the stopAtEntry setting just to do this.

@isidorn isidorn changed the title cannot start debugging with f10/f11 F10 and F11 should start debugging with stopAtEntry:true May 15, 2018
@isidorn isidorn added feature-request Request for new features or functionality debug Debug viewlet, configurations, breakpoints, adapter issues labels May 15, 2018
@isidorn isidorn added this to the Backlog milestone May 15, 2018
@isidorn isidorn removed their assignment May 15, 2018
@pgklada
Copy link

pgklada commented Sep 3, 2018

I support the request: enable starting a debugging session with F10, that positions the "instruction cursor" at the first instruction of the script

@pgklada
Copy link

pgklada commented Sep 3, 2018

@isidorn, do I get this right? you removed this from the backlog?

@isidorn
Copy link
Contributor

isidorn commented Sep 17, 2018

I like this idea and we plan to add this soon thus I am assigning this to On-Deck
fyi @weinand

@isidorn isidorn modified the milestones: Backlog, On Deck Sep 17, 2018
@weinand
Copy link
Contributor

weinand commented Sep 17, 2018

@isidorn "stopAtEntry" is a private attribute of some debug extensions. It will be difficult to support that generically (if we want to avoid ugly heuristics).
Alternatively we'll have to find a way (based on extension API) so that debug extensions that support "stopAtEntry" can register actions in their extension.

@isidorn
Copy link
Contributor

isidorn commented Sep 17, 2018

@weinand good point, I forgot that "stopAtEntry" is not generic.
Well I think this can already be done, here's how:

  • A debug extension registers a new command and has a keybinding for it when not in debug mode
  • The command simply calls start debugging and patches the stopAtEntry in the resolveConfiguration call

Am I missing something?

@weinand
Copy link
Contributor

weinand commented Sep 17, 2018

Sounds good. A prototype would be a good proof of concept.

@isidorn
Copy link
Contributor

isidorn commented Oct 3, 2018

I have introduce a new context key in vscode
debugConfigurationType which has the vlaue of the selected configuration type.
Only when that type is node the node extension now contributes Start Debugging and Stop on Entry commands which can be run via F10 and F11.

fyi @roblourens

@isidorn isidorn added the verification-needed Verification of issue is requested label Oct 3, 2018
@roblourens
Copy link
Member

I'm a little worried about this global variable in the config provider: microsoft/vscode-node-debug@0f004a2#diff-35cf5c034aecdc798ffe64808bf07609R18

You could have debugging fail to start on vscode's end for some reason so the next call to resolveDebugConfiguration is not actually associated with that workbench.action.debug.start, or a race between multiple session starts, or something else that could cause confusing issues...

Is there any way to get rid of that? Like if we could pass some override config props to executeCommand? Or props that get passed through to resolveDebugConfiguration?

@isidorn
Copy link
Contributor

isidorn commented Oct 4, 2018

@roblourens anything that passes through vscode does not really make sense since vscode is unaware of stopOnEntry attribute.
Though I agree with your concerns, but the worst case is that something will stopOnEntry when it should not in a weird corner case. I personally do not see this as a big issue.

@alexr00 alexr00 added the verification-found Issue verification failed label Oct 30, 2018
@alexr00 alexr00 added verified Verification succeeded and removed verification-found Issue verification failed labels Oct 31, 2018
@isidorn isidorn added the release-notes Release notes issues label Nov 2, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2018
@connor4312
Copy link
Member

It looks like the current Action implementation doesn't support taking arguments, to fix this we should convert off the deprecated registerWorkbenchAction to registerAction2, which takes an Action2. I don't want to do this a couple hours before the end of the iteration, so pushing it to next milestone.

@joaomoreno joaomoreno removed release-notes Release notes issues debt Code quality issues labels Nov 2, 2020
@connor4312 connor4312 modified the milestones: February 2021, March 2021 Feb 23, 2021
@connor4312 connor4312 added the verification-needed Verification of issue is requested label Mar 24, 2021
@alexr00
Copy link
Member

alexr00 commented Mar 24, 2021

These are just not working for me. I have the latest JS Debug nightly extension. F10 doesn't appear to do anything. F11 toggles full screen. My keyboard shortcuts look correct:

image

Is there something I'm missing?

@connor4312
Copy link
Member

@alexr00 Make sure you have a Node.js configuration currently selected in the "run and debug" menu

@connor4312
Copy link
Member

I realized I forgot to bump the builtin version of the old node-debug when I changed the setting, which is why you see a duplicate keybinding there. For me it still works, but that might cause issues c881465

@alexr00
Copy link
Member

alexr00 commented Mar 24, 2021

Ah forgot to include by debug config:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "${workspaceFolder}/server.js"
        }
    ]

That config is selected in the debug viewlet.

@connor4312
Copy link
Member

Hm, okay. This works for me on both OSX and Windows. If this doesn't work in tomorrow's Insiders for you, please let me know and we can debug together when you have time

@weinand weinand added the release-notes Release notes issues label Mar 25, 2021
@connor4312
Copy link
Member

connor4312 commented Mar 26, 2021

Steps:

  1. Create a Node.js launch config, and select it in the debug view
  2. Hit F10
  3. The program should run and pause on the first line of the script

@roblourens roblourens added the verified Verification succeeded label Mar 26, 2021
@connor4312
Copy link
Member

connor4312 commented Mar 26, 2021

Tyler tried to verify and hit the same issue. The selectedConfiguration in the debug service was missing its getConfig method. It looks like selectConfiguration can actually be called with undefined which 'resets' the selected config, even when there's still a selected configuration shown in the dropdown. This easiest way to trigger this is to make a change to your launch.json, then the command will break.

I think my previous fix was not really correct -- newer, better, one coming.

@connor4312 connor4312 reopened this Mar 26, 2021
@connor4312 connor4312 removed the verified Verification succeeded label Mar 26, 2021
@TylerLeonhardt TylerLeonhardt added the candidate Issue identified as probable candidate for fixing in the next release label Mar 26, 2021
@TylerLeonhardt TylerLeonhardt added the verified Verification succeeded label Mar 29, 2021
@TylerLeonhardt
Copy link
Member

Works great!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
candidate Issue identified as probable candidate for fixing in the next release debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality release-notes Release notes issues verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
9 participants