CLion 2016.3 Help

Run/Debug Configuration: JavaScript Debug

In this dialog box, create a configuration to be used for debugging JavaScript sources locally and remotely and for debugging Dart Web applications.

  1. Local debugging. In this mode, the application files remain where they are in the CLion project on you machine. CLion runs them on the built-in Web server with the root URL http://localhost:<built-in server port>/<project root>. The built-in server port (1024 or higher) is specified on the page of the Settings dialog box. A debugging session in this mode can be initiated in two ways:
    • Open the HTML file with the JavaScript injection to be tested and launch the temporary run/debug configuration that CLion has generated automatically. This approach it helpful when you do not need to debug the entire application but just one script.
    • Create and launch a permanent debug configuration.
  2. Remote debugging. In this mode, the application files are on an external web server and you have their copies in a CLion project on your computer. No matter, whether the web server itself is running on a physically remote host or on your machine, application files deployed on it are treated as remote. For details, see Working with Web Servers: Copying Files.

    You can deploy the application files to a web server and launch the application yourself or debug an already running application.

    When a remote HTML file with a JavaScript injection is opened, the debugger tells CLion the name of the currently processed file and the number of the line to be processed. CLion opens the local copy of this file and indicates the line with the provided number. This behaviour is enabled by specifying correspondence between files and folders on the server and their local copies. This correspondence is called mapping, it is set in the debug configuration.

    A Remote debugging session can be initiated only through a permanent debug configuration that you have to define yourself manually.

CLion supports local and remote JavaScript debugging only in Google Chrome and other browsers of the Chrome family. In Firefox, remote debugging is not supported at all. Local debugging is supported for Firefox, version 36 an higher, through the Firefox Remote debug configuration.

CLion supports local and remote JavaScript debugging only in Google Chrome and other browsers of the Chrome family. In Firefox, remote debugging is not supported at all. Local debugging is supported for Firefox, version 36 an higher, through the Firefox Remote debug configuration.

On this page:

JavaScript Debug-specific configuration settings

ItemDescription
NameIn this text box, specify the name of the current run/debug configuration.
Share Select this check box to make the run/debug configuration available to other team members.

The shared run/debug configurations are kept in separate xml files under .idea\runConfigurations folder, while the local run/debug configurations are kept in the .idea\workspace.xml.

This check box is not available when editing the run/debug configuration defaults.

URL
  • Debugging JavaScript:

    In this text box, specify the URL address of the HTML file that references the JavaScript to debug. For local debugging, type the URL in the format http://localhost:<built-in server port>/<project root>. The built-in server port (1024 or higher) is specified on the Run/Debug Configuration: JavaScript Debug page of the Settings dialog box.

  • Debugging a Dart Web application:

    In this text box, specify the URL address of the HTML file the references the Dart code to debug. Make sure that the port specified in this URL address is the same as the Built-in server port on the Debugger page of the Settings dialog box and the port specified in the settings for the Chrome Extension.

Browser From this drop down list, select the browser, where your application will be debugged.
  • Debugging JavaScript:

    Chrome

  • Debugging a Dart Web application:

    If you choose Dartium which has a built-in Dart virtual machine, simply the Dart code is executed. If you choose Chrome, the Dart code is compiled into JavaScript through the Dart2js tool, which is a part of the Pub tool. Whether such compilation is required or not is decided by the Pub Serve tool. The tool is invoked automatically when you run or debug a Dart web application, either by opening an HTML file or by launching a run/debug configuration. The tool analyzes the <script></script> element in the HTML file. If the element references a Dart file, Pub Serve invokes the Dart2js compiler whereupon the compiled JavaScript files are passed to the browser where they are processed.

    Specify the URL address of the HTML file the references the Dart code to debug. Make sure that the port specified in this URL address is the same as the Built-in server port on the Debugger page of the Settings dialog box and the port specified in the settings for the Chrome Extension.

Remote URLs of local files
  • Debugging JavaScript:

    CLion displays this area only when you create a permanent debug configuration manually. For automatically generated temporary configurations the area is not shown.

    In this area, map the local files to be involved in debugging to the URL addresses of their copies on the server.

    • File/Directory - in this read-only field, select the desired local file or directory in the project tree.
    • Remote URL - in this text box, type the absolute URL address of the corresponding file or folder on the server.

    These mappings are required only if the local folder structure under the project root differs from the folder structure on the server. If the structures are identical, CLion itself "retrieves" the paths to local files by parsing the URL addresses of their copies on the server.

  • Debugging a Dart Web application:

    CLion displays this area only when the port specified in the URL field is different from the port of the built-in Web server specified on the Debugger page of the Settings dialog box.

See Also

Last modified: 22 November 2016