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

Surface "variablePresentation" in settings.json #165

Open
int19h opened this issue Jun 16, 2020 · 22 comments · May be fixed by #433
Open

Surface "variablePresentation" in settings.json #165

int19h opened this issue Jun 16, 2020 · 22 comments · May be fixed by #433
Labels
feature-request Request for new features or functionality needs PR Ready to be worked on

Comments

@int19h
Copy link

int19h commented Jun 16, 2020

microsoft/ptvsd#1621 (comment)

This allows user to control how various variable groups are shown in debugger UI. We have implemented it for VS originally (to allow it to request old behavior); but it's more broadly useful, and people are already asking for it in VSCode context.

@int19h int19h added feature-request Request for new features or functionality triage-needed Needs assignment to the proper sub-team labels Jun 16, 2020
@kimadeline
Copy link

Todo:

  • add it to the schema
  • document it with all the other launch.json props (open an issue on the vscode-docs repo)

@int19h
Copy link
Author

int19h commented Jun 16, 2020

On a second thought, I'm not sure we want to expose this directly like that. While setting it in launch.json does work, logically, the proper place for this is in extension settings (since this is usually a generic debugging UX preference, not specific to a particular debug target). So perhaps it would be better to expose it in settings, and have some code that injects the corresponding properties into the debug configuration?

It can be put in the schema regardless, but if we do it, we'll have to keep it there for back-compat reasons even if we also do the setting later - and that will be more confusing than having it in one place.

@luabud, what do you think?

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Jun 16, 2020

o perhaps it would be better to expose it in settings, and have some code that injects the corresponding

I'd suggest not adding into settings.json until we have users requesting the ability to change the defaults, else we end up with more settings in settings.json that are probably not going to be used by a majority of the users.

@int19h
Copy link
Author

int19h commented Jun 16, 2020

We already have users asking for this - see the StackOverflow link in the bug description.

@luabud
Copy link
Member

luabud commented Jun 18, 2020

I agree with you @int19h, it makes sense to have it as a User setting (I don't see how someone would like to disable this per project?).

@DonJayamanne about this:

else we end up with more settings in settings.json that are probably not going to be used by a majority of the users.

I feel that this is already the case for VS Code all up, isn't it? Perhaps I'm biased because I love the power of customization in VS Code, so I'd love to have this in the extension too.

@int19h int19h changed the title Add "variablePresentation" to launch.json schema Surface "variablePresentation" in settings.json Jun 22, 2020
@int19h
Copy link
Author

int19h commented Jun 22, 2020

What would be the settings.json name for this? I'd expect something like "python.debugging.variablePresentation", but note that we don't have anything that starts with "python.debugging" at the moment.

@luabud
Copy link
Member

luabud commented Jun 23, 2020

@int19h I like it! An alternative would be to have python.debuggerVariablePresentation, but I prefer your suggestion because it goes with our other settings (python.testing, python.linting, etc.).
I don't foresee us having many settings for debugging in the settings.json file, but I think it's good to follow our standard format.

@jeffreyyjp
Copy link

Hello, guys. I may wonder if we already have this in settings. I searched variablePresentation in settings but don't find anything. And to be honest, I don't like the launch.json solution. I like to have the global config about this, not only for launch.json for each project.

@AdamYoblick
Copy link
Member

Hi everyone,

We have some customers asking for this from the PTVS side as well, so we'll probably need to expose these options in a python-specific Tools -> Options page in VS.

Following the stack overflow post (https://stackoverflow.com/questions/62346091/how-can-i-disable-hide-the-grouping-of-variables-in-vscode-python/62401205#62401205), I just want to make sure I'm aware of all the presentation option values.

"variablePresentation": {
    "all": "inline",
    "class": "group",
    "function": "hide",
    "protected": ...,
    "special": ...,
}

Are these all the available variable types?
Are inline, group, and hide all the available presentation types?

@AdamYoblick
Copy link
Member

I spoke with Pavel offline and he confirmed that these are all the available options. I'm going to mess with passing some hardcoded values to debugpy through Visual Studio to make sure it's working properly, then I'll work on the options page. @luabud perhaps we can release this feature for both VS and VSCode around the same time? 😄

@AdamYoblick
Copy link
Member

AdamYoblick commented Jan 12, 2021

The Visual Studio side of work is basically done for PTVS with microsoft/PTVS#6337, pending UI approval. If we get approval before 1/29 (Fri), then it will be in VS 16.9 Preview 4.

@vvijayalakshmi21
Copy link

Hi,
Is this issue still open to work?

@AdamYoblick
Copy link
Member

Definitely yes, sorry for all my noise. I was referring to related work, which implements the same functionality in PTVS, which is in VS, not vscode. THIS issue is still open to be taken.

@arsentieva
Copy link

Can I work on this issue?

@luabud
Copy link
Member

luabud commented Oct 1, 2021

@arsentieva yes! 😊

@int19h
Copy link
Author

int19h commented Oct 1, 2021

@arsentieva Feel free to ping me if you have any technical questions about this.

@arsentieva
Copy link

Hi @int19h I am trying to find out where this logic should live and the search attempts for settings.json or variablePresentation did not find anything. Can you please help me identify where the setting logic lives?

@int19h
Copy link
Author

int19h commented Oct 1, 2021

The extension is not aware of "variablePresentation" currently; it works in launch.json because everything in there flows to the debug adapter, which handles it as described here.

settings.json is parsed by VSCode itself, so the extension just needs the appropriate contribution points and handlers. For vscode-python, I believe you're supposed to be using this wrapper (@kimadeline, correct me if I'm wrong):

https://github.com/microsoft/vscode-python/blob/3698950c97982f31bb9dbfc19c4cd8308acda284/src/client/common/application/types.ts#L812-L825

To actually flow it from settings into the debug config, you'll need to change the various configuration resolvers such as this one:

https://github.com/microsoft/vscode-python/blob/c4032b212b2fad7f05deb3e823bf2527c9b8d5d0/src/client/debugger/extension/configuration/resolvers/launch.ts#L59-L183

This one already has an example of the "envFile" setting being propagated into the configuration; "variablePresentation" should be similar (but also applies to attach and other configs, so it probably belongs to the base class for them all).

@DevilXD
Copy link

DevilXD commented Nov 5, 2023

Hello. I've been looking for an option to set a default for variablePresentation, and found this issue. +1 from me for adding a setting for it.

@brettcannon brettcannon transferred this issue from microsoft/vscode-python Dec 18, 2023
@dimateos
Copy link

An option would be great! At the moment, if you have many launch configs you need to copy paste the config in each of them.

@codebydant
Copy link

Hi team, would be great to have a config specific for modules as well.

There is a question about this in stackoverflow: How to hide loaded modules from variable inspection in VSCode

something like:

"variablePresentation": {
        "function": "hide",
        "special": "hide",
        "class": "group",
        "all": "group",
        "protected": "hide",
        "modules": "hide"
 }

@2zqa
Copy link

2zqa commented Nov 25, 2024

This is necessary if you want to hide this extra information when debugging tests. Those do not use launch.json configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality needs PR Ready to be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.