Use the Databricks notebook and file editor
This page describes some of the functions available with the Databricks notebook and file editor, including code suggestions and autocomplete, variable inspection, code folding, and side-by-side diffs.
Autocomplete
Autocomplete automatically completes code segments as you type them. Databricks supports two types of autocomplete: local and server.
Local autocomplete completes words that are defined in the notebook.
Server autocomplete accesses the cluster for defined types, classes, and objects, as well as SQL database and table names.
To activate server autocomplete, attach your notebook to a cluster and run all cells that define completable objects. Autocomplete suggestions automatically appear you type in a cell. Use the up and down arrow keys or your mouse to select a suggestion, and press Tab or Enter to insert the selection into the cell.
Note
Server autocomplete in R notebooks is blocked during command execution.
There are two user settings to be aware of:
To turn off autocomplete suggestions, toggle Autocomplete as you type. When autocomplete is off, you can display autocomplete suggestions by pressing Ctrl + Space.
To prevent Enter from inserting autocomplete suggestions, toggle Enter key accepts autocomplete suggestions.
Variable inspection
To display information about a variable defined in a SQL or Python notebook, hover your cursor over the variable name. Python variable inspection requires Databricks Runtime 12.0 or above.

Go to definition
In Databricks Runtime 12.2 LTS and above, when a Python notebook is attached to a cluster, you can automatically navigate to the definition of a variable or function that is defined in that notebook. To do so, hold down the Cmd key on macOS or Ctrl key on Windows and hover the cursor over the name of the variable or function. The name turns into a hyperlink and changes to underlined blue text if the definition is found. When you click the link, the cursor moves to the code that defines the variable or function.
You can also use the keyboard shortcuts Cmd+F12 on macOS or Ctrl+F12 on Windows.
Code folding
Code folding lets you temporarily hide sections of code. This can be helpful when working with long code blocks because it lets you focus on specific sections of code you are working on.
To hide code, place your cursor at the far left of a cell. Downward-pointing arrows appear at logical points where you can hide a section of code. Click the arrow to hide a code section. Click the arrow again (now pointing to the right) to show the code.

For more details, including keyboard shortcuts, see the VS Code documentation.
Multicursor support
You can create multiple cursors to make simultaneous edits easier, as shown in the video:

To create multiple cursors in a cell:
On macOS, hold down the
Option
key and click in each location to add a cursor.On Windows, hold down the
Alt
key and click in each location to add a cursor.You also have the option to change the shortcut. See Change shortcut for multicursor and column selection.
On macOS, you can create multiple cursors that are vertically aligned by using the keyboard shortcut Option
+Command
+ up or down arrow key.
Column (box) selection
To select multiple items in a column, click at the upper left of the area you want to capture. Then:
On macOS, press
Shift
+Option
and drag to the lower right to capture one or more columns.On Windows, press
Shift
+Alt
and drag to the lower right to capture one or more columns.You also have the option to change the shortcut. See Change shortcut for multicursor and column selection.

Change shortcut for multicursor and column selection
An alternate shortcut is available for multicursor and column (box) selection. With the alternate selection, the shortcuts change as follows:
To create multiple cursors in a cell:
On macOS, hold down the
Cmd
key and click in each location to add a cursor.On Windows, hold down the
Ctrl
key and click in each location to add a cursor.
To select multiple items in a column, click at the upper left of the area you want to capture. Then:
On macOS, press
Option
and drag to the lower right to capture one or more columns.On Windows, press
Alt
and drag to the lower right to capture one or more columns.
To enable the alternate shortcuts, do the following:
Click your username at the upper-right of the workspace, then click User settings in the dropdown list.
In the Settings sidebar, select Developer.
Change the Key modifier for multi-cursor click setting to Cmd for macOS or Ctrl for Windows.
When you enable alternate shortcuts, the keyboard shortcut for creating multiple cursors that are vertically aligned does not change.
Bracket matching
When you click near a parenthesis, square bracket, or curly brace, the editor highlights that character and its matching bracket.

Side-by-side diff in version history
When you display previous notebook versions, the editor displays side-by-side diffs with color highlighting.
