Table of contents :

Visual Studio Code logo

6. VSCode, plugin: Live Server.
    and using the Go-Live button.


First you need to install the Live Server plugin. The following picture shows my version, which is already installed. So there is no Install button, just a disable and an uninstall button.
Visual Studio Code, Live Server Plugin.
Visual Studio Code, Live Server Plugin.
After installing the Live Server plugin, you can see the Go-Live button near the bottom-right of the window:

Visual Studio Code, Live Server Plugin, Go-Live button.
Visual Studio Code, Live Server Plugin, Go-Live button.
Some short warnings,
First:
When you start Live Server for the very first time, it is possible Windows Defender gives a warning. If that happens, just click Allow to proceed.

Second:
When you get a message saying something about invalid path, you have to check your live server settings to correct the paths.

Third:
When you start Live Server, it opens a browser window in the last window you used (your mouse was inside). So make sure that is the window you want, or open a new empty window before starting the server.

Fourth:
Make sure you have a main directory selected in the Editor, and make sure there is a default webpage inside that directory. That could be a very simple index.html file or any other file a browser accepts as a default webpage. (index.php or sometimes default.html or home.html)

When everything is ready you click on the Go-Live button. After that you see:
Visual Studio Code, Live Server Plugin, Server started.
Visual Studio Code, Live Server Plugin, Server started.
You get a message that the server is started. You can click that away with the tiny cross in the top-right corner, or make it disappear forever by the blue button. It also mentions the port that was used in the status bar. (Port:5500) in this case.

The url of your browser window will look like this:
Visual Studio Code, Live Server Plugin, browser window.
Visual Studio Code, Live Server Plugin, browser window.
My browserwindow mentiones localhost and not something like: 127.0.0.1, thats because I changed the value of liveServer.settings.host in the Live Server Settings.

Visual Studio Code, Live Server Plugin, setting the hostname.
Visual Studio Code, Live Server Plugin, setting the hostname. See:
Live Server, setting hostname.
There are more settings for the Live Server plugin, for instance the directory to watch:
Visual Studio Code, Live Server Plugin, setting the root.
Visual Studio Code, Live Server Plugin, setting the root. See:
Live Server, setting root.

How to stop and or restart the Live Server?

Stopping the server is done by clicking on the Port:5500 in the bottom bar. For a very short time you can see the following message:

Visual Studio Code, Live Server Plugin, stop - start.
Visual Studio Code, Live Server Plugin, stop - start.
After that you get the message that the server is offline.
Visual Studio Code, Live Server Plugin, stopped, offline.
Visual Studio Code, Live Server Plugin, stopped, offline.