Open
Conversation
Add GROQ (Graph-Relational Object Queries) as a recognized data language with syntax highlighting for .groq files, JS/TS template literal injection, and markdown code block injection. - Grammar source: sanity-io/groq-syntax (MIT licensed) - Scopes: source.groq, groq-injection.js, groq-injection.markdown - Samples: blog query, product filter, site navigation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add GROQ (Graph-Relational Object Queries) as a recognized data language with syntax highlighting for
.groqfiles, JS/TS template literal injection, and markdown code block injection.source.groq,groq-injection.js,groq-injection.markdownDescription
GROQ is an open query language for JSON-like data, created by Sanity.io and published under the OWFa 1.0 license since 2019. It is purpose-built for querying and transforming content in document stores, with first-class support for references, projections, and filtering.
GROQ is widely used across the Sanity ecosystem, which includes companies like Nike, Figma, Cloudflare, Spotify, Shopify, and Riot Games. The
groqnpm package sees 800k+ weekly downloads (24M+ annually).While
.groqfiles represent one surface for the language, the majority of GROQ is written as tagged template literals in JavaScript/TypeScript (groq`*[_type == "post"]`) and in markdown code blocks (```groq). The grammar source (sanity-io/groq-syntax) provides injection grammars for both of these, following the same pattern as GraphQL in Linguist (inline.graphql,inline.graphql.markdown.codeblockvia graphql/graphiql).A pull request to add an ace mode is open, but is yet to be reviewed/accepted - so using
textfor now until it has landed.Usage evidence
groqtemplate literals in TSgroqtemplate literals in JS```groqmarkdown blocksimport groqin JS/TS.groqfiles (excl. forks)The
.groqextension meets the 200-file threshold for extensions that typically occur once per repository (likeMakefile). The results show broad distribution across independent users and organizations - not concentrated in Sanity's own repos.The broader surface (5,500+ template literal files, 630+ markdown code blocks) demonstrates that the community already treats GROQ as a distinct language deserving syntax highlighting.
VS Code extension
The Sanity VS Code extension has 50,000+ installs and has provided GROQ syntax highlighting since 2018. The grammar was recently extracted to a dedicated repo (sanity-io/groq-syntax) to support multiple editors and Linguist integration.
Checklist:
#fa84ffI have updated the heuristics to distinguish my language from others using the same extension.Not needed -
.groqis not used by any other language.