fabiospampinato / vscode-statusbar-debugger

Adds a debugger to the statusbar, less intrusive than the default floating one.
MIT License
21 stars 6 forks source link

Support compound debugging #4

Open nvmkpk opened 7 years ago

nvmkpk commented 7 years ago

Here is my launch.json file:

{
    // Use IntelliSense to learn about possible Node.js debug 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": "Server",
            "program": "${workspaceRoot}/startup.js"
        },
        {
            "type": "chrome",
            "request": "launch",
            "name": "Client",
            "url": "http://localhost:8080",
            "webRoot": "${workspaceRoot}"
        }
    ],
    "compounds": [
        {
            "name": "Application",
            "configurations": ["Server", "Client"]
        }
    ]
}

The default debugger toolbar shows a dropdown to switch the context between 'Server' and 'Client'. This is missing in the status bar when this extension is installed.

fabiospampinato commented 7 years ago

I'm not sure I understood it correctly, do you basically want a dropdown for switching context in the statusbar?

fabiospampinato commented 7 years ago

@nvmkpk is this the dropdown you're talking about?

screen shot 2017-08-26 at 16 58 23
fabiospampinato commented 7 years ago

Got it, I think you're actually talking about this:

screen shot 2017-08-26 at 16 59 51

Unfortunately there's no way to currently implement this since VSC doesn't expose this kind of information via the API, I opened an issue about it, maybe if you drop a ":+1:" there they'll put more effort into fixing it (https://github.com/Microsoft/vscode/issues/30810).

Spown commented 6 years ago

Can you please look into this again?

Previously VSC didn't do anything when selecting a running debugger in the Call Stack. But now it does in fact switch the focus:

Maybe they did expose it already?

Also it would be cool if the said select was embedded into the extension logo button. Right now clicking on it stops the current debugger. What good 2 stop buttons are?

Thank you.

Spown commented 6 years ago

Also, semiunrelated minirequest:

Can you make the button assume the longest debugger name (i.e. make it's width static as long as no new debuggers are added or present ones stopped), so that the following control buttons wouldn't jump left and right?

fabiospampinato commented 6 years ago

@Spown unfortunately they still haven't exposed information about compound debugging. Also there's no API for adding a "select" element in the statusbar. The way I imagine it would work is that a quickpick would get opened that would allow you to switch debugger.

The first button is a "toggle" button, so it will start or stop debugging, depending on the situation. The other stop button is there for consistency, you can hide it with the "statusbarDebugger.actions" setting if you want.

Can you open a separate issue about the button's width?

Spown commented 6 years ago

The first button is a "toggle" button, so it will start or stop debugging, depending on the situation.

"is" or "will"? Right now in a compound debugging it stops the selected one and when pressed again on the remaining one it calls the pallette to choose a debugger to run (just like in case when no debuggers are running).

fabiospampinato commented 6 years ago

"is" or "will"?

I'm not sure I understood this. If there's a session running and you click the button it will stop the session, if there's no session running and you click the button it will start a new session (possibly asking you which configuration to use, if there are more than 1). You can customize this via the statusbarDebugger.command setting.

Spown commented 6 years ago

"is" or "will"? I'm not sure I understood this.

I didn't know what are you were referring to. How it is (you think) it works right now or how it will be when (if) the requested feature will be implemented.

If there's a session running and you click the button it will stop the session, if there's no session running and you click the button it will start a new session (possibly asking you which configuration to use, if there are more than 1)

Ok, so no it's clear. This is not what's happening. If I have a compound session of 2 debuggers running:

fabiospampinato commented 6 years ago

Does clicking the "stop" icon in the default floating debugger toolbar actually stop both debuggers?

Spown commented 6 years ago

yes, these controls work perfectly fine.

fabiospampinato commented 6 years ago

Then I would consider this a bug. I'll see what I can do about it.

fabiospampinato commented 6 years ago

@Spown I should have fixed the problem you reported in v1.4.1. I can't fix the rest since they still haven't exposed more state about compound debugging.

Spown commented 6 years ago

Thank you. But I still can't see how it is useful right now... It's effectively yet another stop button. Wouldn't it make more sense to make it call the top palette with the debuggers to choose regardless of the state - make it more akin to the standard debugger dropdown select & run widget?

fabiospampinato commented 6 years ago

If you're talking about the default statusbar item for launching a debug configuration, I've stated here why I don't like the way it works.

I think this extension currently works the way it's supposed to, but it doesn't support compound configurations, this will be fixed as soon as they expose the necessary state, you may want to drop a comment here.

You can hide the actual stop button via the settings if you like.

Spown commented 5 years ago

Also a suggestion in case the API was implemented during our lifetimes: In addition to select/dropdown of the running debugger sessions let the bug icon cycle-switch through them.

This would be particularly useful in case of just 2 running debuggers, which is a very common setup. This would probably require splitting statusbarDebugger.command in two - one is for when nothing is running and one when at least one is already runng. The first one is pretty much the current statusbarDebugger.command. For the later the default setting would be to stop the currently selected running debugger (for the lagacy reasons), another setting would be calling for the running debugger selector and the third one - for cycling through them.

Thank you.

fabiospampinato commented 5 years ago

@Spown Unfortunately it doesn't look like they have any interest in implementing this https://github.com/Microsoft/vscode/issues/30810