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

Support file base name substitution in module configuration in launch.json #86

Open
janosh opened this issue Apr 10, 2019 · 9 comments
Open
Assignees
Labels
feature-request Request for new features or functionality good first issue Good for newcomers needs PR Ready to be worked on

Comments

@janosh
Copy link

janosh commented Apr 10, 2019

Environment data

  • VS Code version: 1.33.0
  • Extension version: 2019.3.6558
  • Python version: Python 3.6.7 (miniconda)

Feature Suggestion

It would be great to be able to debug arbitrary files as modules without having to hardcode their path in launch.json. The best I could find was the following which at least allows to debug any file in a given directory as module.

{
  "configurations": [
    {
      "name": "Python: Module",
      "type": "python",
      "request": "launch",
      "module": "src.nn.models.${fileBasenameNoExtension}"
    }
  ]
}

Not sure if this can be done by the Python extension or would have to be implemented by VS Code itself, but basically I'm suggesting something similar to ${fileBasenameNoExtension} that returns the full dotted "path" to a file from a project's root?

@karrtikr karrtikr added the feature-request Request for new features or functionality label Apr 10, 2019
@janosh
Copy link
Author

janosh commented May 22, 2019

@karrtikr Any update on this? Still very much interested in this feature. Would this be hard to implement?

@DonJayamanne
Copy link
Contributor

@janosh We've added the label of needs decision. We generally wait for at least a month to measure popularity of feature requests (based on number of 👍 ) and a number of other factors (priority, etc) in deciding whether to proceed with the changes.

@luabud luabud added the good first issue Good for newcomers label Jun 4, 2019
@bipin-fm
Copy link

Any updates on this?

@jaklan
Copy link

jaklan commented Jan 13, 2020

You can use "Command Variable" extension to debug current module:
"module": "${command:extension.commandvariable.file.relativeDirDots}.${fileBasenameNoExtension}"

@janosh
Copy link
Author

janosh commented Jan 13, 2020

@jaklan Thanks for the pointer! That's a very handy extension!

@jaklan
Copy link

jaklan commented Jan 13, 2020

@rioj7 maybe you can create a PR based on your extension? Or for anyone interested - code is here.

@StefanRickli
Copy link

I'd also like to see this as a native solution.
Running the scripts as modules can help a lot with relative imports when I try to debug single files.

@brettcannon brettcannon changed the title launch.json debug any file as module Support file base name substitution in module configuration in launch.json Jun 1, 2023
@luabud luabud transferred this issue from microsoft/vscode-python Sep 14, 2023
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Sep 14, 2023
@luabud luabud added ghc-osd needs PR Ready to be worked on and removed triage-needed Needs assignment to the proper sub-team labels Sep 14, 2023
@luabud
Copy link
Member

luabud commented Sep 18, 2023

We are reserving this issue for Grace Hopper's Open Source Day, which will take place on September 22nd, 2023. If you're part of the event and would like to submit a contribution to this issue, please let us know, and we'll be happy to assign it to you.

For other community members who are not participating in the event, we appreciate your interest in contributing! We kindly request that you wait until after September 22nd to work on this issue. If no one from the event has been assigned to it by then, we'll gladly assign it to you. Thank you for your understanding and support!

@janicezyt
Copy link

Can I work on this?

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 good first issue Good for newcomers needs PR Ready to be worked on
Projects
None yet
Development

No branches or pull requests

10 participants