Skip to content

Conversation

@posita
Copy link

@posita posita commented Feb 8, 2022

Fixes #18389.


Problem and Constraints

Hiding aspects of running code from the debugger is the unfortunate default for vscode-python. Users who come from other environments (IPDB, PyCharm, etc.) are presented with a disorienting absence of expected information that can lead to a distrust of the product.

Generally, where hiding relevant detail is the default, the mechanism to expose that detail should be obvious and be accessible in close proximity to where such detail would otherwise appear. VSCode itself presents no opportunity to cure this defect directly, which makes the selected default even more confusing.

To date, the casual response has been to point users to the documentation. This is not helpful to newcomers who may not even be aware that such documentation exists or casual users who have not revisited the documentation in awhile. Remote documentation is a poor substitute for proper interface design.

Changing the default was considered and rejected, apparently because VSCode largely targets less sophisticated developers. This is accepted without challenge as the research leading to this conclusion is likely proprietary.

Solution

So what can we do?

One slightly removed but prominent surface controlling debugger behavior is launch.json, which is both accessible and reasonably connected to the debugging workflow. Unfortunately, justMyCode (the non-intuitively named setting that hides some stack frames and breakpoints by default) does not appear in the default configuration.

Without substantial reworking of the debugger environment itself, the best identified compromise available at the time of this writing is to add "justMyCode": true explicitly to new configurations in launch.json. Because it is not obvious what this setting does by name alone, it should be accompanied by a comment that explains its function and links to its documentation (ideally, from within VSCode itself to avoid requiring a network connection).

microsoft/vscode-python#18471 adds an explicit entry to default configurations. Perplexingly, there is no mechanism to add an accompanying comment or link to the documentation. That deficiency is identified in microsoft/vscode#142533, which must be handled in a subsequent PR.

Commentary

This serves as a cautionary tale to professional product designers and developers everywhere to select defaults carefully, with a diverse human audience in mind, and to provide ergonomic mechanisms to discover and manipulate those defaults.

@ghost
Copy link

ghost commented Feb 8, 2022

CLA assistant check
All CLA requirements met.

@kimadeline
Copy link

Hi @posita, thank you for your PR!

Remember to add a news file thanking yourself, so that your contribution appears in our release notes 🙂

Also, the changes you made caused unit tests to fail, please make sure to fix them. It should only be a matter of adding justMyCode: true to the expected results of the failing tests, but please let us know if you encounter any issues along the way.

@posita
Copy link
Author

posita commented Feb 9, 2022

Thanks @kimadeline! This is a draft. I wanted to push this to:

  1. Invoke your CI machinery to see if/where tests failed; and
  2. Have something to point to in case we needed to address Explicitly add "justMyCode":"true" to all launch.json configurations  #18389 (comment) .

#2 is no longer an issue, thanks to your follow-up.

Thanks for your attention and diligence, though. I appreciate the nudges and advice! 😊 I will address the tests, push an update, and mark the PR as ready for review shortly.

@posita
Copy link
Author

posita commented Feb 9, 2022

I think adding the skip package*.json label is appropriate for this PR. (My edit to package.json should have no effect on package-lock.json.) If that's appropriate, how do I add that label?

@posita posita marked this pull request as ready for review February 9, 2022 16:39
Copy link

@kimadeline kimadeline left a comment

Choose a reason for hiding this comment

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

Hi there,

The skip package json label is added by maintainers of this repo. For the news file, please make it a one-liner, since we gather all news files and add them as bullet points to the changelog.

Something like the following should be enough:

Explicitly add "justMyCode": "true" to all launch.json configurations. (Thanks Matt Bogosian)

@kimadeline kimadeline added the skip package*.json package.json and package-lock.json don't both need updating label Feb 9, 2022
@posita
Copy link
Author

posita commented Feb 10, 2022

Something like the following should be enough:

Explicitly add "justMyCode": "true" to all launch.json configurations. (Thanks Matt Bogosian)

Done. Thanks, @kimadeline!

Copy link

@kimadeline kimadeline 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 for your contribution!

Added a suggestion for you to thank yourself in the news entry (will appear in the changelog), I'll merge your PR once you've accepted the suggestion or let me know otherwise.

Co-authored-by: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com>
@kimadeline kimadeline merged commit 51f5a3a into microsoft:main Feb 10, 2022
@posita posita deleted the posita/0/expose-just-my-code branch February 21, 2022 15:51
wesm pushed a commit to posit-dev/positron that referenced this pull request Mar 28, 2024
…ions (microsoft/vscode-python#18471)

* Explicitly add `"justMyCode": "true"` to all `launch.json` configurations

Fixes microsoft/vscode-python#18389.

* Respond to maintainer feedback

* Update news/2 Fixes/18471.md

Co-authored-by: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com>

Co-authored-by: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip package*.json package.json and package-lock.json don't both need updating

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explicitly add "justMyCode":"true" to all launch.json configurations

2 participants