@tigerpython/codemirror-lang-tigerpython
v1.0.0
Published
CodeMirror language support for TigerPython, the beginner-friendly Python dialect used by TigerJython/WebTigerPython. Forked from @codemirror/lang-python.
Downloads
348
Maintainers
Readme
@tigerpython/codemirror-lang-tigerpython
CodeMirror language support for TigerPython, the beginner-friendly Python
dialect used by TigerJython/WebTigerPython.
Forked from @codemirror/lang-python,
built on the @tigerpython/lezer-tigerpython
grammar.
This code is released under an MIT license.
Installation
npm install @tigerpython/codemirror-lang-tigerpython@tigerpython/lezer-tigerpython is a regular npm dependency of this
package, so it gets installed automatically — you don't need to add it
yourself unless you want to use the raw parser directly (see below).
Usage
import {EditorView, basicSetup} from "codemirror"
import {tigerPython} from "@tigerpython/codemirror-lang-tigerpython"
const view = new EditorView({
parent: document.body,
doc: `print("Hello world")`,
extensions: [basicSetup, tigerPython()]
})If you only need the bare Lezer parser (no CodeMirror integration), import it from the grammar package directly, the same scoped way:
import {parser} from "@tigerpython/lezer-tigerpython"