Skip to content

Python extension should activate on onDebugInitialConfigurations聽#9557

Closed

Description

Hi VS Code dev here 馃憢

  1. Have python extension installed, workspace without a launch.json.
  2. Do not open a python file
  3. Press "Open launch.json" in the Debug viewlet
  4. Python options are not presented 馃悰

The issue for this is because Python extension did not get activated since no python file got opened.
I suggest that python extension gets activated also for onDebugInitialConfigurations event. This event is fired when the launch.json is about to get populated for the first time.

fyi Luciana Abud (@luabud)

Activity

  1. added
    triage-neededNeeds assignment to the proper sub-team
    bugIssue identified by VS Code Team member as probable bug
    on Jan 13, 2020
  2. DonJayamanne commented on Jan 13, 2020

    @DonJayamanne
  3. DanTup commented on Jan 13, 2020

    @DanTup

    I don't know if it's changed, but I had a niggle with onDebugInitialConfigurations mentioned here:

    microsoft/vscode-node-debug#170

    When I open a Dart project and hit F5 - if I have no .dart file open, I am shown a quick-pick asking me to pick between Dart and NodeJS. If Python did this what's described above, I think it would also show up (as described by Don Jayamanne (@DonJayamanne) above).

    This feels like bad UX IMO, causing debuggers for unrelated projects to show up when a user hits F5 just because there was no open file.

  4. isidorn commented on Jan 13, 2020

    @isidorn
    Author

    Yes, python would also show up. No file is open so we can not make any distincutions based on the language / active file.
    There is no better way to infer what is the proper debugger to use. If you have do let us know.

    Bottom line: python should still get activated on this event, the event Danny Tuppeny (@DanTup) is describing is a corner case and python should be in the same spot as the js debuggers.

  5. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on Jan 13, 2020
  6. luabud commented on Jan 13, 2020

    @luabud
    Member

    Thank you for creating this issue and for proposing a solution 馃帀
    I marked it as an enhancement and as "needs decision" so I can talk about this with the team 馃槉

  7. DanTup commented on Jan 13, 2020

    @DanTup

    the event Danny Tuppeny (@DanTup) is describing is a corner case

    I think it's more than that. It's pretty common to open a project and (with no files open) just hit F5. The more languages that do this, the more options the user has to read through to figure out what they need to select 馃槥

    It also means that the extension will almost always be activated (anytime someone wants to debug any type of project your extension will now be activated). The C# extension does this and I'm frequently seeing it start downloading SDK/dependencies when I'm starting to debug a Dart project.

    I appreciate this is the wrong issue tracker for it, but I think VS Code really needs better APIs here. In addition to the bad UX, there's a perf implication - the more languages that subscribe to this, the slower pressing F5 will be as a bunch of extensions all start running activating code (and potentially spawning language servers, etc).

  8. luabud commented on Jan 14, 2020

    @luabud
    Member

    I understand the concern. FWIW we're also looking into how the Python extension can be
    activated faster by e.g. postponing some functionalities until they're actually needed. In this case, we wouldn't start downloading and/or executing any tools until a Python file is actually open. Then activating the extension to get the debug configuration options wouldn't be so heavy.

    It's also worth mentioning that extensions can be disabled per workspace, so there's also the option to enable only the ones that are actually intended to be used on a workspace. But I also understand that this is still a problem on multi-language projects, and that not everyone is aware of this feature.

  9. DonJayamanne commented on Jan 14, 2020

    @DonJayamanne

    I believe we are in a position to do this now.
    If I'm not mistaken the extension loads within <1 second or perhaps <less (on my mac it takes 230ms).
    The slow part in the extension is when users install extension for the first time or update it, at that point the language server gets download and blocks activation of the extension (as you have identified).
    This was a deliberate decision, back then resolving this was seen as an unnecessary premature optimization. Its worked for us all these months, year, hence there was no need to optimize.

    However, in light of this new requirement I believe we can make that change now - maybe.
    Though we'd get prompts such as Did you know you can change the interpreter, etc...

  10. isidorn commented on Jan 14, 2020

    @isidorn
    Author

    Danny Tuppeny (@DanTup) please create an issue in vscode and we can continue the discussion there.
    Also this event will only be fired the very first time the launch.json is getting created. It will not be fired every time a user wants to debug.

  11. 5 remaining items

  12. JessieJolly commented on Oct 1, 2021

    @JessieJolly

    Can I be assigned this issue for vGHC 21?

  13. nayana-vinod commented on Oct 2, 2021

    @nayana-vinod

    Hai, I'm hoping to work on this issue with Jessica, so can I also be assigned this for vGHC21?

  14. paulacamargo25 commented on Oct 15, 2021

    @paulacamargo25

    Hi Isidor Nikolic (@isidorn) im trying to test the solution. In the step 3, the "Open launch.json" in the Debug view is outdated, now we have "create a launch.json file". But if you don't have the python extension activated then you are not be able to create a launch file for python files for initial configuration.

    Can you please explain how can i test that adding onDebugInitialConfigurations activation event will work?

  15. isidorn commented on Oct 18, 2021

    @isidorn
    Author
    1. Have a repository with no launch.json
    2. Do not open any py files to make sure the python extension is not activated
    3. Open debug viewlet, click on the create a launch.json file (picture)
    4. Python should be offered in the quick pick, currently it is not 馃悰

    Screenshot 2021-10-18 at 14 44 15

  16. paulacamargo25 commented on Nov 29, 2021

    @paulacamargo25

    Fixed with #17753

  17. isidorn commented on Nov 30, 2021

    @isidorn
    Author

    Paula (@paulacamargo25) thanks for fixing this 馃憦

  18. locked as resolved and limited conversation to collaborators on Dec 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions