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

Allow seeing the "Return value" of an operation in the debug panel #5104

Open
MiniSuperDev opened this issue May 11, 2024 · 3 comments
Open
Labels
blocked on dart / flutter Requires a change in Dart or Flutter to progress is enhancement
Milestone

Comments

@MiniSuperDev
Copy link

In JS you can see the Return value of different operations in the debug panel in the "Return value"
image

I would like to be able to do the same in Dart.

So instead of this

int sum(int a, int b) {
  final result = a + b;
  return result; // break point to se the "Return value" but you need to create a local variable.
}

We could make this

ìnt sum(int a, int b)=> a + b; // with this feature you can make "Step over" or other steps and see "Return value" without create local variable.

More info:
https://stackoverflow.com/questions/47200659/watching-return-values-in-visual-studio-code

Thanks

@DanTup
Copy link
Member

DanTup commented May 13, 2024

@bkonyi is there an existing way to get at the return value for a function through the VM Service?

In JS, when you step over a return, there's an extra stop location at the return which includes the return value in the variables list:

js.mp4

In Dart, it seems we have a similar extra stop location (it jumps to before the return keyword):

dart.mp4

However, I can't see anything in the VM traffic that indicates the return value so I'm not sure if the reason for this extra stop point was for this reason, or something else.

@bkonyi
Copy link

bkonyi commented May 13, 2024

I'm not aware of any way to do that, otherwise it would have already been available alongside the list of other local variables.

We probably have a step location there since we're about to perform the return after evaluating a + b. If we didn't have that location, we'd simply skip past return in a function that returns void.

This does seem like nice behavior, but we'd need to make service changes. It's probably worth filing an issue for this in the SDK, but I don't think it'll be high priority.

@DanTup
Copy link
Member

DanTup commented May 13, 2024

@bkonyi thanks, I've opened dart-lang/sdk#55704

@DanTup DanTup added this to the Backlog milestone May 13, 2024
@DanTup DanTup added the blocked on dart / flutter Requires a change in Dart or Flutter to progress label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked on dart / flutter Requires a change in Dart or Flutter to progress is enhancement
Projects
None yet
Development

No branches or pull requests

3 participants