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

"Cannot set property activeDebugSession of #<Object> which has only a getter" when trying to change active debug session #215988

Open
DanTup opened this issue Jun 17, 2024 · 3 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality
Milestone

Comments

@DanTup
Copy link
Contributor

DanTup commented Jun 17, 2024

vs.debug.activeDebugSession is marked as mutable in the definition:

export let activeDebugSession: DebugSession | undefined;

But trying to set it results in the following runtime exception:

Exception has occurred: TypeError: Cannot set property activeDebugSession of #<Object> which has only a getter
t VsCodeApiImpl.<anonymous> (c:\Dev\Dart-Code\Dart-Code\out\dist\extension.js:6563:45)
	at Generator.next (<anonymous>)

I'm trying to improve the UI for launching some additional tooling and it allows the user to select a debug session to launch the tool far. To improve the experience, I'd like to allow the user to use a "selected" debug session but I don't want a different selection to VS Code - I'd like to sync changes made in either place into a single selected debug session.

I also looked for a command, but I only found workbench.action.debug.selectDebugSession which seems to just show a pick-list and not allow us to provide a session explicitly.

@roblourens
Copy link
Member

Even though those are let, only vscode can set them. This sparked a discussion and I filed #216555 to change this. But it sounds like you're basically asking for a way for an extension to set the active debug session. I'm not sure about that. Why do you want to have different UI for this rather than having the user pick the active debug session in VS Code's picker, and listening to that?

@roblourens roblourens added the info-needed Issue requires more information from poster label Jun 18, 2024
@DanTup
Copy link
Contributor Author

DanTup commented Jun 19, 2024

it sounds like you're basically asking for a way for an extension to set the active debug session

Correct.

Why do you want to have different UI for this rather than having the user pick the active debug session in VS Code's picker, and listening to that?

We're trying to improve discoverability of some additional debugging tools for Dart/Flutter. We have a sidebar that shows the debug sessions and lets you launch additional tools (which are tied to a debug session). Currently those tools are in a dropdown alongside the debug sessions:

image

However these aren't very discoverable so we'd like to move them out of this menu to be more visible in the sidebar. However, that means either:

  1. When a user clicks one, we have to prompt for a debug session
  2. We launch for the "active" debug session

We think the second option is best, however the VS Code dropdown is far away from the sidebar (and maybe it's not even visible - see #216601). We think it would be better if we kept the list of debug sessions and highlighted the active one (and updated when it changed in VS Code), similar to how we do with device selection:

image

But highlighting the selected debug session here and not being able to click on one to select it would be odd (especially as you can do that with the device and we sync it in both directions). If we track our own version of a selected debug session, I think that would also be confusing.

So, I think the best experience for users would be if they can select a debug session here too, where it's clear it applies to which tool you'll launch, but it's not a different concept to the active session in VS Code which the debug toolbar and other things apply to.

We don't plan to ever change the session automatically, this is entirely in response to the user selecting it. It's just a more convenient way for them to change it, and to see the selected debug session in a way that is obviously connected to the tool that will be launched (unlike the VS Code toolbar that is quite distant).

@DanTup
Copy link
Contributor Author

DanTup commented Jun 19, 2024

I filed #216601 about the missing dropdown when using command center, which was linked to #194881 where you said:

Otherwise I think it's not too bad to use the callstack or the dropdown in the debug console

If this is the solution to that, then I think being able to set this here for me is even more important, because a user having to switch from this sidebar view to the debug view and then back to change debug session is definitely not a good experience.

@roblourens roblourens added feature-request Request for new features or functionality debug Debug viewlet, configurations, breakpoints, adapter issues and removed info-needed Issue requires more information from poster labels Jul 3, 2024
@roblourens roblourens added this to the Backlog milestone Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

2 participants