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

Make "internalConsoleOptions": "openOnSessionStart" easy to use #146102

Closed
1Mark opened this issue Mar 26, 2022 · 4 comments
Closed

Make "internalConsoleOptions": "openOnSessionStart" easy to use #146102

1Mark opened this issue Mar 26, 2022 · 4 comments
Labels
*caused-by-extension Issue identified to be caused by an extension

Comments

@1Mark
Copy link

1Mark commented Mar 26, 2022

fyi @sandy081 @isidorn
microsoft/vscode-python#6159 introduced "internalConsoleOptions": "openOnSessionStart" but using this via one of the pre-existing python debug configurations doesn't work out of the box since it has a constraint.

Start debugging a new project or file, it will ask you to choose a debug config
2022-03-26 12_53_46-Window

If you choose this first option it gives

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true
        }
    ]
}

Then you realise you want the debug console to open automatically when you start the debugging, you come across microsoft/vscode-python#6159
then you add this to your config and

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true,
            "internalConsoleOptions": "openOnSessionStart"
        }
    ]
}

Which doesn't work since

"purpose": [
    "debug-test"
    ],

Isn't in the default config.

Several requests

  1. Make it the default to always launch the debug console
  2. Make it clear in the docs (and in the hints in vscode) that internalConsoleOptions must be used with
"purpose": [
    "debug-test"
    ],
  1. Add a new debug configuration just for debugging tests and make it be
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Debug Tests",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "purpose": [
                "debug-test" // the main requirement
            ],
            "console": "integratedTerminal",
            "justMyCode": false, // not bothered about this value
            "internalConsoleOptions": "openOnSessionStart" // the main requirement
        }
    ]
}

Here is a diff compared to the existing one Python File Debug the currently active Python file
image

  1. Update the existing Python File Debug the currently active Python file config to include. This is somewhat controversial but although it's incorrect, purpose works both for tests and debug file and therefore there is no downside by doing this.
"purpose": [
    "debug-test"
    ],
  1. Maybe remove this constraint for
"purpose": [
    "debug-test"
    ],

Since I don't see how this is related to launching the Debug console.

@weinand
Copy link
Contributor

weinand commented Mar 27, 2022

/extPython

@weinand weinand removed their assignment Mar 27, 2022
@weinand
Copy link
Contributor

weinand commented Mar 27, 2022

VS Code's "internalConsoleOptions": "openOnSessionStart" setting has no "constraint".
If there is a constraint, then this is introduced by the Python extension.

@1Mark
Copy link
Author

1Mark commented Mar 27, 2022

VS Code's "internalConsoleOptions": "openOnSessionStart" setting has no "constraint". If there is a constraint, then this is introduced by the Python extension.

Created new issue here microsoft/vscode-python-debugger#529

@github-actions github-actions bot locked and limited conversation to collaborators May 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*caused-by-extension Issue identified to be caused by an extension
Projects
None yet
Development

No branches or pull requests

3 participants
@weinand @1Mark and others