Commit 3fa882a4 authored by MMesch's avatar MMesch

jlabext that defines ihaskell codemirror mode

parent fbd91afb
*.bundle.*
lib/
node_modules/
*.egg-info/
.ipynb_checkpoints
# ihaskell_labextension
Haskell Syntax Highlighting in Jupyterlab
## Prerequisites
* JupyterLab
## Installation
```bash
jupyter labextension install ihaskell_labextension
```
## Development
For a development install (requires npm version 4 or later), do the following in the repository directory:
```bash
npm install
npm run build
jupyter labextension link .
```
To rebuild the package and the JupyterLab app:
```bash
npm run build
jupyter lab build
```
This diff is collapsed.
{
"name": "ihaskell_jupyterlab",
"version": "0.0.1",
"description": "JupyterLab extension",
"keywords": [
"jupyter",
"jupyterlab",
"jupyterlab-extension"
],
"homepage": "https://github.com/xxx",
"bugs": {
"url": "https://github.com/xxx/issues"
},
"license": "BSD-3-Clause",
"author": "MMesch",
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/xxx/jupyterlab-sos.git"
},
"scripts": {
"build": "tsc",
"clean": "rimraf lib",
"watch": "tsc -w"
},
"dependencies": {
"@jupyterlab/application": "^0.16.1",
"@jupyterlab/apputils": "^0.16.2",
"@jupyterlab/docregistry": "^0.16.1",
"@jupyterlab/notebook": "^0.16.1",
"@jupyterlab/services": "^2.0.1",
"@phosphor/disposable": "^1.1.2"
},
"devDependencies": {
"rimraf": "^2.6.1",
"typescript": "~2.6.0"
},
"jupyterlab": {
"extension": true
}
}
import * as CodeMirror from 'codemirror';
import 'codemirror/lib/codemirror';
import 'codemirror/mode/haskell/haskell';
CodeMirror.defineMode("ihaskell", (config) => {
let hmode = CodeMirror.getMode(config, "haskell");
return CodeMirror.multiplexingMode(
hmode,
{
open: /:(?=!)/, // Matches : followed by !, but doesn't consume !
close: /^(?!!)/, // Matches start of line not followed by !, doesn't consume character
mode: CodeMirror.getMode(config, "text/plain"),
delimStyle: "delimit"
}
);
});
CodeMirror.defineMIME("text/x-ihaskell", "ihaskell");
CodeMirror.modeInfo.push({
ext: ['hs'],
mime: "text/x-ihaskell",
mode: 'ihaskell',
name: 'ihaskell'
});
import {
JupyterLab, JupyterLabPlugin
} from '@jupyterlab/application';
import './codemirror-ihaskell';
import '../style/index.css';
/**
* Initialization data for the extension1 extension.
*/
const extension: JupyterLabPlugin<void> = {
id: 'ihaskell',
autoStart: true,
requires: [],
activate: (app: JupyterLab) =>
{
app.serviceManager.ready
.then(() => {defineIHaskell()});
}
};
function defineIHaskell() {
console.log('ihaskell codemirror activated');
}
export default extension;
{
"compilerOptions": {
"declaration": true,
"noImplicitAny": false,
"noEmitOnError": true,
"noUnusedLocals": true,
"allowSyntheticDefaultImports": true,
"module": "commonjs",
"moduleResolution": "node",
"target": "es2015",
"outDir": "./lib",
"lib": ["dom", "es2015"],
"types": []
},
"include": ["src/*"]
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment