Use global debug options instead of project-specific ones#6372
Use global debug options instead of project-specific ones#6372AdamYoblick merged 2 commits intomicrosoft:masterfrom AdamYoblick:fix_error_when_attaching
Conversation
| // this should never happen | ||
| Debug.Fail("adapterLaunchInfo is not valid json"); | ||
| // adapterLaunchInfo.LaunchJson can be null when attaching to a remote process | ||
| if (adapterLaunchInfo.LaunchJson != null) { |
There was a problem hiding this comment.
so what is AddDebuggerOptions for?
There was a problem hiding this comment.
so, if adapterLanguageInfo.launchJson is null, when this is called (
), what do we expect?There was a problem hiding this comment.
Note that there are two different debug info classes there - one for launch, and one for attach. But they have a common base class, and VariablePresentation is there. So it seems like it should be available regardless of how the session gets started.
There was a problem hiding this comment.
Thanks, makes sense. I guess what confuses me is the two different ways that you can get these options. The one I used in https://github.com/microsoft/PTVS/pull/6337/files seems to be the PythonToolsService, and those options get packed into the adapterLaunchInfo.LaunchJson...but these other options are being read from the global IPythonDebugOptionsService.
It doesn't make sense to me to have two different paths to the same options. Should I just always be using the global one?
There was a problem hiding this comment.
It seems that I can just add some fields to the IPythonDebugOptionsService to expose the variable presentation stuff that already exists on the DebuggerOptions class. But this means that lots of the other code I added in the previous PR can go away, if we're just always going to be reading these options from the global options service.
There was a problem hiding this comment.
Hm, good point. This one is really meant for properties that are project-specific; for global properties, I guess it can just read it directly, since there's no ambiguity over which project it comes from.
@karthiknadig might have some thoughts about this.
There was a problem hiding this comment.
The two ways were there to handle project specific and global option. It should be fine to read non-project specific properties directly from global location.
PS: This part is also a bit messy because of the way we had to handle ptvsd4 vs debugpy at the same time.
There was a problem hiding this comment.
ok thank you everyone, I have a clear path now. Global makes sense to me too, since these options are not project specific. And since they are moving to global in vscode too, I think that's a good approach.
|
Ok this all seems to be working. I tested both when launching the debugger directly through VS as well as attaching to a debugpy process, and both respect the variable presentation options from the Tools -> Options page. So this is ready for review again :) |
|
Kudos, SonarCloud Quality Gate passed! |
|
Thanks everyone! |
Fixes #6369
This is a fix for a regression I introduced when reading variable presentation options from the options page. The bug occurs when attaching to a remote debugpy process instead of launching the debugger directly, which is a case I did not test.