Since it is usually a Python development, F5 debugging runs on Python in a Python virtual environment.
It also automates documentation with Powershell scripts.I used CodeRunner to run the Powershell script, but the script that was running so far failed for some reason, so I wanted to debug it and chase it.
However, if you open the Powershell script and click Run - > Start Debugging as the current file, you will try to run it as a Python script.
Runtime Terminal View
(ENV)PS [Current Folder] > cd '[Current Folder] '; & '[Current Folder]\ENV\Script\python.exe' [(omitted)..\pythonFiles\lib\debugpy\adapter/../..\debugpy\launcher] '55292' ' --' [Current File]'
The current file above is the ps1 file in this case.
·Determine the ps1 file and run Powershell debugging
·Determine the py file and execute Python debugging
This is a consultation about whether it is possible to create an environment where
{
// Use IntelliSense to learn the available attributes.
// Displays a description of an existing attribute by hovering.
// For more information: 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
}
]
}
{
"esbonio.server.enabled": true,
"esbonio.spinx.confDir":",
"restructuredtext.preview.name": "docutils",
"files.encoding": "utf8bom"
}
If you use Powershell very rarely, I think it's simple to add a Powershell configuration to launch.json
and select from the combo box to the right of Run and Debug in the upper left corner of the `launch.json screen
Automatic file determination with extensions can be accomplished by using the Command Variable extension.
In the launch.json
example below, you can automatically determine .ps1
and .py
by selecting Debug Python or Powershell from the combo box to the right of Run and Debug.
However, the terminal does not switch automatically, so you need to manually switch from the vertical tab in the lower right corner of the screen.
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File if.py",
"type": "python",
"request": "launch",
"program": "${input:file_if_python}",
"console": "integratedTerminal",
"justMyCode"—true
},
{
"name": "PowerShell: Current File if.ps1",
"type": "PowerShell",
"request": "launch",
"script": "${input:script_if_powershell}",
"cwd": "${input:script_if_powershell}"
}
],
"compounds": [
{
"name": "Debug Python or Powershell",
"configurations": ["Python: Current File if.py", "PowerShell: Current File if.ps1" ]
}
],
"inputs": [
{
"id": "file_if_python",
"type": "command",
"command": "extension.commandvariable.file.fileAsKey",
"args": {
".py": "${file}",
".ps1": "${workspaceFolder}\\.vscode\\dummy"
}
},
{
"id": "script_if_powershell",
"type": "command",
"command": "extension.commandvariable.file.fileAsKey",
"args": {
".ps1": "${file}",
".py": "${workspaceFolder}\\.vscode\\dummy"
}
}
]
}
References
578 Understanding How to Configure Google API Key
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
619 Uncaught (inpromise) Error on Electron: An object could not be cloned
582 PHP ssh2_scp_send fails to send files as intended
916 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.