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

Debugpy plugin to display collection content as a list/dict/set #232

Open
ondrudav opened this issue Feb 29, 2024 · 1 comment
Open

Debugpy plugin to display collection content as a list/dict/set #232

ondrudav opened this issue Feb 29, 2024 · 1 comment

Comments

@ondrudav
Copy link

Debugpy and by extension VSCode displays the values of variables using __repr__ when they are collapsed, but when expanded the internals of what should look like a list/dict/set are exposed:

image

The only way to fix this that I found is to write a pydevd extension. Unfortunately there's no standard paging mechanism (microsoft/debugpy#1179) so the variable resolvers do (list, tuple) and don't (dict, set) hand roll their own. I think copying the TupleResolver should be fine because everything is sorted and indexable.

@ondrudav
Copy link
Author

ondrudav commented Mar 2, 2024

after spending an afternoon on this i think the extension mechanism is an after-afterthought, as seen by it being broken recently: microsoft/debugpy#1408 and microsoft/debugpy#1505, also the only viable place to put pydevd_plugins is in site-packages (odoo-ide/pydevd-odoo) - you can't play any tricks like patching sys.path when sortedcontainers is imported because pydevd only checks for plugins once before the program is started. i don't know if pip can handle aliased install directories but it's ugly either way.

and here i thought it'd just be like writing a bit of natvis (visual studio) or python (gdb) that gets embedded/referenced in the object file.

for now i've resorted to just casting the containers to their vanilla unsorted counterparts

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

No branches or pull requests

1 participant