PyCharm 2017.2 Help

Module Dependency Diagrams

Building a module dependency diagram

To build a diagram, choose Diagrams | Show Diagram on the context menu of a JavaScript, TypeScript, or HTML file or of a folder. If the action is invoked on a folder where multiple types of diagrams can be built, additionally choose JavaScript Module Dependency Diagram from the Select Diagram Type pop-up list.
The action is not available on the node_modules folders and on folders that are marked as Excluded.

Analyzing a module dependency diagram

PyCharm analyzes the import and require statements and script tags in the selected file or in all the files in the selected folder recursively and in a separate tab displays a diagram that shows how these files depend on each other:

ws_module_dependency_diagram.png
  • A diagram consists of a number of rectangles. Each of them shows the name of the analyzed selected file and a list of detected imports. If an import is resolved, an icon that indicates the type of the imported symbol (e.g. /help/img/idea/2017.2/variable.png or /help/img/idea/2017.2/field.png) is shown next to it.
  • An arrow from an analyzed file points at the target file from which the detected imports are made. If the target file is a library, its name is displayed on the grey background. If an import from a library is not resolved, the target file is displayed as a grey rectangle with red border.
  • Resolved imports and exports are marked with the /help/img/idea/2017.2/import_icon.png or /help/img/idea/2017.2/export_icon.png icons respectively.

Navigating from the diagram to the source code

PyCharm supports navigation from the diagram:

  • To jump from a diagram to a file, right-click the file and choose Jump to source on the context menu.
  • To navigate to a specific import statement in the source code, right-click the required file in the diagram, choose Jump to on the context menu, and then choose the symbol to jump to from the Select Navigation Target pop-up list:
    ws_module_dependency_diagram_jump_to.png

Last modified: 26 October 2017

See Also

Reference: