Skip to content

Add RQL (RavenDB Query Language) language definition - #4565

Open
leadsoftlucas wants to merge 3 commits into
highlightjs:mainfrom
ravendb:add-rql-language
Open

leadsoftlucas wants to merge 3 commits into
highlightjs:mainfrom
ravendb:add-rql-language

Conversation

@leadsoftlucas

Copy link
Copy Markdown

Changes

Adds a language definition for RQL (Raven Query Language), the SQL-like query language of RavenDB, a document database. RQL appears in the RavenDB Studio, the client APIs, the documentation and community answers, where it currently renders as plain text.

  • src/languages/rql.js: the grammar (id rql, case insensitive). Comments (//, /* */), strings (double, single and backtick quotes), clauses and keywords (from, where, group by, order by, select, load, include, update, declare, with, limit, ...), logical operators, the functions usable in where and order by, order options, type casts, literals, the special tokens @metadata and @all_docs, numbers.
  • test/markup/rql/: three markup tests (default, vector-search, where-functions).
  • SUPPORTED_LANGUAGES.md: one line for RQL (RavenDB) / rql.

The keyword, function and operator lists are derived from RavenDB's own public tooling: the tokenizer of the Studio query editor and the ANTLR4 grammar of its autocomplete service, both in https://github.com/ravendb/ravendb (src/Raven.Studio). They include the recent vector search and AI functions (vector.search, embedding.*, ai.task). Reference: https://docs.ravendb.net/7.2/querying/rql/what-is-rql

Known limitation: RQL select { ... } and update { ... } can embed JavaScript patch scripts. They are highlighted as plain RQL here (no JavaScript sub-mode).

A note on the contribution guide. We read docs/language-contribution.rst and understand that new grammars are no longer merged into core. If you prefer the third-party route, please say so: we will move the grammar to a standalone highlightjs-rql module under the RavenDB organization, publish it, and send a small PR listing it in SUPPORTED_LANGUAGES.md. We are happy to close this PR in favor of that, and we will maintain the grammar either way.

Checklist

  • Added markup tests.
  • I have read and followed the AI-assisted contributions policy: I reviewed the grammar and the tests myself and can answer questions about them.

Tests: the markup tests pass locally (606 passing, including the 3 new ones) and the build succeeds.

Assisted-by: Claude Code

RQL is RavenDB's query language, widely used in blog posts, docs, and
Stack Overflow answers, but previously unrecognized by highlight.js.

The keyword/function/operator lists are derived from RavenDB's own
production RQL tokenizer and ANTLR4 grammar (github.com/ravendb/ravendb),
including recent vector-search/AI tokens (vector.search, embedding.*, ai.task).
Expand the language header with a fuller description and links to the
official RavenDB documentation (docs.ravendb.net) for RQL itself, vector
search / AI functions, and patch scripts, plus a note on what this first
version intentionally leaves out (embedded JS patch-script blocks).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant