https://github.com/codewars/codemirror-agda
Agda mode and input helper for CodeMirror used on Codewars
https://github.com/codewars/codemirror-agda
agda codemirror
Last synced: 10 months ago
JSON representation
Agda mode and input helper for CodeMirror used on Codewars
- Host: GitHub
- URL: https://github.com/codewars/codemirror-agda
- Owner: codewars
- License: mit
- Created: 2019-03-14T02:46:58.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-27T06:36:30.000Z (over 1 year ago)
- Last Synced: 2025-04-19T21:45:45.297Z (10 months ago)
- Topics: agda, codemirror
- Language: TypeScript
- Homepage: https://codewars.github.io/codemirror-agda/
- Size: 63.5 KB
- Stars: 6
- Watchers: 4
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 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](https://github.com/codewars/codemirror-unicode-helper). A subset of `agda-input-translations` in `agda-input.el`.
See .
## Usage
```javascript
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](https://github.com/Bubbler-4).