refactor: minor ui improvements

This commit is contained in:
liyasthomas
2021-12-04 18:59:26 +05:30
parent 0de9f3d8c3
commit 084039f59f
40 changed files with 154 additions and 90 deletions

View File

@@ -18,7 +18,11 @@ import { lineNumbers, highlightActiveLineGutter } from "@codemirror/gutter"
import { defaultKeymap } from "@codemirror/commands"
import { bracketMatching } from "@codemirror/matchbrackets"
import { closeBrackets, closeBracketsKeymap } from "@codemirror/closebrackets"
import { searchKeymap, highlightSelectionMatches } from "@codemirror/search"
import {
searchKeymap,
highlightSelectionMatches,
searchConfig,
} from "@codemirror/search"
import { autocompletion, completionKeymap } from "@codemirror/autocomplete"
import { commentKeymap } from "@codemirror/comment"
import { rectangularSelection } from "@codemirror/rectangular-selection"
@@ -207,17 +211,15 @@ export const baseHighlightStyle = HighlightStyle.define([
{ tag: t.invalid, color: editorInvalidColor },
])
const baseFoldStyle = foldGutter({
openText: "▾",
closedText: "▸",
})
export const basicSetup: Extension = [
lineNumbers(),
highlightActiveLineGutter(),
highlightSpecialChars(),
history(),
baseFoldStyle,
foldGutter({
openText: "▾",
closedText: "▸",
}),
EditorState.allowMultipleSelections.of(true),
indentOnInput(),
defaultHighlightStyle.fallback,
@@ -227,6 +229,9 @@ export const basicSetup: Extension = [
rectangularSelection(),
highlightActiveLine(),
highlightSelectionMatches(),
searchConfig({
top: true,
}),
keymap.of([
...closeBracketsKeymap,
...defaultKeymap,