You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a django app and customized my djangoadmin runserver command to also start a vite debugging server for my frontend.
Therefor when starting my debugging server I get two url's in my stdout of djangoadmin runserver.
Problem
When I want to use the autoStartBrowser:true option of my debugpy setup to automatically start a browser, it starts the wrong URL. So my vite server-URL is started in the Browser instead of my django webpage.
Sugested solution
Add an additional setting to customize the startup URL. E.g.:
Hi! Sent some messages in the PR thread but better news is I think we already have a solution that may work for you! There is a option to configure serverReadyAction which is built-in and works for all debug configs. This is the doc about it: https://code.visualstudio.com/Docs/editor/debugging#_automatically-open-a-uri-when-debugging-a-server-program. I gave it a try on my side and it seemed to do the correct thing so let me know if it works for you! Thanks
Hmm yeah that is a valid alternative to work with. So basically this sets the serverReadyAction manually, whereas the proposed autoStartBrowserURL would do this automatically
looping in Connor Peet (@connor4312) since he is the expert of this setting, wondering if he has any advice to make it automatic or better for your use case
Yea. I don't know how the Python implementation of autoStartBrowserURL works, but serverReadyAction might work for you. It's quite manual and explicit but it should be reliable.
maybe serverReadyAction should support AI power in the future to figure out the URL from program output magically, but we aren't there right now :)
Hi! I have put in a fix for this so it doesn't overwrite the setting if present, Max Schmit (@maxschmi) if you are able to get the most recent pre-release version of the vscode python debugger (latest released should say this morning) and give it a try to let me know if that works that would be great, thanks!
I'm not so sure what to test. I did install the latest pre-release, but the "autoStartBrowserURL" option is not available. But I guess you decided against the pattern option.
The "serverReadyAction" is executed, but unfortunatly is not detecting or not using the correct port, but instead uses 3000 as a port.
As far as I see, the "autoStartBrowser" option is more less ignored. Is that the excpected outcome?
The fix was just so serverReadyAction is not longer overwritten as it was in the past. Therefore user configuration of this will be respected. Per Connor's suggestion I was wondering if configuring using this, although manual, could be a substitute for the URL setting you want. If not then I will turn this into a feature request and we can go in that direction
Activity
eleanorjboyd commentedon Feb 13, 2025
Hi! Sent some messages in the PR thread but better news is I think we already have a solution that may work for you! There is a option to configure
serverReadyActionwhich is built-in and works for all debug configs. This is the doc about it: https://code.visualstudio.com/Docs/editor/debugging#_automatically-open-a-uri-when-debugging-a-server-program. I gave it a try on my side and it seemed to do the correct thing so let me know if it works for you! Thanksmaxschmi commentedon Feb 14, 2025
Hmm yeah that is a valid alternative to work with. So basically this sets the serverReadyAction manually, whereas the proposed
autoStartBrowserURLwould do this automaticallyeleanorjboyd commentedon Feb 14, 2025
looping in Connor Peet (@connor4312) since he is the expert of this setting, wondering if he has any advice to make it automatic or better for your use case
connor4312 commentedon Feb 14, 2025
Yea. I don't know how the Python implementation of autoStartBrowserURL works, but
serverReadyActionmight work for you. It's quite manual and explicit but it should be reliable.maybe
serverReadyActionshould support AI power in the future to figure out the URL from program output magically, but we aren't there right now :)eleanorjboyd commentedon Feb 14, 2025
The python implementation you mean from debugpy or from the debugger extension? I looked and the debugger passes on the arguments without editing
eleanorjboyd commentedon Feb 14, 2025
looping in Rich Chiodo (@rchiodo) as well
rchiodo commentedon Feb 14, 2025
AFAIK, debugpy doesn't handle the autoStartBrowser configuration. The extension does here:
vscode-python-debugger/src/extension/debugger/configuration/resolvers/launch.ts
Lines 149 to 156 in 4d27e65
Not sure if that means the serverReadyAction wouldn't work because there would be duplicates?
connor4312 commentedon Feb 15, 2025
Yea, looks like that would overwrite
serverReadyActionif presenteleanorjboyd commentedon Mar 4, 2025
Hi! I have put in a fix for this so it doesn't overwrite the setting if present, Max Schmit (@maxschmi) if you are able to get the most recent pre-release version of the vscode python debugger (latest released should say this morning) and give it a try to let me know if that works that would be great, thanks!
maxschmi commentedon Mar 5, 2025
Hey Eleanor Boyd (@eleanorjboyd)
I'm not so sure what to test. I did install the latest pre-release, but the "autoStartBrowserURL" option is not available. But I guess you decided against the pattern option.
If I have :
The "serverReadyAction" is executed, but unfortunatly is not detecting or not using the correct port, but instead uses 3000 as a port.
As far as I see, the "autoStartBrowser" option is more less ignored. Is that the excpected outcome?
eleanorjboyd commentedon Mar 7, 2025
The fix was just so
serverReadyActionis not longer overwritten as it was in the past. Therefore user configuration of this will be respected. Per Connor's suggestion I was wondering if configuring using this, although manual, could be a substitute for the URL setting you want. If not then I will turn this into a feature request and we can go in that directionmaxschmi commentedon Mar 7, 2025
Hey,
Yeah the
ServerReadyActionis definitely enough, so theautoStartBrowserURLis not needed in my opinion.