Go to extension on vscode type "open in browser" in search bar install open in browser extension.
after installation go to editor on hold control button on keyboard and press mouse key
search open in browser in the search bar click on open in browser:this file and file will run on your machine default browser. make sure default browser on your machine is safari.