microsoft / vscode-azurestaticwebapps

Azure Static Web Apps extension for VS Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestaticwebapps
MIT License
86 stars 33 forks source link

Add a setting for configuring SWA Run Debug Config browser selection #768

Open OliverUlm opened 1 year ago

OliverUlm commented 1 year ago

Currently it seems that the extension is using the npm package "open" to launch the browser for debugging with it's default settings. Therefore it always trys to launch Google Chrome. Typically I want to have some amount of control of which browser to use (in my case it would be MS Edge). The open package currently supports parameters to launch Chrome, Edge or Firefox, so it would be greatly appreciated if this could be surfaced as a setting for the Visual Studio Extension.

Currently I simply have to fall back to launching the function from the VS Code debugger, launching the frontend from the Angular CLI and debugging that in der Browser. I don't think that's the intended experience.

alexweininger commented 1 year ago

The extension launches Google Chrome because it uses the pwa-chrome configuration type by default. Until we add a setting for configuring this, you can configure it manually by following these steps.

When selecting debug configuration, click the Gear icon to add the configuration to your local workspace. Screenshot 2022-12-07 at 4 15 30 PM

Once that is done, you can edit the configuration to change type from pwa-chrome to msedge. For example, here is what my launch config looked like after I did this.

{
    "configurations": [
        {
            "name": "SWA: Run angular-basic-1",
            "request": "launch",
            "type": "msedge",
            "url": "http://localhost:4280",
            "preLaunchTask": "swa: start angular-basic-1",
            "webRoot": "${workspaceFolder}/",
            "timeout": 30000
        }
    ]
}