Using Live Server with Developer Tools in Visual Studio Code (2024)

Tuesday, November 22nd, 2022 at 9:52 pm

Using Live Server with Developer Tools in Visual Studio Code (1)

By using the Edge DevTools extension together with Live server in VS Code you don’t only get a server that shows your changes live in the browser, but a browser and developer tools right in the editor

The Live Server extension for Visual Studio code has been installed 25M times and is incredibly useful. It enables you to right-click an HTML document, and it runs a server for you and opens a browser window with the file in it. Any changes you make to the file causes the browser to reload and you can immediately see them – hence “live server”.

The problem is that you still have to jump in between the editor and the browser if you want to debug the project using the browser developer tools.

If you use the Edge DevTools for VS Code in addition to live server, you don’t have that problem. Instead you can:

  • Get a live preview of changes to the file in a browser window right inside VS Code
  • Use the browser developer tools and automatically sync the changes with your source files
  • Get information about issues in your code and how to fix them
  • Get a Console to try out JavaScript or see your `console.log()` messages right in VS Code

You can see this in action in the following video:

The process is not quite straight forward yet, but we’re working on it.

  • Right-click the file you want to open and choose “Open with live server”
  • Copy the location from the URL bar of the browser tab that Live server opened
  • Go back to VS Code and right-click the same file, this time choosing “Open with Edge” and either “Open Browser” or “Open browser with DevTools”
  • In the browser panel that opens, paste the URL from earlier
  • … and that’s it.

What could be done to make that easier? You can chime in on this issue on GitHub to give us some ideas .

Using Live Server with Developer Tools in Visual Studio Code (2024)

FAQs

Using Live Server with Developer Tools in Visual Studio Code? ›

Open a HTML file and right-click on the editor and click on Open with Live Server . Open the Command Pallete by pressing F1 or ctrl+shift+P and type Live Server: Open With Live Server to start a server or type Live Server: Stop Live Server to stop a server.

How to use live server with Visual Studio Code? ›

Open a HTML file and right-click on the editor and click on Open with Live Server . Open the Command Pallete by pressing F1 or ctrl+shift+P and type Live Server: Open With Live Server to start a server or type Live Server: Stop Live Server to stop a server.

How do you use live share in VS Code? ›

Click the Live Share button in your status bar, which will share your project, and copy a unique session URL to your clipboard. You'll be asked to sign in the first time you share (using a GitHub or Microsoft account), which allows others to identity you when collaborating.

Why is my live server not working in Visual Studio Code? ›

Live Server extension not installed: Ensure that you have the Live Server extension installed in Visual Studio Code. You can check by going to the Extensions view ( Ctrl+Shift+X or Cmd+Shift+X ), searching for "Live Server," and verifying if it's installed. If not, install it and restart VS Code.

How to connect live server in Visual Studio Code to Chrome? ›

Search for the "Live Server" extension and install it. This extension will help to launch a local server to run your project in Chrome. Once the extension is installed, open your project folder in VSCode. Right-click on the file you want to open in Chrome and select "Open with Live Server".

Why is CSS not working on server? ›

The problem may be that your browser is caching the CSS file. If you're debugging with Edge, you can open the F12 tools and click on the Network tab. At the top, you'll find a button to “always refresh from server.” Turn this on, and files won't be cached. Chrome has a similar feature.

How to run HTML CSS and JavaScript together in Visual Studio Code? ›

Running JavaScript with HTML

In VS Code, create an HTML file and then add the script tags to it. Within the script tags, JavaScript code is permissible. Open the HTML file in the browser after saving the modifications. Right-clicking the mouse in the browser and choosing the Inspect option will open the inspect window.

How to create website using HTML and CSS in Visual Studio Code? ›

To build a webpage with Visual Studio Code, you will need to create an HTML file, a CSS file, and a JavaScript file. The HTML file will contain the content of your webpage, the CSS file will be used to style the content, and the JavaScript file will be used to add interactivity to your webpage.

How do I enable debugging in live share? ›

Using collaborative debugging is simple.
  1. Be sure the host and all guests have the appropriate debugging extension installed. ...
  2. The host, if not already set up for the project, should configure launch. ...
  3. The host can start debugging by using the button on the debug tab, as normal:
Jan 26, 2022

What is the live code in VS Code? ›

VSCode LiveCode Extension

A basic Visual Studio Code extension that allows other programmers to follow along as I code. When activated, this extension pushes all saved code changes to a LiveCode API. Files are made available to followers in plain text to allow for easy reading and copying and pasting during streaming.

What is Web Live Preview Visual Studio? ›

Wrap-Up. As you can see Web Live Preview is a powerful UX usability tool which offers some of the great features of the browser's Developer Tools (DevTools): You can select HTML elements and controls which will automatically synchronize Visual Studio.

How do I preview my work in Visual Studio Code? ›

Tip: You can also right-click on the editor Tab and select Open Preview (Ctrl+Shift+V) or use the Command Palette (Ctrl+Shift+P) to run the Markdown: Open Preview to the Side command (Ctrl+K V).

How does live preview work? ›

Live preview is a feature that allows a digital camera's display screen to be used as a viewfinder. This provides a means of previewing framing and other exposure before taking the photograph.

How do I open VS Code live server in VS Code? ›

Install the Live Server extension from Marketplace. You can find it in the VS Code Activity Bar. Open your project by either clicking “File” and “Open File” or using keyboard shortcuts, as you prefer. Right-click an HTML file in the project and choose “Open with Live Server” from the context menu.

What is Visual Studio Code Live server? ›

An extension that hosts a local server for you to preview your web projects on! This extension is most useful for projects where a server is not already created (e.g. not for apps using React, Angular, etc.). To work with these, feel free to run the Simple Browser: Show command that is already built-in with VS Code.

Top Articles
Latest Posts
Article information

Author: Edwin Metz

Last Updated:

Views: 6387

Rating: 4.8 / 5 (78 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Edwin Metz

Birthday: 1997-04-16

Address: 51593 Leanne Light, Kuphalmouth, DE 50012-5183

Phone: +639107620957

Job: Corporate Banking Technician

Hobby: Reading, scrapbook, role-playing games, Fishing, Fishing, Scuba diving, Beekeeping

Introduction: My name is Edwin Metz, I am a fair, energetic, helpful, brave, outstanding, nice, helpful person who loves writing and wants to share my knowledge and understanding with you.