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

Proxy dap requests to upstream clients #77

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

Conversation

Anthony-Eid
Copy link
Collaborator

WIP

@Anthony-Eid
Copy link
Collaborator Author

@RemcoSmitsDev This is still a WIP, but I would appreciate any feedback you have

@RemcoSmitsDev
Copy link
Owner

RemcoSmitsDev commented Dec 18, 2024

I think you are going in the right direction, one thing that came to my mind is that we now also have to sync the capabilities. Because we are using this to determine if we are sending a specific request or not, or use another request that is supported.


let task = self.request_dap::<SetVariable>(client_id, arguments, cx);

cx.background_executor().spawn(async move {
Copy link
Owner

Choose a reason for hiding this comment

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

I think this wrapping it inside a background task is not needed, as you already do this inside the request_dap method.

Copy link
Collaborator Author

@Anthony-Eid Anthony-Eid Dec 18, 2024

Choose a reason for hiding this comment

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

I tried doing this

task.map(|res| res.map(|response| response.variables)) 

before, but the return type wasn't the same as the function. I do think you're right that we shouldn't do create two tasks, I'm going to change the function's return type instead. Thanks for the feedback!!

cx: &mut ModelContext<Self>,
) -> Task<Result<R::Response>>
where
<R as dap::requests::Request>::Response: 'static,
Copy link
Owner

Choose a reason for hiding this comment

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

Do we have to specify the lifetime here? Not sure if this is really needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Without it the compiler returns an error when we try to build.

I think it's because we're moving that type into it's own thread and it needs to have ownership over it's fields to guarantee that they're still exist in the Task.

@Anthony-Eid
Copy link
Collaborator Author

I think you are going in the right direction, one thing that came to my mind is that we now also have to sync the capabilities. Because we are using this to determine if we are sending a specific request or not, or use another request that is supported.

Thank you for catching this!! I didn't even think about that

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