1. Select a Spark job code fragment in the note.

  2. Right-click the selected code and select Refactor | Extract Spark Job from the context menu.

  3. Save the Scala file, and it will be opened in a separate editor tab.