- Notifications
You must be signed in to change notification settings - Fork2
An addon for supporting SurrealQL within your CodeMirror editors
License
NotificationsYou must be signed in to change notification settings
surrealdb/codemirror
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This library provides full support for the SurrealQL language within your CodeMirror editors.
Some features include:
- Intelligent SurrealQL highlighting
- Folding support for blocks, objects, and arrays
- Automatic indentation support
- Support for comment toggling
- Embedded JavaScript highlighting
- Support for linting of supported syntax based on version
Install it with:
# using npmnpm i @surrealdb/codemirror# or using pnpmpnpm i @surrealdb/codemirror# or using yarnyarn add @surrealdb/codemirror
Next, just import it with:
const{ surrealql}=require("@surrealdb/codemirror");
or when you use modules:
import{surrealql}from"@surrealdb/codemirror";
import{surrealql}from"@surrealdb/codemirror";conststate=EditorState.create({doc:"SELECT * FROM table",extensions:[surrealql()]});consteditor=newEditorView({parent:document.getElementById("editor"),state:state,});
import{surrealql,surrealqlVersionLinter}from"@surrealdb/codemirror";conststate=EditorState.create({doc:"SELECT * FROM table",extensions:[surrealql(),surrealqlVersionLinter("2.0.0")]});consteditor=newEditorView({parent:document.getElementById("editor"),state:state,});
This package contains the low levelLezer grammar used to perform SurrealQL syntax highlighting.
We recommend using@surrealdb/codemirror
as it extends the grammar with additional CodeMirror supported functionality.
About
An addon for supporting SurrealQL within your CodeMirror editors