Skip to content

live-codes/lang-minizinc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@live-codes/lang-minizinc NPM version

This package implements MiniZinc language support for the CodeMirror code editor, based on MiniZinc playground.

The project page has more information, a number of examples and the documentation.

This code is released under an MIT license.

We aim to be an inclusive, welcoming community. To make that explicit, we have a code of conduct that applies to communication around the project.

Usage

import { EditorView, basicSetup } from "codemirror";
import { MiniZinc } from "@live-codes/lang-minizinc";

const code = `
include "all_different.mzn";

int: n = 8;
array [1..n] of var 1..n: q; % queen in column i is in row q[i]

constraint all_different(q);                      % distinct rows
constraint all_different([q[i] + i | i in 1..n]); % distinct diagonals
constraint all_different([q[i] - i | i in 1..n]); % upwards+downwards
`;

const view = new EditorView({
  parent: document.body,
  doc: code,
  extensions: [basicSetup, MiniZinc()],
});

API Reference

MiniZinc() → LanguageSupport

Language support for MiniZinc.

MiniZincLanguage: LRLanguage

A language provider for MiniZinc with highlighting and indentation information.

About

MiniZinc language support for CodeMirror

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published