I am using Flask do develop a web app to visualize data retrieved from a database. I want to include a chart which requires a Jinja for loop to accomplish population of the chart. When I place the for loop inside the JavaScript <script> tag in an .html document VS Code shows a syntax error. It's fine outside the <script> tag. I tried the exact same code in Eclipse and receive no formatting error. I have also noticed that Jinja text tags such as '{{label}}' can be entered inside JavaScript with no syntax error showing.
screen shot of syntax error in VS Code
I have spent a lot of development time in VS Code and would prefer to not have to switch IDEs at this stage. Any help would be greatly appreciated.