Elevate Your Database Development: EdgeDB in Visual Studio Code

Elevate Your Database Development: EdgeDB in Visual Studio Code

Table of contents

No heading

No headings in the article.

Introduction: Visual Studio Code (VS Code) is a popular code editor known for its extensibility and versatility. If you're an EdgeDB user and want to leverage the power of VS Code for your EdgeDB development, you're in luck. In this blog post, we'll walk you through the process of setting up and using EdgeDB in Visual Studio Code, enabling you to write queries and interact with your database seamlessly.

Step 1: Install the EdgeDB Extension for VS Code

  1. Launch Visual Studio Code on your machine.

  2. Open the Extensions view by clicking on the square icon on the left sidebar or by pressing Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (Mac).

  3. Search for the "EdgeDB" extension by EdgeDB Inc. in the search bar and click on "Install" to install the extension.

  4. Wait for the installation to complete, and you'll see the "EdgeDB" extension listed among your installed extensions.

Step 2: Connect to an EdgeDB Server

  1. Ensure that you have a running and accessible EdgeDB server.

  2. Open VS Code and navigate to the Explorer view by clicking on the square icon on the left sidebar or pressing Ctrl+Shift+E (Windows/Linux) or Cmd+Shift+E (Mac).

  3. In the top-right corner of the Explorer view, click on the "Connect to EdgeDB Server" icon (EdgeDB logo).

  4. Enter the connection details for your EdgeDB server, including the host, port, and authentication credentials, in the input field that appears.

  5. Press Enter to establish the connection.

Step 3: Writing and Executing EdgeDB Queries

  1. Create a new file in VS Code with a .edgeql extension.

  2. Begin writing EdgeDB queries or schema definitions in the file.

  3. To execute a query, either select the query or place the cursor inside it, then right-click and choose "Execute EdgeDB Query" from the context menu. Alternatively, use the keyboard shortcut Ctrl+Enter (Windows/Linux) or Cmd+Enter (Mac) to execute the query.

  4. The query results will be displayed in the Output view.

Step 4: Exploring EdgeDB Features and IntelliSense

  1. As you write EdgeDB queries or schema definitions in VS Code, you'll benefit from IntelliSense, which provides auto-completion suggestions, syntax highlighting, and code snippets to enhance your development experience.

  2. Utilize IntelliSense to explore available functions, types, and other elements of the EdgeDB language.

Conclusion: With the EdgeDB extension for Visual Studio Code, you can seamlessly integrate EdgeDB into your development workflow. This guide has walked you through the process of installing the extension, connecting to an EdgeDB server, and executing queries right from within VS Code. Leverage the power of IntelliSense and take advantage of the extensive features provided by VS Code to enhance your EdgeDB development experience.

Start harnessing the capabilities of EdgeDB in Visual Studio Code and unlock a new level of efficiency and productivity in working with your database.

Note: Keep an eye on the official EdgeDB extension documentation and explore additional features and updates that may further enhance your EdgeDB development in Visual Studio Code.

Happy coding with EdgeDB and Visual Studio Code!