IntelliJ IDEA 2022.3 Help

Create and edit notebooks

When you have installed the required plugins and established connections to the servers, you can start working with your notebooks.

Right-click any notebook in the Big Data Tools window to open the context menu for the basic operations with the notebook. You can also use the following shortcuts:

Action

Shortcut

Copy

Ctrl+C

Paste

Ctrl+V

Cut

Ctrl+X

Move

F6

Rename

Shift+F6

Move to trash

Delete

Create Note

Alt+Insert

Zeppelin Connections Search

Ctrl+F

Creating notebooks

You can create a new notebook on the target server (remote notebook) or in the current IntelliJ IDEA project (local notebook).

Create a remote notebook

  1. In the Big Data Tools window, right-click any of the configured servers, folder, or note and select Create Note from the context menu or press Alt+Insert.

    Zeppelin context menu
  2. In the Create note dialog, enter the name of the notebook. You can use the / symbol to create a notebook within a folder. Click OK.

    Creating a remote notebook

    The newly added notebook appears in the Big Data Tools window.

    Newly added notebook

In IntelliJ IDEA, you can create notebooks that are stored locally.

Create a local notebook

  1. In the Project tool window, select the project root, press Alt+Insert, and select Zeppelin Notebook.

    Adding a new local notebook
  2. In the Create Zeppelin Notebook dialog, enter the notebook name and press Enter.

    Create a local notebook

    The newly added local notebook appears in the Project tool window.

    Newly added notebook in the Project window

You can search for a particular notebook in the established Zeppelin connections.

  1. Select a target Zeppelin connection in the Big Data Tools window.

  2. Click Search a notebook in the Big Data Tools tool window or press Ctrl+F.

  3. Type anything in the search box of the Find in window. The matching notebooks will be shown in the list of findings.

    Search in Zeppelin connections

Editing notebooks

Once you create a notebook, it opens in the editor.

Newly added notebooks in the editor

Work with paragraphs

  • Press Enter and start editing your notebook right away.

    IntelliJ IDEA enables code assistance to facilitate editing and validating code:

    • Code completion helps you complete the names of classes, functions, and variables. Start typing the name of the code construct, and the suggestion list appears.

      Code completion for Scala
      Code completion for Scala

      In SQL statements, you can use completion for table and columns names if your Zeppelin server is connected to a database, a Hive Metastore, or an AWS Glue platform.

      SQL completion

      The completion is based on available schemas that you can disable and enable in the View | Tool Windows | Database tool window.

    • Renaming (Shift+F6) local variables or private methods can be done easily inline since only the limited scope is affected. Renaming classes or public methods could potentially impact a lot of files. Preview potential changes before you refactor.

      Renaming refactoring for Scala code in a notebook
    • The Extract Method (Ctrl+Alt+M) refactoring lets you take a code fragment that can be grouped together, move it into a separated method and replace the old code with a call to the method.

      Extracting a method

      If you have any Scala class in your project, you can extract the Spark method from the note into this class. Select the method code in the note editor, right-click, and select Refactor | Extract Spark Method. Then specify the target Scala class, declare the method, and press Refactor to complete the task.

    • The Find Usages action (Alt+F7) allows you to search for the references of your code element throughout the entire notebook.

      Find usages of the symbol in the notebook
    • With code inspections, IntelliJ IDEA analyzes your code, searches for ways to optimize it, and detects potential and actual problems. You can always press Alt+Enter to show intention actions and select an available fix.

      Adding a missing import
    • You can navigate to the initial declaration of a symbol and symbol's type from its usage. Select a variable and press Ctrl+B.

      Go to declaration
    • For quick navigation between the notebook paragraphs and code constructs, use the Structure tool window. Press Alt+7 to toggle its visibility.

      Structure view

    Any time you need to clone, move, or delete the current paragraph, just click more actions to open a menu and select the required action.

    Available actions for the current paragraph

    You are not limited to adding only Scala code paragraphs. For example, to add any Markdown code, just add %md to the first line of the paragraph or %sql for an SQL statement.

Note, that you don't need to save your edits. Auto-saving is triggered by various events, for example, closing a notebook or quitting the IDE. Nevertheless, you can import local notebooks and save remote notebooks on your machine.

Export and import notebooks

  • To import a notebook, right-click any directory, note, or Zeppelin connection node in the Big Data Tools window and select Upload from Disk from the context menu. Specify a path to the target .json or .zpln file.

  • To export a notebook, right-click any notebook on a Zeppelin server in the Big Data Tools window and select Save to Disk from the context menu. Specify a path to the directory where you want to save the exported notebook.

Preview notebook contents using minimap

The minimap shows thumbnails of your code next in the editor. You can use it to quickly navigate and preview your code.

  • On the right side of your notebook, click Minimap to enable or disable the minimap.

Preview notebooks in a browser

  1. To preview your notebook in the external browser, click Open in a browser on the notebook editor toolbar and select the corresponding option.

    Open notebook in the external browser
  2. If needed, you can copy the link to the notebook to the clipboard.

Export notebook content into HTML

  1. To export your notebook into an HTML file, click mote actions on the notebook toolbar and select Export Note Code to HTML.

    Export notebook into HTML
  2. Specify the filename and its location in your file system, then confirm the action.

    If you save an HTML file in your project directory, the file appears in the Project tool window. To open it, right-click the file and select a target browser from the menu Open In | Browser.

Manage interpreter bindings

Once you have added code to your notebook, you're ready to execute it and analyze the data. However, you can customize the interpreters used to execute paragraphs by the target server.

  1. On the notebook editor toolbar, click Interpreter bindings.

  2. In the Interpreter Bindings dialog, use the arrow buttons to alter the priority of an interpreter.

    Interpreter bindings

You can also deselect an interpreter and explicitly disable it or restart any interpreter when, for example, the corresponding session got expired.

Last modified: 13 February 2023