PyCharm 4.5.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 PyCharm project on you machine. PyCharm 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 is specified on the Debugger. Data Views 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 PyCharm 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.
    For details, see Temporary and Permanent Run/Debug Configurations.
  2. Remote debugging. In this mode, the application files are on an external web server and you have their copies in a PyCharm 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 PyCharm the name of the currently processed file and the number of the line to be processed. PyCharm 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.

PyCharm supports JavaScript debugging in Chrome and Firefox. In Google Chrome and other browsers of the Chrome family, all the debugging modes are supported. In Firefox, remote debugging is not supported at all. For versions 33, 34, and 35, local debugging through a Firefox Remote debug configuration is supported as a temporary workaround.

PyCharm supports JavaScript debugging in Chrome and Firefox. In Google Chrome and other browsers of the Chrome family, all the debugging modes are supported. In Firefox, remote debugging is not supported at all. For versions 33, 34, and 35, local debugging through a Firefox Remote debug configuration is supported as a temporary workaround.

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 is specified on the Debugger. Data Views 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:

    PyCharm supports JavaScript debugging in Chrome and Firefox. In Google Chrome and other browsers of the Chrome family, all the debugging modes are supported. In Firefox, remote debugging is not supported at all. For versions 33, 34, and 35, local debugging through a Firefox Remote debug configuration is supported as a temporary workaround.

  • 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 acts as a built-in proxy server between your application and the browser. It 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:

    PyCharm 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, PyCharm itself "retrieves" the paths to local files by parsing the URL addresses of their copies on the server.

  • Debugging a Dart Web application:

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

Toolbar

ItemShortcutDescription
add Alt+Insert Click this button to add a new configuration to the list.
delete Alt+Delete Click this button to remove the selected configuration from the list.
copy Ctrl+D Click this button to create a copy of the selected configuration.
settings Edit defaultsClick this button to edit the default configuration templates. The defaults are used for newly created configurations.
arrowUp or arrowDown Alt+Up or Alt+Down Use these buttons to move the selected configuration or folder up and down in the list.

The order of configurations or folders in the list defines the order in which configurations appear in the Run/Debug drop-down list on the main toolbar.

folder Move into new folder / Create new folder Use this button to create a new folder.

If one or more run/debug configurations are in focus, the selected run/debug configurations are automatically moved to the newly created folder. If only a category is in focus, an empty folder is created.

Move run/debug configurations to a folder using drag-and-drop, or the arrowUp arrowDown buttons.

sortAlphabetically Sort configurations Click this button to sort configurations in alphabetical order.

Common Options

ItemDescription
NameIn this text box, specify the name of the current run/debug configuration. This field does not appear for the default run/debug configurations.
Defaults This node in the left-hand pane of the dialog box contains the default run/debug configuration settings. Select the desired configuration to change its default settings in the right-hand pane. The defaults are applied to all newly created run/debug configurations.
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.

Before launchSpecify which tasks must be performed before applying the run/debug configuration. The specified tasks are performed in the order they appear in the list.
ItemKeyboard shortcutDescription
add Alt+Insert Click this icon to add a task to the list. Select the task to be added:
  • Run External tool. Select this option to run an application which is external to PyCharm. In the dialog that opens, select the application or applications that should be run. If the necessary application is not defined in PyCharm yet, add its definition. For more information, see Configuring Third-Party Tools and External Tools.
  • Run Another Configuration. Select this option to have another run/debug configuration executed. In the dialog that opens, select the configuration to be run.
  • Generate CoffeeScript Source Maps. Select this option to have the source maps for your CoffeeScript sources generated. In the dialog that opens, specify where your CoffeeScript source files are located. For more information, see CoffeeScript Support.
  • Run Remote External tool: Add a remote SSH external tool. Refer to the section Remote SSH External Tools for details.
delete Alt+Delete Click this icon to remove the selected task from the list.
edit1 Enter Click this icon to edit the selected task. Make the necessary changes in the dialog that opens.
arrowUp Alt+Up Click this icon to move the selected task one line up in the list.
arrowDown Alt+Down Click this icon to move the selected task one line down in the list.
Show this page Select this check box to have the run/debug configuration settings shown prior to actually starting the run/debug configuration.

See Also

Last modified: 18 July 2015