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

Variable inspection in the debugger sidebar #9114

Closed
JohanMabille opened this issue Oct 29, 2019 · 9 comments
Closed

Variable inspection in the debugger sidebar #9114

JohanMabille opened this issue Oct 29, 2019 · 9 comments
Labels
enhancement pkg:debugger status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. tag:Design and UX
Milestone

Comments

@JohanMabille
Copy link
Member

Asking the variables with the sequence of StackTrace, Scopes and Variables requests does not work if execution did not stop on a breakpoint.

A solution to this would be to add a command in the protocol, let's say inspectVariables, that would make the interpreter execute globals and return its result.

@martinRenou
Copy link
Member

Do you know why it's not in the Debug Adapter Protocol already?

@jtpio
Copy link
Member

jtpio commented Oct 29, 2019

Asking the variables with the sequence of StackTrace, Scopes and Variables requests does not work if execution did not stop on a breakpoint.

This can be tested by calling:

const stackTrace = await debugSession.sendRequest('stackTrace', {
  threadId
});
console.log(stackTrace)

just before:

https://github.com/jupyterlab/debugger/blob/c9a0988a567f856b77ffbacd71083e460d7dcd16/tests/src/session.spec.ts#L149

Output:

{
  body: {},
  command: 'stackTrace',
  message: 'Wrong ID sent from the client: 1',
  request_seq: 5,
  seq: 7,
  success: false,
  type: 'response'
}

@JohanMabille
Copy link
Member Author

The inspectVariables has been implemented in the back end. However globals returns a simple dictionary variable name - variable value while the variables panel expects an array of IVariables. We should either improve the backend so it returns an array of variables, or change the front end to transform the list of variables into a simple dictionary.

Last option would be to be able to pass different objects to the react component, but the view when stopped on a breakpoint and that when the execution has finished whould be inconsistent.

@jtpio
Copy link
Member

jtpio commented Dec 5, 2019

Moving to the Future milestone.

@jtpio
Copy link
Member

jtpio commented Jan 30, 2020

Also this inspectVariables request is meant to be used when the execution is not stopped. Typically the debugger could be enabled for a notebook, but the user would execute code as normal without breakpoints.

This also means that if a user wants to inspect children of a top-level variable (for example a nested dict or a class), the frontend could still send an execute_request to evaluate the variable directly, since there won't be any variableReference to send to the debugger.

@jtpio
Copy link
Member

jtpio commented Mar 4, 2020

The latest version of xeus-python now follows the DAP for the inspectVariables response.

For more info:

@jtpio jtpio changed the title Variable inspection Variable inspection in the debugger sidebar Sep 30, 2020
@jtpio jtpio transferred this issue from jupyterlab/debugger Sep 30, 2020
@jtpio jtpio added this to the Future milestone Sep 30, 2020
@jtpio
Copy link
Member

jtpio commented Mar 17, 2021

xref #7873 which discusses inspecting Python objects.

@krassowski
Copy link
Member

Closing as implemented in #10025 and released in 3.1. Please correct me if I am wrong here.

@JohanMabille
Copy link
Member Author

Please notice the backend has been improved to return an array of IVariable when receiving an inspectVariable request. This way the behavior is consistent with the variables request and no further change is required in the frontend.

See ipython/ipykernel#753

@github-actions github-actions bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Feb 27, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement pkg:debugger status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. tag:Design and UX
Projects
None yet
Development

No branches or pull requests

4 participants