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

Handle multiple scopes in the debugger variables viewer #9346

Merged
merged 13 commits into from
Dec 8, 2020

Conversation

jtpio
Copy link
Member

@jtpio jtpio commented Nov 16, 2020

References

Up until now the debugger would only display one scope at a time.

However after the switch to debugpy the variables explorer was displaying the same information twice without mentioning the name of the scopes:

image

This PR fixes the assumptions that variables come from the first scope:

const variables = await this._getVariables(scopes[0]);

Which might have been the case until now with ptvsd but does not apply anymore with debugpy.

Code changes

User-facing changes

Before

Using the latest xeus-python with debugpy:

image

After

Since both xeus-python and VS code use debugpy, the variables viewer now shows "special variables" and "function variables" too:

EDIT: updated the screencast to show the latest status:

debugger-scope-switch

Backwards-incompatible changes

This is mostly a UI change and should still be compatible with the previous versions of xeus-python that rely on ptvsd.

@jupyterlab-dev-mode
Copy link

Thanks for making a pull request to JupyterLab!

To try out this branch on binder, follow this link: Binder

@github-actions github-actions bot added Design System CSS pkg:debugger tag:CSS For general CSS related issues and pecadilloes labels Nov 16, 2020
@jtpio
Copy link
Member Author

jtpio commented Nov 16, 2020

Updated the grid view to show the locals and globals at the same level:

image

Maybe there could be a dropdown to select the scope, which would update the grid and show variables for one scope at the time.

@jtpio
Copy link
Member Author

jtpio commented Nov 17, 2020

Using a dropdown to switch between scopes:

debugger-scope-switch

@jtpio jtpio marked this pull request as ready for review November 23, 2020 16:58
@jtpio
Copy link
Member Author

jtpio commented Nov 23, 2020

This should be ready for a first pass of review.

And can be tested on Binder (pre-built for 27b2246): https://mybinder.org/v2/gh/jtpio/jupyterlab/27b2246b021be3d3b2266b71f6e5d566629f62ef?urlpath=lab-dev

@jtpio jtpio requested a review from afshin November 23, 2020 17:00
@jasongrout
Copy link
Contributor

jasongrout commented Dec 3, 2020

@jtpio - is this ready for 3.0? It does look like an important fix.

You asked for a first pass of review. Do you consider this PR fairly done, or do you see a lot of iteration and further work based on review comments?

@jtpio
Copy link
Member Author

jtpio commented Dec 4, 2020

is this ready for 3.0? It does look like an important fix.

Yes, and the Binder should be pre-built to make it easier to try out: https://mybinder.org/v2/gh/jtpio/jupyterlab/debugger-scopes?urlpath=lab-dev

I think this solves the main issue of handling multiple scopes. Then more iteration could be done in follow-up PRs if we think the UX should be different or tweaked.

@jtpio jtpio added this to the 3.0 milestone Dec 4, 2020
@afshin
Copy link
Member

afshin commented Dec 4, 2020

I am having trouble getting this branch to work. This is what I am seeing:

screencap

@jtpio
Copy link
Member Author

jtpio commented Dec 4, 2020

@afshin this looks like the compatibility issue mentioned in #9414 (comment).

Which version of xeus-python are you using? On Binder it's 0.9.1.

@afshin
Copy link
Member

afshin commented Dec 4, 2020

  debugpy              1.2.0  py37hfbb9781_0  conda-forge/osx-64        2 MB
  ptvsd                4.3.2  py37h60d8a13_3  conda-forge/osx-64        5 MB
  xeus-python          0.9.1  py37ha661077_0  conda-forge/osx-64     1000 KB

These are the things I installed right before making that screencap.

Update: I am using Python 3.7.4

@jtpio
Copy link
Member Author

jtpio commented Dec 4, 2020

Update: I am using Python 3.7.4

Would you be able to try with Python 3.8 in a new environment?

This breakpoint issue is probably unrelated to this PR, but might still need to be fixed in the debugger extension.

@afshin
Copy link
Member

afshin commented Dec 8, 2020

I am having trouble with this. In a brand new conda env with Python 3.8 I get the same error. And I cannot get the Binder link to load either.

@afshin
Copy link
Member

afshin commented Dec 8, 2020

Figures, literally as soon as I sent that message, the Binder finally worked!

@afshin
Copy link
Member

afshin commented Dec 8, 2020

@JohanMabille I finally got it working on my system when I installed xeus-python with pip. It does not work if i use mamba or conda.

Copy link
Member

@afshin afshin left a comment

Choose a reason for hiding this comment

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

Thank you @jtpio!

@afshin
Copy link
Member

afshin commented Dec 8, 2020

In a follow-on PR, the CSS which handles truncating long paths (and making sure the title "Sources" is not obscured) can probably use some tweaking.

@afshin afshin merged commit a708c77 into jupyterlab:master Dec 8, 2020
@afshin
Copy link
Member

afshin commented Dec 8, 2020

Sorry for the long delay!

@jtpio jtpio deleted the debugger-scopes branch December 9, 2020 00:17
@JohanMabille
Copy link
Member

@afshin On which platform did you experience the issue? (I bet on OSX, but just to be sure)

@jtpio
Copy link
Member Author

jtpio commented Dec 10, 2020

@afshin On which platform did you experience the issue? (I bet on OSX, but just to be sure)

  debugpy              1.2.0  py37hfbb9781_0  conda-forge/osx-64        2 MB
  ptvsd                4.3.2  py37h60d8a13_3  conda-forge/osx-64        5 MB
  xeus-python          0.9.1  py37ha661077_0  conda-forge/osx-64     1000 KB

I think that's the case based on this output ^

@afshin
Copy link
Member

afshin commented Dec 10, 2020

Yes I was on macOS (Big Sur, 11.0.1)

@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 Jun 9, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Design System CSS pkg:debugger status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. tag:CSS For general CSS related issues and pecadilloes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants