This Zed extension provides syntax highlighting support for the Cypher query language, using the tree-sitter-cypher
parser.
Refer to the official Zed documentation for language extensions at https://zed.dev/docs/extensions/languages.
Inside the cypher directory, create a file named extension.toml with the basic info and following content:
[grammars.cypher]
repository = "https://github.com/pupli/tree-sitter-cypher"
commit = "COMMITID" # Replace COMMITID with the actual commit ID you want to use
Inside a language/cypher directory, create a config.toml file with basic configuration settings for the Cypher extension.
Inside the language/cypher directory, create a file named highlights.scm and define the rules for syntax highlighting. These rules will specify how different Cypher elements (like keywords, functions, and operators) are highlighted.
Go to Zed and install the extension as a developer extension:
- Donwload the extension (https://github.com/pupli/cypher/archive/refs/tags/latest.zip) and extract
- Open Zed.
- Go to Extensions in the menu.
- Click Install Dev Extension and point to extracted folder
The extension should appear in the Extensions list (as shown in the image above) once loaded successfully.
- Create a new file with a
.cypher
extension in Zed. - Add Cypher syntax, such as examples from the cypher.txt test cases in the openCypher project, to verify that syntax highlighting works as expected.
Many thanks to the following resources for guidance and support in creating this extension:
- Installing Extensions in Zed - Guide to setting up and installing extensions in Zed.
- Zed Decoded: Extensions Blog Post - Insights on how Zed handles extensions and the possibilities they open.
- openCypher GitHub Repository - Provides tools and libraries for working with the Cypher query language.
- openCypher Resources - Reference materials on Cypher syntax, language style, and best practices.
- Cypher Test Cases - Useful Cypher syntax examples for testing and validation.
- Extension Structure Inspiration - Thank you to the repository for guidance on structuring the extension files and configurations.