Use ensureSyntaxTree to not get visually broken blocks when syntax tree parsing is slow.

Update @codemirror/language to latest version.

Force a #build in order to get a Mac x86 verion built which is slower on rosetta to hopefully check that the problem is fixed.
This commit is contained in:
Jonatan Heyman 2023-01-13 14:39:35 +01:00
parent 95c8f5ef2b
commit 8867937567
3 changed files with 10 additions and 7 deletions

11
package-lock.json generated
View File

@ -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",

View File

@ -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",

View File

@ -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