This Visual Studio Code extension provides basic syntax highlighting, code completion (coming soon), and related tools for Neo4j's Cypher Query Language with support for Neo4j's Awesome Procedures on Cypher (APOC), Graph Algorithms, and GraphQL libraries.
This extension also works with Cypher files conforming to the OpenCypher standard such as those from AnzoGraph, Memgraph, RedisGraph, SAP Hana Graph, or OpenCypher for Apache Spark (Codename: Morpheus). Please note that none of these tools yet provide a complete Cypher implementation.
The simplest way to use this extension is to install it from the VS Code Extension Marketplace from within VS Code.
Installation From Within VSCode
- From within VS Code, click on the
extensions icon in the left sidebar, press
Ctrl-Shift-X (on Windows or Linux) or
Cmd-Shift-X (on Mac), or click
View -> Extensions from the main navigation bar at the top of the screen. Any of these should bring up the Extensions Marketplace search box.
Cypher Query Language Tools for Neoj.
Installation from the VS Code Marketplace
- Go to https://marketplace.visualstudio.com/items?itemName=AnthonyJGatlin.vscode-cypher-query-language-tools
- Click the
Install button. You will be prompted to open Visual Studio Code.
Installation from the Command Line (using a VSIX file)
- Download the VSIX file from the GitHub repository. (https://github.com/agatlin/vscode-cypher-query-language-tools/blob/master/vscode-cypher-query-language-tools-0.1.1.vsix)
- Open a shell or command prompt.
- Change to the directory where the extension file was downloaded.
More information on installing a VSIX file can be found at https://vscode-docs.readthedocs.io/en/stable/extensions/install-extension/.
Installation from source (for editing/debugging)
Theoretically, the version of the extension in the VS Code Marketplace will always be the same as what is in the master GitHub repository. If for any reason, you would like to run the extension directly (as for testing), you can do the following:
- Clone the Git repository.
git clone https://github.com/agatlin/vscode-cypher-query-language-tools.git.
- Open a shell window for your particular operating system.
cd into the
- Execute the command
code . <enter> to open VS Code in the current directory.
F5 to bring up an Extension Shell debugging window
This extension is automatically active whenever files with
cyp extensions are loaded. (Per the Cypher Style Guide,
cypher is the preferred file extension for Cypher files.)
You may also force activation of the extension on any file by overriding the language mode for the active file. This can be done by any of the following:
- Clicking on the file type by in the lower navigation bar and then selecting
Cypher Query Language (Cypher).
Click Ctrl+L, M (or
Cmd-K, M on Mac) to bring up the Language Mode dialog. Select
Cypher Query Language (Cypher) from the list of available languages.
Cmd-Shift-P on Mac) to bring up the Command Palette. Then, select the
Change Language Mode command. Select
Cypher Query Language (Cypher) from the list of available languages.
Any bugs or other issues can be submitted to the Issues section of this repository. If you feel comfortable in correcting the issue, please feel free to make the correction and submit a pull request.
The initial version of this extension is very simple but has ambitious long term goals. Some of the planned functionality is described below.
- Review existing functionality to find gaps in Cypher keywords (including deprecated keywords) for syntax highlighting.
- Develop a matrix of supported Cypher keywords by graph database vendor and version.
- Allow users to choose syntax highlighting based on graph database vendor and version.
- Collect information for all functions including method signatures, descriptions, usage examples, links to documentation and other references, and links to replacement methods for deprecated items.
- Provide access within the extension to code completion, documentation, examples, and links to official Neo4j documentation for all Neo4j, APOC, Graph Algorithms, and GraphQL functions and procedures, links to outside references (where appropriate), and links to replacement functions for deprecated items.
- Provide on-hover documentation for Cypher clauses and functions and those of other Neo4j libraries.
- Provide code snippets and keyboard shortcuts for useful Cypher queries. (This includes many data profiling and administrative queries.)
- Provide support for auto-complete of properties and labels available through db.labels() and db.properties().
- Implement FlexiSearch module to provide basic search functionality across library procedures, descriptions, and other documentation. (Finding the right procedure or function now can be confusing for new users.)
- Provide support for the notion of "chainable Cypher snippet groups" where the output of one snippet can be piped into another snippet, exported, or stored for later use.
- Implement a pluggable architecture so other libraries in the Neo4j ecosystem, like those from GraphAware can also benefit from code completion and built-in hover documentation.
- Provide the ability to store connection information for multiple Neoj databases.
- Provide the ability to integrate directly with the Cypher Shell as a VS Code Terminal.
- Provide the ability to run queries through Visual Studio Code.
- Provide the ability to download and run Docker images for Enterprise or Community Edition along with relevant version-associated plugins for APOC, the Graph Algorithms Library, Graph QL, and from elsewhere in the Neo4j ecosystem.
- Provide basic capabailities to wrap queries in EXPLAIN, PROFILE so queries can be better analyzed and timed.
- Provide :begin, :commit to support to database changes can be tested and rolled back if desired.
- Provide code re-formatting functionality to reformat code according to the Cypher Style Guide.
- Implement a true Language Server and Language Client for Cypher. Implementation of an actual Language Server/Language Client architecture will allow the code to run within Visual Studio (not just VS Code) as well as other Language Server compliant platforms.
- Begin preparations for addingGraph Query Language (GQL) support.
We definitely could benefit from and would welcome help in building out this extension. There are many areas to contribute beyond actually writing code. If you are interested in working on this extension, please don't hesitate to jump in.
Pull requests are extremely welcome.
General Cypher and Neo4j Help
The Neo4j/Cypher community is very active and helpful. Believe me on this! They have been absolutely amazing in helping me to come up to speed on Cypher and Neo4j. I highly recommend joining the the Neo4j Community Site.
If you are new to Cypher and would like a little guidance, I recommend you start with Ryan Boyd's short video series, An Introduction to Graph Databases on YouTube. This series will provide a good foundation for moving deeper into Cypher. Ryan's videos are very easy to follow.
William Lyon also has a great Introduction to Cypher video tht is worth a watch or two.
There are many great videos on the Neo4j YouTube Channel, but the sheer volume of content can be overwhelming for a someone new to graphs. As you progress, this channel will become an invaluable resource.
Neo4j also has several free courses available through their Graph Academy. Of particular interest is the Introduction to Neo4j course which only takes a few hours to complete.
There are also many great resources on the Neo4j Developer site and the Neo4j Documentation Site.
Of course, no reference list would be complete without mentioning the super-handy Cypher Reference Card
Beyond these, Google will present you with many additional free learning options.
This extension is based on previous code extensions from Ionut Botizan and Jake Boone. Both of these extensions were based on TextMate language packages for Atom (language-cypher) and Sublime Text (Cypher).