The instructions below walk you through the basic steps to get started with this debugger.
Before you start
Debug an application that is running on the built-in server
GoLand has a built-in web server that can be used to preview and debug your application. This server is always running and does not require any manual configuration. All the project files are served on the built-in server with the root URL http://localhost:<built-in server port>/<project root>, with respect to the project structure.
From the context menu of the editor or the selection, choose Debug <HTML_file_name>. GoLand generates a debug configuration and starts a debugging session through it. The file opens in the browser, and the Debug tool window appears.
Let's suppose that you have a simple application that consists of an index.html file and an index.js file, where index.html references index.js. To start debugging this application using the built-in server, open index.html in the editor and choose from the context menu.
GoLand creates a run/debug configuration automatically, and a debugging session starts.
To restart the new run/debug configuration, click the Debug button () in the upper right-hand corner of the GoLand window or select from the main menu.
Reload the current page in browser
Besides restarting your application by clicking the Rerun button () in the Debug tool window, you can also click the Reload in Browser button () to reload the page where you have currently navigated. This works the same way as the Reload Page functionality (Ctrl+R) in Chrome.
During a debugging session, clicking the Rerun button () would reload the home.html page with the Submit button. Clicking the Reload in Browser button () reloads the calculator.html page so all the previous script output is cleared and the debugger returns to line 1 in Calculator.js.
Debug an application that is running on the localhost in the development mode
If your application is running in the development mode on
localhost, you can start debugging it from the built-in Terminal (Alt+F12), from the Run tool window, or from the Debug tool window. Just hold Ctrl+Shift and click the URL at which the application is running.
Set the breakpoints in your code.
Start the application in the development mode, for example, using an npm script.
Debug an application that is running on an external web server
Run the application in the development mode. Often you need to run
npm startfor that.
When the development server is ready, copy the URL address at which the application is running in the browser - you will need to specify this URL address in the run/debug configuration.
Select the newly created configuration from the Select run/debug configuration list on the toolbar and click the Run button () next to the list. The URL address specified in the run configuration opens in the browser and the Debug tool window appears.
GoLand supports debugging Service Workers and Web Workers. GoLand recognizes breakpoints in each worker and shows the debug data for it as a separate thread in the Frames pane on the Debugger tab of the Debug tool window.
Set the breakpoints in the Workers to debug.
If you are using Service Workers, make sure the Allow unsigned requests checkbox is selected on the Debugger page ( ). Otherwise your service workers may be unavailable during a debug session.
Select the newly created configuration from the Select run/debug configuration list on the toolbar and click the Debug button () next to the list.
The HTML file specified in the run configuration opens in the browser and the Debug tool window opens with the Frames list showing all the Workers:
To examine the data (variables, watches, and so on) for a Worker, select its thread in the list and view its data in the Variables and Watches panes. When you select another Worker, the contents of the panes are updated accordingly.