@codewars/codemirror-agda
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

codemirror-agda

CodeMirror extension for editing Agda.

Provides a function defineMode to define agda mode, and an array UNICODE_HELPER_PAIRS.

  • defineMode(CodeMirror): Define agda mode and MIME text/x-agda.
  • UNICODE_HELPER_PAIRS ([seq: string, sym: string][]): For entering Unicode characters with ASCII sequences using @codewars/codemirror-unicode-helper. A subset of agda-input-translations in agda-input.el.

See https://codewars.github.io/codemirror-agda/.

Usage

import CodeMirror from "codemirror";
import "codemirror/addon/mode/simple"; // `defineSimpleMode`
import "codemirror/addon/hint/show-hint"; // optional
import { unicodeHelperWith } from "@codewars/codemirror-unicode-helper"; // optional

import { defineMode, UNICODE_HELPER_PAIRS } from "@codewars/codemirror-agda";

defineMode(CodeMirror);
// Optionally register unicode input helper.
// `show-hint` addon is required.
CodeMirror.registerGlobalHelper(
  "hint",
  "agda-input",
  // only enable in agda mode
  (mode, cm) => mode && mode.name === "agda",
  unicodeHelperWith(UNICODE_HELPER_PAIRS)
);

Acknowledgments

Agda mode was contributed by @Bubbler-4.

Readme

Keywords

none

Package Sidebar

Install

npm i @codewars/codemirror-agda

Weekly Downloads

1

Version

0.2.0

License

MIT

Unpacked Size

56.3 kB

Total Files

23

Last publish

Collaborators

  • kazk