lang-firestore
Firestore query language support for the CodeMirror editor.
Install
npm install lang-firestore
Usage
import { EditorState } from "@codemirror/state";
import { EditorView, basicSetup } from "codemirror";
import { firestore } from "lang-firestore";
new EditorView({
state: EditorState.create({
doc: 'db.collection("users").where("age", ">=", 21).get()',
extensions: [basicSetup, firestore()],
}),
parent: document.querySelector("#app")!,
});
Features
- Syntax highlighting for common Firestore query chains (db, collection, doc, where, orderBy, limit, pagination, mutations)
- Operator words:
in
, not-in
, array-contains
, array-contains-any
- Basic completions for Firestore API and operators
Contributing
PRs welcome. Run tests and build locally:
npm i
npm run test
npm run build
If you find this useful, consider sponsoring: github.com/sponsors/omar-dulaimi
License
MIT