microsoft / vscode-python-debugger

Python debugger (debugpy) extension for VS Code.
https://marketplace.visualstudio.com/items?itemName=ms-python.debugpy
MIT License
41 stars 17 forks source link

TPI: Improve debug config selection in Django #279

Closed paulacamargo25 closed 3 months ago

paulacamargo25 commented 3 months ago

Refs: https://github.com/microsoft/vscode-python-debugger/issues/161

Complexity: 3

Create Issue


Automatically detect a Django file, and show it.

Steps

  1. Open a Django Project if you already have one or you can also create one following the steps in the Django Tutorial.

  2. Head over to the Run And Debug tab, and click on create a launch.json file.

    Screenshot 2024-03-24 at 11 31 32 AM
  3. A window will open with a list of options, choose Python Debugger > Django.

Verification

  1. Valid django file
    1. Verifies that your manage.py file was found correctly and is displayed in the list.
    2. When you hover the item, verify that there is a button to open the file and that it works correctly.
    3. Select this option and verify that a launch.json configuration is created with the choose option.
  2. Invalid django file (you can delete or change the name of the file)
    1. Since no file was found, verify that a Default option is displayed.
    2. Select this option and verify that a launch.json configuration is created with the choose option.
  3. Browse a file
    1. Click on the option Browse Files... and select the file that you want.
    2. Verify that a launch.json configuration is created with the choose option, and that the path has been parsed correctly.
  4. Add own value
    1. You can also include your own text, type a path in the input box and press enter.
    2. Verify that a launch.json configuration is created with the choose option.

Notes

Django's application detection works by looking for the manage.py/app.py file in the root or in a subdirectory just one level lower. So you can try moving the manage.py file one level lower and check that it still appears.

chrmarti commented 3 months ago

@bhavyaus @aeschli Note that currently the extension is only published for a subset of platforms (#282). You can download the latest for testing from the latest (red) build for the main branch at https://dev.azure.com/monacotools/Monaco/_build?definitionId=499.