Run Cypher Without Leaving Your IDE With Neo4j VSCode Extension

Developer Experience Engineer at Neo4j
4 min read

How did we get here?
As a developer building Neo4j Applications in VS Code, I often switch between my code editor and other tools like Neo4j Browser when writing more complex Cypher statements. Constantly switching between the code editor and other windows to write and execute queries can take a toll on productivity. Not only does it take up a lot of time, but I also find it also disrupts my workflow and productivity. I started experimenting with custom VS Code extensions a few years ago but quickly got distracted by other things. The code sat dormant until recently when a colleague asked me what state it was in. That seeded an idea in my mind that others would really find this useful. I got talking to a few others, partly fuelled by frustration while working to a tight deadline before the holiday break, and partly motivated by the brilliant Prisma extension. I decided I had to pick this up when I returned to my desk in January.Introducing the Neo4j VS Code Extension ?
As a first release, I’ll target a few pain points that I commonly experience myself:- I often write Cypher queries in Neo4j Browser and then copy and paste the code into a Python, Node.js, or Typescript file.
- If I get something wrong in the Cypher statement, it can be difficult to identify and debug.
- Code highlighting packages for Cypher already exist but aren’t feature complete.
- I don’t like having too many windows open at once.
MATCH
,MERGE
,CREATE
, DELETE- node pattern, relationship patterns — out, in
WITH
,RETURN
SET
Installation and Usage
You can install the extension within the IDE by searching for Neo4j or the from the Visual Studio Marketplace. Once installed, you can access a list of database connections by clicking the Neo4j logo in the Activity Bar on the left-hand side.
Adding a new Database Connection
You can add a database connection in three ways, all available through the Command Palette. You can configure a new connection using the Neo4j: Add Connection command.



Running Cypher Queries
Once an active connection is set, you can run a Cypher statement in a read transaction using the Neo4j: Run Cypher Statement in a Read Transaction command, or write to the database using the Neo4j: Run Cypher Statement in a Write Transaction command.

$parameters
, the extension will prompt you for the missing values.

$parameters
, you can set them using the Neo4j: Set Parameter command. If you no longer require the parameter, you can run the Neo4j: Remove Parameter command and select the key of the parameter you want to remove.

Bugs, Feedback & Suggestions
I would love to hear what you think about the extension. If you have any questions, comments, or feature requests you can contact me via Twitter, Mastodon, LinkedIn, or open an Issue on the Github repository. Pull requests are also welcome! Repository and Marketplace Items To learn more about Neo4j, head to Neo4j GraphAcademy for free online, hands-on, self-paced courses.Run Cypher without leaving your IDE with Neo4j VSCode extension was originally published in Neo4j Developer Blog on Medium, where people are continuing the conversation by highlighting and responding to this story.