Documentation Home
MySQL Shell for VS Code

Pre-General Availability: 2024-05-21

4.4 DB Notebook Toolbar

The DB Notebook toolbar provides quick actions for modifying queries written as SQL statements, in scripts, or as query strings within MySQL Shell functions such as runSql(). The toolbar changes depending on the type of editor and the block language (in multi-language editors) in which the caret is located. For example, in SQL mode you can execute individual statements from the toolbar with a button to execute the statement at the caret or the selected statement. This is not the case for scripting languages, which are always executed as a whole (either an entire script in the standalone editor or the entire code block in a multi-language editor).

The following figure shows the set icon actions in the toolbar, located within an active connection tab.

Figure 4.4 MySQL Shell for VS Code - DB Notebook Toolbar

Content is described in the surrounding text.

Toolbar actions (from left to right) are:

  • Editor list: Provides quick access to the DB Connection Browser and each active connection. The list enables you to consolidate your active connections within a single tab rather than generating a separate tab for each connection.

    Each active connection has:

    A second quick-access list enables you to open new documents by clicking:

    • New DB Notebook

    • New SQL Script

    • New TS Script

    • New JS Script

  • Save this Notebook: Downloads the current DB Notebook document to the folder that you established as your default workspace in Visual Studio Code. This special JSON document contains all of the data needed to restore the notebook, including all loaded result data and the last editor state (selection, caret position, and more).

    This operation enables you to specify a file name and an alternative path, if needed, in the dialog. The file type defaults to (and must be) .mysql-notebook.

  • Load a new Notebook from a file: Loads a previously downloaded DB Notebook (.mysql-notebook) document into the connection tab where the operation is selected, replacing the current notebook. In addition, it adds a new DB Notebook entry to the OPEN EDITORS tree and also to the Editor list of the toolbar.

  • Execute selection or everything in the current block and create a new block: Provides a simple way to execute the entire query or a subset of the query within a block, and then adds a new prompt-output block in the same language below the query.

    Notebook editor in SQL mode only: this action does not apply when you run the script editor.

  • Execute the statement at the caret position: Uses the position the keyboard cursor to identify and execute the query.

    SQL mode only.

  • Execute the block and print the result as text: Provides a simple way to execute the entire query or a subset of the query within a block, and then to see the result as text.

    SQL mode only.

  • Stop execution of the current statement/script: Not active until statement or script execution begins.

    SQL mode only.

  • Stop execution of the current statement/script in case of errors: Not enabled by default.

    SQL mode only.

  • Commit DB changes: Not active until you execute a query that alters data.

    SQL mode only.

  • Rollback DB changes: Not active until you commit changes to the database.

    SQL mode only.

  • Auto commit DB changes: When enabled, each statement is committed immediately.

    SQL mode only.

  • Format current block or script: By default, keywords are changed to uppercase.

    TypeScript and JavaScript modes only.

  • Find: Opens the Find panel that supports matching case, matching whole words, and using regular expressions. Up and down arrows enable you to navigate across blocks to each matching instance that is found.

  • Show hidden characters: When enabled, displays invisible characters, such as newlines, spaces, and tabs. A new line is represented as [LF], a space as a single dot (.), and a tab as a right arrow.

  • Soft wrap lines: When enabled, wraps long lines in the editor to eliminate the need to scroll. Disabling this feature for long files is recommended.