mirror of
https://github.com/danog/sass-site.git
synced 2024-12-12 01:19:50 +01:00
71 lines
1.7 KiB
TypeScript
71 lines
1.7 KiB
TypeScript
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
import {
|
|
autocompletion,
|
|
closeBrackets,
|
|
closeBracketsKeymap,
|
|
completionKeymap,
|
|
} from '@codemirror/autocomplete';
|
|
import { defaultKeymap, history, historyKeymap } from '@codemirror/commands';
|
|
import {
|
|
bracketMatching,
|
|
defaultHighlightStyle,
|
|
foldGutter,
|
|
foldKeymap,
|
|
indentOnInput,
|
|
syntaxHighlighting,
|
|
} from '@codemirror/language';
|
|
import { lintKeymap } from '@codemirror/lint';
|
|
import { highlightSelectionMatches, searchKeymap } from '@codemirror/search';
|
|
import { EditorState } from '@codemirror/state';
|
|
import {
|
|
crosshairCursor,
|
|
drawSelection,
|
|
dropCursor,
|
|
highlightActiveLine,
|
|
highlightActiveLineGutter,
|
|
highlightSpecialChars,
|
|
keymap,
|
|
lineNumbers,
|
|
rectangularSelection,
|
|
} from '@codemirror/view';
|
|
|
|
const editorSetup = (() => [
|
|
lineNumbers(),
|
|
highlightActiveLineGutter(),
|
|
highlightSpecialChars(),
|
|
history(),
|
|
// foldGutter(),
|
|
// drawSelection(),
|
|
dropCursor(),
|
|
// EditorState.allowMultipleSelections.of(true),
|
|
indentOnInput(),
|
|
syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
|
|
bracketMatching(),
|
|
closeBrackets(),
|
|
autocompletion(),
|
|
// rectangularSelection(),
|
|
// crosshairCursor(),
|
|
highlightActiveLine(),
|
|
highlightSelectionMatches(),
|
|
keymap.of([
|
|
...closeBracketsKeymap,
|
|
...defaultKeymap,
|
|
...searchKeymap,
|
|
...historyKeymap,
|
|
...foldKeymap,
|
|
...completionKeymap,
|
|
...lintKeymap,
|
|
]),
|
|
])();
|
|
|
|
const outputSetup = (() => [
|
|
lineNumbers(),
|
|
highlightSpecialChars(),
|
|
// foldGutter(),
|
|
syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
|
|
highlightActiveLine(),
|
|
EditorState.readOnly.of(true),
|
|
])();
|
|
|
|
export { editorSetup, outputSetup };
|