GROQ syntax highlighting
Syntax highlighting for the GROQ query language is available in the following situations:
- Files with the
- Fenced code blocks in Markdown with the
- Tagged template literals with the
- Template literals prefixed with the
/* groq */comment
- Template literals starting with a
When GROQ-queries are detected, the extension will allow you to run the query and displays the result as JSON in a separate tab.
The project ID and dataset used is determined by finding the nearest
If the GROQ file/query has any variables, then extension asks for a relative filename of a JSON-file containing an object of key-value mappings. It autofills the param filename based on the current file with a
.json extension, if it exists.
Install the VSCode Sanity.io Extension. This extension adds syntax highlighting for GROQ-files and
- Clone the repository - https://github.com/sanity-io/vscode-sanity
- Open it in VSCode
- Go to the debugging section and run the launch program "Extension"
- This will open another VSCode instance with extension enabled
- Open a file that should be syntax highlighted
- Make changes to the extension code, then press (
Cmd+Ron Mac) in the syntax highlighted file to test the changes