diff --git a/package-lock.json b/package-lock.json index 8fd209b..e8aeccd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "Heynote", - "version": "0.0.1", + "version": "1.0.0-dev", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "Heynote", - "version": "0.0.1", + "version": "1.0.0-dev", "devDependencies": { "@codemirror/commands": "^6.1.2", "@codemirror/lang-html": "^6.4.0", @@ -18,6 +18,7 @@ "@codemirror/lang-php": "^6.0.1", "@codemirror/lang-python": "^6.1.1", "@codemirror/lang-sql": "^6.3.3", + "@codemirror/language": "^6.4.0", "@codemirror/rangeset": "^0.19.9", "@codemirror/search": "^6.2.3", "@electron/asar": "^3.2.2", @@ -205,9 +206,9 @@ } }, "node_modules/@codemirror/language": { - "version": "6.3.2", - "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.3.2.tgz", - "integrity": "sha512-g42uHhOcEMAXjmozGG+rdom5UsbyfMxQFh7AbkeoaNImddL6Xt4cQDL0+JxmG7+as18rUAvZaqzP/TjsciVIrA==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.4.0.tgz", + "integrity": "sha512-Wzb7GnNj8vnEtbPWiOy9H0m1fBtE28kepQNGLXekU2EEZv43BF865VKITUn+NoV8OpW6gRtvm29YEhqm46927Q==", "dev": true, "dependencies": { "@codemirror/state": "^6.0.0", diff --git a/package.json b/package.json index 9bef580..18d31a4 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "@codemirror/lang-php": "^6.0.1", "@codemirror/lang-python": "^6.1.1", "@codemirror/lang-sql": "^6.3.3", + "@codemirror/language": "^6.4.0", "@codemirror/rangeset": "^0.19.9", "@codemirror/search": "^6.2.3", "@electron/asar": "^3.2.2", diff --git a/src/editor/block/note-block.js b/src/editor/block/note-block.js index 4fd53fc..6128ef6 100644 --- a/src/editor/block/note-block.js +++ b/src/editor/block/note-block.js @@ -2,7 +2,7 @@ import { ViewPlugin, EditorView, Decoration, WidgetType, lineNumbers } from "@co import { layer, RectangleMarker } from "@codemirror/view" import { EditorState, RangeSetBuilder, StateField, Facet , StateEffect} from "@codemirror/state"; import { RangeSet } from "@codemirror/rangeset"; -import { syntaxTree } from "@codemirror/language" +import { syntaxTree, ensureSyntaxTree } from "@codemirror/language" import { Note, Document, NoteDelimiter } from "../lang-heynote/parser.terms.js" import { IterMode } from "@lezer/common"; import { heynoteEvent, LANGUAGE_CHANGE } from "../annotation.js"; @@ -13,7 +13,8 @@ let firstBlockDelimiterSize function getBlocks(state) { const blocks = []; - syntaxTree(state).iterate({ + + ensureSyntaxTree(state, state.doc.length).iterate({ enter: (type) => { if (type.type.id == Document || type.type.id == Note) { return true