Closed DonJayamanne closed 6 months ago
How do you know what port to open? Would we prompt for that and then just open localhost
? Would you specify in your launch.json
, but then how do you keep it synced with the code? Would probably require people specifying the URL to launch in launch.json
.
To help manage our issues and to better communicate what the team plans to work on we are closing issues that we don't plan to work on but would accept a pull request from a volunteer for. To be clear, closing this issue does not mean we won't consider a pull request for this enhancement as outlined in our contributing guide, just that the development team has no plans to work on it themselves.
Re-opening as other extensions are looking at doing this, C# extension does this today (or are in the process of doing this). They are scraping the debugger output to extract the url.
Also, it makes sense, i.e. when you start debugging a web application the next logical step is to open a browser.
We would need to figure out how this would work in remote scenarios.
We might want to implement this at least for local debugging and consider a seprate issue for remote scenarios.
FYI - Its just a configuration setting in launch.json
, not typescript code etc..
serverReadyAction
(https://code.visualstudio.com/docs/editor/debugging#_remote-debugging)Update default launchjson for django
& flask
in
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/app.js",
"serverReadyAction": { "pattern": "listening on port ([0-9]+)", "uriFormat": "http://localhost:%s", "action": "openExternally" } }
I have another issue here with regex for Django and Flask.
@karthiknadig Can you elaborate on that?
Flask outputs comes out to be something like this,
* Serving Flask app "app.py"
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
So I am planning to use,
"serverReadyAction": {
"pattern": "Running on http://([0-9]+[.][0-9]+[.][0-9]+[.][0-9]+:[0-9]+)",
"uriFormat": "http://%s",
"action": "openExternally"
}
Similar for django. By observation, it looks like we'll have http://number.number.number.number:<number>
present. So having that as default seems fine to me. Any objections? @karthiknadig @ericsnowcurrently @DonJayamanne
See here for patterns that worked for me: https://github.com/microsoft/vscode-python/issues/5192#issue-431688484
Note: that it may not always be 127.0.0.1
, host can be localhost
, loopback
, etc. Also, "Running on" may not be there in some cases. SSL can be enabled on those frameworks as well, so just http
is not enough either. The pattern in my comment has limitations too, for example it does not handle IPv6 host, but it should be a good starting point to test.
@Anapo14 Spec for this is done right?
Changes will be here https://github.com/microsoft/vscode-python/blob/master/src/client/debugger/extension/configuration/resolvers/base.ts. If user is in experiment, look at the same markers (django, flask, pyramid, jinja), see if serverReadyAction is openExternally, replace value with:
Add logging and telemetry for this change.
Adding this issue here to the Python Debugger repository.
Investigate the possibility of launching the browser once a django/flask app has been started
Some other IDEs (PTVS) do this today