0

I'm facing an issue with debugging a Python Flask project in Visual Studio 2022 that involves JavaScript code. I've created a small project using the built-in Python Flask template. The problem I'm encountering is related to debugging JavaScript code.

Here's what's happening:

  • When I set a breakpoint in the Python code, the breakpoint works as expected.
  • If I set a breakpoint in the embedded JavaScript code within the HTML template, the breakpoint also works fine.
  • However, when I create a separate .js file containing JavaScript code and import it into the HTML template, setting breakpoints in this external JavaScript code doesn't work, and the execution doesn't stop.

I've verified that the JavaScript code in the .js file is executing (I added a console.log statement). I've tested this issue on Chrome, Edge, and Firefox, and launched Chrome and Edge in debug mode using --remote-debugging-port=9222. I confirmed that the debug mode is active using http://localhost:9222/json/version. I've also connected Visual Studio 2022 to both browsers using "Debug/Attach to Process...". I've tried running Flask with both debug=True and debug=False, and I've attempted debugging in both Debug and Release modes. I´ve enabled and disabled the "Enable Just My Code".

Despite trying these steps, I haven't been able to make the breakpoints in the external JavaScript file work during debugging.

Microsoft Visual Studio Enterprise 2022 (64-bit) Version 17.7.1

Question: Is there a solution to enable full debugging functionality from Visual Studio 2022, avoiding the need to manually set breakpoints within the browser, including ´.js´ files from static assetts?

1 Answer 1

0

Why not use Visual Studio Code? VS Code has a very mature environment for JavaScript and TypeScript debugging, including the use of the Chrome Debugger extension. Visual Studio is developed more for C and .net devs.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, Ezio, but your response doesn't directly address my question. We work collaboratively organization widely, and our hierarchy prefers this IDE.
I see, you can just open the project using vs code for debugging purposes, it's tricky on vs and I have little exp with it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.