Basic configuration presets for the CodeMirror 6 code editor
npx @tessl/cli install tessl/npm-codemirror@6.0.0CodeMirror Basic Setup provides convenient configuration presets for the CodeMirror 6 code editor. It offers both comprehensive and minimal setup extensions that bundle together commonly needed editor features, allowing developers to quickly initialize CodeMirror without manually configuring individual extensions.
npm install codemirrorimport { basicSetup, minimalSetup, EditorView } from "codemirror";For CommonJS:
const { basicSetup, minimalSetup, EditorView } = require("codemirror");import { EditorView, basicSetup } from "codemirror";
// Create editor with comprehensive setup
const view = new EditorView({
parent: document.body,
doc: "Hello World",
extensions: [basicSetup]
});
// Create editor with minimal setup
const minimalView = new EditorView({
parent: document.body,
doc: "Hello World",
extensions: [minimalSetup]
});CodeMirror Basic Setup is a simple configuration package that provides pre-bundled extension arrays:
basicSetup (comprehensive) and minimalSetup (minimal) configuration bundlesThis package serves as a convenience wrapper around the modular @codemirror ecosystem, providing example configurations that can be used directly or as starting points for custom setups.
Comprehensive editor setup with all common features for a full-featured code editor experience.
/**
* Comprehensive editor setup including line numbers, syntax highlighting,
* bracket matching, autocompletion, search, folding, multiple selections,
* and complete keymap bindings for all features.
*/
const basicSetup: Extension;Features included:
Essential editor features for a functional but lightweight code editor.
/**
* Minimal editor setup with only essential features: special character
* highlighting, undo history, selection drawing, syntax highlighting,
* and basic keymap bindings.
*/
const minimalSetup: Extension;Features included:
The main CodeMirror editor view class, re-exported for convenience from @codemirror/view.
/**
* The main CodeMirror editor view class (re-exported from @codemirror/view)
* This is the complete EditorView class from the @codemirror/view package.
* Refer to @codemirror/view documentation for full API details.
*/
export { EditorView } from "@codemirror/view";/**
* CodeMirror extension type (from @codemirror/state)
* Represents a configuration unit that can extend editor functionality
*/
type Extension = any;Note: This package only exports the Extension type and re-exports EditorView. For complete type definitions of EditorView, EditorState, Transaction, and other CodeMirror types, refer to the respective @codemirror/* packages.