Documentation Home
MySQL Shell for VS Code


MySQL Shell for VS Code  /  View MySQL Resources  /  OPEN EDITORS View

Pre-General Availability: 2024-05-21

3.1 OPEN EDITORS View

The OPEN EDITORS view provides a listing of each notebook, script, and MySQL Shell Consoles session that you open. Notebooks and scripts appear in the scope of a database connection for simplified navigation. The appearance of the view tree can differ depending on the number of active connections and tabs you create. In contrast, console sessions always appear together under the MySQL Shell Consoles in the view, even if you opened the session for a specific connection.

On startup, the OPEN EDITORS view contains one persistent DB Connections entry, also known as the database (DB) connection browser. The browser includes a tile for each previously created connection.

Hover your pointer device over the entry in the view and click the arrow to open a MySQL Shell tab showing the DB connection browser. The tab includes the Editor list in the DB Notebook toolbar (with a single DB Connections entry in its quick access list) and the Open New Shell Console icon next to the quick access list. Closing the tab also closes all open editors in it and removes those entries from the view's listing.

The following figure shows the initial OPEN EDITORS view together with a portion of the Editor list of the toolbar.

Figure 3.1 OPEN EDITORS View: Startup Entry

Content is described in the surrounding text.

This section describes the listings and capabilities of the OPEN EDITORS view under these conditions:

Single editor

The OPEN EDITORS view shows a single open editor (notebook or script) directly below the persistent DB Connections entry. Its name consists of the editor type followed by the connection name. For example, if you open a notebook for a connection named Basic, the entry in the view is DB Notebook (Basic). Click the entry to activate it in the tab or click DB Connections to return to the browser. Use the Msg › Db Editor: setting to select the type of editor to use for automatic (see Section 2.3.1, “Settings for DB Notebooks”).

To close a single editor, hover your pointer device over the entry in the view and click X.

Multiple editors using a single connection

When you open multiple editors using the same connection, the view shows each one as a separate entry below the persistent DB Connections entry. To hide all editors, click OPEN EDITORS to collapse the view.

Naming rules for multiple editors:

  • DB Notebook (connection name)

    OPEN EDITORS shows the initial notebook editor without a number. All subsequent notebook editors are numbered sequentially; for example, DB Notebook 1 (Basic), DB Notebook 2 (Basic), and so on.

  • Untitled-x (connection name)

    By default, all script editor names include an incremental number. OPEN EDITORS distinguishes individual script languages (SQL, JavaScript, and TypeScript) by showing a language-specific icon in the entry.

Multiple connections and editors

The listing of entries under OPEN EDITORS changes form and new quick-access capabilities become available at the connection level when you open at least one editor for multiple database connections. All of the editors (and the DB connections browser) become active within a single tab when you click the entry in the view's list.

With multiple connections:

  • All of the open editors appear under a named connection in the OPEN EDITORS view tree.

  • Each connection-level node in the view tree maintains an independent list of editors. You can expand or collapse the lists.

  • Hover your pointer device over a connection-level node to expose notebook and script icons that open a new editor or reactivate the most recently opened editor of that type. Quick-access icons under OPEN EDITORS are equivalent to the icons that appear on each connection tile in the DB connection browser.

Editors in a separate tab

It is possible to open a connect to a database in a new tab (see Connection actions). If you elect to open an editor in a separate tab, the OPEN EDITORS view changes to include the tab as a new tree level. Select an editor in this scenario to automatically activate the right extension tab.

With multiple tabs:

  • The first tab is named MySQL Shell. Additional tab names include an incremental number, such as MySQL Shell(1).

  • Each new tree level has a single, persistent DB Connections entry.

  • All of the open editors appear under a named connection and also indicate the connection name in their entry.

  • New editors that you add using the DATABASE CONNECTIONS view appear under the view tree associated with the active tab.

  • Hover your pointer device over a connection-level node to expose notebook and script icons that open a new editor or reactivate the most recently opened editor of that type.

MySQL Shell consoles

MySQL Shell for VS Code enables you to activate a dedicated work area for opening and managing console sessions in the MySQL Shell Consoles tab. The MySQL Shell Consoles tree under OPEN EDITORS is independent from other tree levels in the view. When you close the tab, the console sessions and the MySQL Shell Consoles tree under OPEN EDITORS also close.

MySQL Shell Consoles contains all of your open sessions. To access a session quickly, click the entry under the OPEN EDITORS or use the drop-down list in the GUI Console toolbar. For more information, see MySQL Shell Consoles.

Open a new session

  1. Click DB Connections under OPEN EDITORS to open or activate the MySQL Shell tab.

  2. In the tab, navigate to the Open New Shell Console icon near the Editor list of the toolbar. For the icon's location, see the arrow in the following figure.

  3. Click the icon, which opens a new shell session in the MySQL Shell Consoles tab.

    New MySQL Shell sessions are not connected to a MySQL server. For connection details, see Connecting MySQL Shell Session.

Close a MySQL Shell session

Navigate to a session under MySQL Shell Console in OPEN EDITORS and click X. The X is only visible when your pointer device hovers over the open session.