UNPKG

3.06 kBTypeScriptView Raw
1import { Extension } from '@codemirror/state';
2export { EditorView } from '@codemirror/view';
3
4/**
5This is an extension value that just pulls together a number of
6extensions that you might want in a basic editor. It is meant as a
7convenient helper to quickly set up CodeMirror without installing
8and importing a lot of separate packages.
9
10Specifically, it includes...
11
12 - [the default command bindings](https://codemirror.net/6/docs/ref/#commands.defaultKeymap)
13 - [line numbers](https://codemirror.net/6/docs/ref/#view.lineNumbers)
14 - [special character highlighting](https://codemirror.net/6/docs/ref/#view.highlightSpecialChars)
15 - [the undo history](https://codemirror.net/6/docs/ref/#commands.history)
16 - [a fold gutter](https://codemirror.net/6/docs/ref/#language.foldGutter)
17 - [custom selection drawing](https://codemirror.net/6/docs/ref/#view.drawSelection)
18 - [drop cursor](https://codemirror.net/6/docs/ref/#view.dropCursor)
19 - [multiple selections](https://codemirror.net/6/docs/ref/#state.EditorState^allowMultipleSelections)
20 - [reindentation on input](https://codemirror.net/6/docs/ref/#language.indentOnInput)
21 - [the default highlight style](https://codemirror.net/6/docs/ref/#language.defaultHighlightStyle) (as fallback)
22 - [bracket matching](https://codemirror.net/6/docs/ref/#language.bracketMatching)
23 - [bracket closing](https://codemirror.net/6/docs/ref/#autocomplete.closeBrackets)
24 - [autocompletion](https://codemirror.net/6/docs/ref/#autocomplete.autocompletion)
25 - [rectangular selection](https://codemirror.net/6/docs/ref/#view.rectangularSelection) and [crosshair cursor](https://codemirror.net/6/docs/ref/#view.crosshairCursor)
26 - [active line highlighting](https://codemirror.net/6/docs/ref/#view.highlightActiveLine)
27 - [active line gutter highlighting](https://codemirror.net/6/docs/ref/#view.highlightActiveLineGutter)
28 - [selection match highlighting](https://codemirror.net/6/docs/ref/#search.highlightSelectionMatches)
29 - [search](https://codemirror.net/6/docs/ref/#search.searchKeymap)
30 - [linting](https://codemirror.net/6/docs/ref/#lint.lintKeymap)
31
32(You'll probably want to add some language package to your setup
33too.)
34
35This extension does not allow customization. The idea is that,
36once you decide you want to configure your editor more precisely,
37you take this package's source (which is just a bunch of imports
38and an array literal), copy it into your own code, and adjust it
39as desired.
40*/
41declare const basicSetup: Extension;
42/**
43A minimal set of extensions to create a functional editor. Only
44includes [the default keymap](https://codemirror.net/6/docs/ref/#commands.defaultKeymap), [undo
45history](https://codemirror.net/6/docs/ref/#commands.history), [special character
46highlighting](https://codemirror.net/6/docs/ref/#view.highlightSpecialChars), [custom selection
47drawing](https://codemirror.net/6/docs/ref/#view.drawSelection), and [default highlight
48style](https://codemirror.net/6/docs/ref/#language.defaultHighlightStyle).
49*/
50declare const minimalSetup: Extension;
51
52export { basicSetup, minimalSetup };