Table of contents
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
Launch Visual Studio Code on your machine.
Open the Extensions view by clicking on the square icon on the left sidebar or by pressing
Ctrl+Shift+X
(Windows/Linux) orCmd+Shift+X
(Mac).Search for the "EdgeDB" extension by EdgeDB Inc. in the search bar and click on "Install" to install the extension.
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
Ensure that you have a running and accessible EdgeDB server.
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) orCmd+Shift+E
(Mac).In the top-right corner of the Explorer view, click on the "Connect to EdgeDB Server" icon (EdgeDB logo).
Enter the connection details for your EdgeDB server, including the host, port, and authentication credentials, in the input field that appears.
Press Enter to establish the connection.
Step 3: Writing and Executing EdgeDB Queries
Create a new file in VS Code with a
.edgeql
extension.Begin writing EdgeDB queries or schema definitions in the file.
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) orCmd+Enter
(Mac) to execute the query.The query results will be displayed in the Output view.
Step 4: Exploring EdgeDB Features and IntelliSense
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.
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!