36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import { history, defaultKeymap, historyKeymap } from '@codemirror/commands'
|
|
import { bracketMatching, indentOnInput } from '@codemirror/language'
|
|
import { highlightSpecialChars, drawSelection, dropCursor, keymap } from '@codemirror/view'
|
|
import { closeBrackets, autocompletion, completionKeymap } from '@codemirror/autocomplete'
|
|
import { EditorState, Compartment } from '@codemirror/state'
|
|
import { searchKeymap } from '@codemirror/search'
|
|
import { shrimpKeymap } from './keymap'
|
|
import { shrimpTheme, shrimpHighlighting } from './theme'
|
|
import { shrimpLanguage } from './shrimpLanguage'
|
|
import { shrimpErrors } from './errors'
|
|
import { persistencePlugin } from './persistence'
|
|
import { catchErrors } from './catchErrors'
|
|
|
|
export const shrimpSetup = (lineNumbersCompartment: Compartment) => {
|
|
return [
|
|
catchErrors,
|
|
shrimpKeymap,
|
|
highlightSpecialChars(),
|
|
history(),
|
|
drawSelection(),
|
|
dropCursor(),
|
|
EditorState.allowMultipleSelections.of(true),
|
|
bracketMatching(),
|
|
closeBrackets(),
|
|
autocompletion(),
|
|
indentOnInput(),
|
|
keymap.of([...defaultKeymap, ...historyKeymap, ...searchKeymap, ...completionKeymap]),
|
|
lineNumbersCompartment.of([]),
|
|
shrimpTheme,
|
|
shrimpLanguage,
|
|
shrimpHighlighting,
|
|
shrimpErrors,
|
|
persistencePlugin,
|
|
]
|
|
}
|