Autocomplete, and more CM stuff!

This commit is contained in:
Gregory Schier
2023-02-28 22:54:54 -08:00
parent 1e57890d2e
commit 5040d73a8b
20 changed files with 220 additions and 178 deletions

View File

@@ -1,12 +1,5 @@
import {
Decoration,
DecorationSet,
EditorView,
MatchDecorator,
ViewPlugin,
ViewUpdate,
WidgetType,
} from '@codemirror/view';
import type { DecorationSet, ViewUpdate } from '@codemirror/view';
import { Decoration, EditorView, MatchDecorator, ViewPlugin, WidgetType } from '@codemirror/view';
class PlaceholderWidget extends WidgetType {
constructor(readonly name: string) {
@@ -40,7 +33,7 @@ class BetterMatchDecorator extends MatchDecorator {
}
const placeholderMatcher = new BetterMatchDecorator({
regexp: /\{\{\s*([^}\s]+)\s*}}/g,
regexp: /\$\{\[\s*([^\]\s]+)\s*]}/g,
decoration(match, view, matchStartPos) {
const matchEndPos = matchStartPos + match[0].length - 1;