/codemirror-lang-hcl

HCL support for CodeMirror

Primary LanguageJavaScriptMIT LicenseMIT

codemirror-lang-hcl

NPM Version

This package implements HCL language support for the CodeMirror code editor.

The lezer grammar is ported from tree-sitter-hcl.

Getting Started

Installation

npm i codemirror-lang-hcl

Usage

import {EditorView} from '@codemirror/view';
import {EditorState} from '@codemirror/state';
import {hcl} from "codemirror-lang-hcl";

const state = EditorState.create({
	doc: 'my hcl code',
	extensions: [
		hcl(),
	]
});

const view = new EditorView({
	parent: document.querySelector('#editor'),
	state
});

Example

This example is from tree-sitter-hcl.

Theme: https://thememirror.net/tomorrow.

example.png