Select a Spark job code fragment in the note.
Right-click the selected code and select Refactor | Extract Spark Job from the context menu.
Save the Scala file, and it will be opened in a separate editor tab.