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

Join project during debug session #81

Draft
wants to merge 10 commits into
base: debugger
Choose a base branch
from

Conversation

Anthony-Eid
Copy link
Collaborator

This is an almost completed proof of concept version of setting active debug sessions when joining a project. I'll update this description tomorrow mid day (est) to expand on this more.

After this I'm either going to create a proof of concept of the dap proxy or update the documentation on how to configure the debugger.

P.S. Sorry this took me longer than expected, I ended up spending a lot of time with friends and family over the holidays, but I'm getting back in the grove of contributing at least every other day now.

mut cx: AsyncAppContext,
) -> Result<()> {
this.update(&mut cx, |dap_store, cx| {
if let Some((_, _)) = dap_store.downstream_client {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to check here if we have a downstream client?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a sanity check. I don’t think it will ever fail but just in guess theirs a future regression or something we don’t think about.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhm but this code is never hit inside the if statement right? Because we should only end up inside this method on the non host clients, so there will never be a downstream client. Or am I missing something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shoot you’re right!! I should’ve use upstream_client instead. I was up late last night and didn’t realize.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good, I believe this is already covered by the collab code that it's only called when you are actually inside a shared collab channel.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check was supposed to ensure that only the host would respond to a GetDebuggerSessions message. I wasn't sure if a message is propagated to all clients or just the host.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this and the original downstream_client was correct. We only want to send active sessions if we have downstream clients

this.update(&mut cx, |dap_store, cx| {
if let Some((_, _)) = dap_store.downstream_client {
cx.emit(DapStoreEvent::SendDebuggerSessions(ProjectId(
_envelope.payload.project_id,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this event SendDebuggerSessions do? No one is acting on it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug panel is supposed to act on it to send active sessions. Im planning on adding a client handler directly to the debug panel to clean this up

@@ -170,6 +173,10 @@ impl DapStore {
upstream_client: AnyProtoClient,
_: &mut ModelContext<Self>,
) -> Self {
upstream_client
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this to the shared method? This feels a bit hacky solution. So we also don't try to send a proto message when you are not event sharing a project.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes


#[gpui::test]
async fn test_active_debug_panel_item_set_on_join_project(
cx_a: &mut TestAppContext,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to see more tests😀

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least one test per new feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants