[Video] Learn how to debug web projects end-to-end in VS Code in 5 minutes
Tags: debugging, javascript, dom, css
Published: 2021-08-09 21:02:21

---
title: [Video] Learn how to debug web projects end-to-end in VS Code in 5 minutes
published: true
description: Visual Studio Code now offers all you need to debug JavaScript, the DOM and CSS without leaving it.
tags: debugging, javascript, dom, css
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/djah5cqkesux4ioyo2t9.png
canonical_url: https://christianheilmann.com/2021/08/09/video-learn-how-to-debug-web-projects-end-to-end-in-vs-code-in-5-minutes/
---

This weekend I released a video on the [YouTube Channel](https://www.youtube.com/channel/UCs5Y5_7XK8HLDX0SLNwkd3w) of [Visual Studio Code](https://code.visualstudio.com) that shows end-to-end web project debugging. 

{% youtube vRNdnv_-X18 %}

In five minutes I walk through debugging a web project bit by bit:

* I open a project inside VS Code by opening its folder. The demo used is a simple, plain Vanilla JS/CSS/HTML ToDo app you can [download/fork on GitHub](https://github.com/codepo8/simple-to-do).
* I open a Terminal inside VS Code and start a local server. I use the server that comes with PHP as it already on my computer (for now - MacOS will soon deprecate this option)
* Instead of opening the project in the browser, I use the [run and debug workflow](https://code.visualstudio.com/docs/nodejs/browser-debugging) of VS Code to open a dedicated browser instance to debug this project with. If I have a Chromium based browser on my device and have it set as my default browser, this will be the one VS Code uses. In my case, this opens a new window of Microsoft Edge, as this is my main browser on this MacOS computer (yes, it runs on Mac for over 1.5 years now). I use Edge to show extra functionality later that is only supported in this Chromium based browser.
* Having a dedicated browser instance also means that I get the [Browser Developer Tools Console](https://docs.microsoft.com/microsoft-edge/devtools-guide-chromium/console/) functionality now inside the Debug Console of Visual Studio Code. The Debug Console shows any [console.log](https://docs.microsoft.com/en-us/microsoft-edge/devtools-guide-chromium/console/console-log) messages from my JavaScript and I can also interact with the document in the browser using the [Console convenience methods](https://docs.microsoft.com/microsoft-edge/devtools-guide-chromium/console/utilities) like `$` for `querySelector()`. I have full access to the window object and can change the DOM and the styles of the document in a programatic way.
* In addition to console.log() debugging I also have the opportunity to use [breakpoint debugging](https://code.visualstudio.com/Docs/editor/debugging) instead, which gives me a lot more insight and also has the benefit of halting the execution of my script until I found out what's going on.
* As I am using Microsoft Edge as the debugging browser I also get an inspect button on the debugger toolbar. This one gives me access to the Edge Developer Tools right inside Visual Studio Code. This functionality is powered by the [Edge Tools for VS Code](https://aka.ms/devtools-for-code) extension which gets installed for me the first time I select the inspect button
* Once the extension runs, I can access and change the DOM and the CSS of the current project right inside Visual Studio Code using the same tools I normally use in the browser. 
* I also have access to the Network tool to inspect any Network requests and see if there are any issues of content not being loaded.
* In order to automate the process of starting the browser and opening the localhost address next time, I can also get the debugger extension to generate a launch.json file for me. Once I have that, next time all of the above happens automatically.

If you want to learn more about the JavaScript debugger in VS Code, you can check the documentation here or talk to [Connor Peet](https://twitter.com/connorpeet) on Twitter. For the Edge DevTools for VS Code integration you can [read the extension documentation](https://docs.microsoft.com/en-us/microsoft-edge/visual-studio-code/microsoft-edge-devtools-extension) and [check the code on GitHub](https://github.com/microsoft/vscode-edge-devtools). We're also welcoming filing any issues on GitHub and you can talk to me, [codepo8](https://twitter.com/codepo8) on Twitter or the team at [EdgeDevTools](https://twitter.com/edgedevtools)

A special thank you to the team involved in all this work, James Lissiak, Michael Liao, Vidal Guillermo Diazleal Ortega, Brandon Goddard, Olivia Flynn, Tony Ross, Rob Paveza, Jason Stephen, Connor Peet and of course the VS Code team.