@morphql/language-definitions
v0.1.23
Published
Shared language definitions for MorphQL across VSCode, Monaco, and documentation
Maintainers
Readme
@morphql/language-definitions
The single source of truth for MorphQL language definitions (keywords, functions, operators) across all platforms. This package ensures consistency between the engine, IDE extensions, and documentation.
Purpose
This shared package centralizes the MorphQL grammar for reuse in:
- VSCode Extension: TextMate grammar and hover providers.
- Monaco Editor (Playground): Language configuration and Monarch tokens.
- Documentation: Automatic generation of function and keyword references.
- Type Safety: TypeScript interfaces for language features.
Installation
npm install @morphql/language-definitionsBasic Usage
import {
KEYWORDS,
FUNCTIONS,
getKeywordNames,
getFunctionNames,
} from "@morphql/language-definitions";
// Get all keyword names for a lexer
const keywords = getKeywordNames();
// Get documentation for hover providers
import { getKeywordDoc } from "@morphql/language-definitions";
const doc = getKeywordDoc("set");
// { signature: "set <target> = <expression>", description: "..." }Maintenance
To add a new language feature (keyword, function, or operator), you should:
- Update the appropriate file in
src/(e.g.,src/functions.ts). - Run
npm run build. - Changes will propagate to the VS Code extension and Playground on their next build.
Learn More
License
MIT
