microsoft / vscode-edge-debug2

This is a VS Code extension which helps you debug your JavaScript Code inside the Edge browser.
Other
37 stars 31 forks source link

Question: How to start to debug in the same open instance of Edge Chromium? #169

Closed mbv401920150 closed 4 years ago

mbv401920150 commented 4 years ago

With the documentation, I was able to open a new Browser instance without any of my extensions (Like React DevTools and Redux DevTools)... I just want to attach or start listen to a tab of my existing https://localhost:44380/ (The port will be any)...

Exists a configuration just config the Extension to listen to an existing open tab?

dhanvikapila commented 4 years ago

@mbv401920150 When we start the browser we start the browser with the a debug port (different from your application port) and a user-data-dir to ensure that a new instance of the browser starts up with debugging enabled for your web application. Once you install your extensions in this instance of the browser they will persist and will be available the next time you start debugging.

If you would like to use your tab instead of having the extension open a new instance, you will need to attach instead of launch in your launch.json.

Please note that for attach to work, you will need to start the browser separately with the debug port specified. You will need to specify this debug port in your launch.json as well. In Chrome (and new Edge), if you have a browser window open and use the command line to start a new instance of the browser with a debug port, it will not work. Chrome will open a new window but it will not have debugging port enabled. In this case, you will to close all instance of your browser and use the command line to start your browser, unless you also specify the user-data-dir argument.

Here is a valid command line to start the browser with debugging port enabled (and user-data-dir) on Windows - "\Program Files (x86)\Google\Chrome\Application\chrome.exe" --remote-debugging-port=8787 --user-data-dir=\tmp\foo-buzz https://www.google.com

You can see samples for launch.json to attach here.