removed duplication and unnecessary keymappings in codemirror config

This commit is contained in:
Dsm0 2025-07-16 15:17:34 -07:00
parent 06fafbd8eb
commit 5448fc6077
3 changed files with 10 additions and 11 deletions

View file

@ -27,24 +27,24 @@ export const basicSetup = (() => [
// highlightActiveLineGutter(), // highlightActiveLineGutter(),
highlightSpecialChars(), highlightSpecialChars(),
history(), history(),
// foldGutter(), // foldGutter(),
drawSelection(), // drawSelection(),
dropCursor(), dropCursor(),
// EditorState.allowMultipleSelections.of(true), // EditorState.allowMultipleSelections.of(true),
// indentOnInput(), // indentOnInput(),
// syntaxHighlighting(defaultHighlightStyle, { fallback: true }), // syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
// autocompletion(), // autocompletion(),
rectangularSelection(), rectangularSelection(),
crosshairCursor(), crosshairCursor(),
// highlightActiveLine(), // highlightActiveLine(),
highlightSelectionMatches(), // highlightSelectionMatches(),
keymap.of([ keymap.of([
...closeBracketsKeymap, ...closeBracketsKeymap,
...defaultKeymap, ...defaultKeymap,
...searchKeymap, // ...searchKeymap,
...historyKeymap, ...historyKeymap,
...foldKeymap, // ...foldKeymap,
...completionKeymap, // ...completionKeymap,
]), ]),
])(); ])();

View file

@ -1,7 +1,7 @@
import { closeBrackets } from '@codemirror/autocomplete'; import { closeBrackets } from '@codemirror/autocomplete';
export { toggleComment, toggleBlockComment, toggleLineComment, toggleBlockCommentByLine } from '@codemirror/commands'; export { toggleComment, toggleBlockComment, toggleLineComment, toggleBlockCommentByLine } from '@codemirror/commands';
// import { search, highlightSelectionMatches } from '@codemirror/search'; // import { search, highlightSelectionMatches } from '@codemirror/search';
import { history, indentWithTab } from '@codemirror/commands'; import { indentWithTab } from '@codemirror/commands';
import { javascript, javascriptLanguage } from '@codemirror/lang-javascript'; import { javascript, javascriptLanguage } from '@codemirror/lang-javascript';
import { defaultHighlightStyle, syntaxHighlighting, bracketMatching } from '@codemirror/language'; import { defaultHighlightStyle, syntaxHighlighting, bracketMatching } from '@codemirror/language';
import { Compartment, EditorState, Prec } from '@codemirror/state'; import { Compartment, EditorState, Prec } from '@codemirror/state';
@ -97,7 +97,6 @@ export function initEditor({ initialCode = '', onChange, onEvaluate, onStop, roo
// indentOnInput(), // works without. already brought with javascript extension? // indentOnInput(), // works without. already brought with javascript extension?
// bracketMatching(), // does not do anything // bracketMatching(), // does not do anything
syntaxHighlighting(defaultHighlightStyle), syntaxHighlighting(defaultHighlightStyle),
history(),
EditorView.updateListener.of((v) => onChange(v)), EditorView.updateListener.of((v) => onChange(v)),
drawSelection({ cursorBlinkRate: 0 }), drawSelection({ cursorBlinkRate: 0 }),
Prec.highest( Prec.highest(

View file

@ -28,5 +28,5 @@ const keymaps = {
export function keybindings(name) { export function keybindings(name) {
const active = keymaps[name]; const active = keymaps[name];
return [active ? active() : []]; return [active ? Prec.high(active()) : []];
} }