CodeMirror extension for the Nix language
git submodule add https://github.com/milahu/codemirror-lang-nix src/codemirror-lang-nix
git commit -m "add submodule src/codemirror-lang-nix"
// src/index.js
import { EditorState } from '@codemirror/state';
import { EditorView } from '@codemirror/view';
import { basicSetup } from 'codemirror';
import { nix } from "./codemirror-lang-nix";
const nixSource = `\
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = [ pkgs.nodejs ];
}
`;
new EditorView({
state: EditorState.create({
doc: nixSource,
extensions: [basicSetup, nix()],
}),
parent: document.querySelector('#editor'),
});
this project is based on