Upgrade @lezer/lr #8

Closed
opened 2023-05-05 18:48:13 +02:00 by mattzeunert · 3 comments
mattzeunert commented 2023-05-05 18:48:13 +02:00 (Migrated from github.com)

I'm using CodeMirror but I think the underlying issue is in the lezer language repos, so posting here.

This is my editor code:

import { html } from "@codemirror/lang-html"
import { EditorView } from "@codemirror/view"

let view = new EditorView({
    doc: `
    <script>
    /* <![CDATA[ */
    /* ]]> */
    </script>
    `,
    extensions: [
        html()
    ],
    parent: document.body
})

But when I run it I get this error:

main.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'from')
    at F.reset (main.js:1:35867)
    at D.reduceContext (main.js:1:30888)
    at D.reduce (main.js:1:26987)
    at ct.advanceStack (main.js:1:44950)
    at ct.advance (main.js:1:42836)
    at V.advance (main.js:1:20164)
    at main.js:1:261995
    at Pl.withContext (main.js:1:262699)
    at Pl.work (main.js:1:261734)
    at init (main.js:1:264689)

I had a hard time creating a stand-alone repro of the issue, but eventually I found that the error occurs with @lezer/lr@1.3.1 but not @lezer/lr@1.3.4.

I tried upgrading CodeMirror a couple times over the last few months but it didn't fix the issue so I had syntax highlighting disabled in the meantime. I didn't think of manually upgrading @lezer/lr or removing package-lock.json and reinstalling.

Currently @lezer/html depends on ^1.0.0 – would it be possible to upgrade to a newer version?

I think this would also apply to other repos like @lezer/css and @codemirror/language.

I'm using CodeMirror but I think the underlying issue is in the lezer language repos, so posting here. This is my editor code: ```javascript import { html } from "@codemirror/lang-html" import { EditorView } from "@codemirror/view" let view = new EditorView({ doc: ` <script> /* <![CDATA[ */ /* ]]> */ </script> `, extensions: [ html() ], parent: document.body }) ``` But when I run it I get this error: ``` main.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'from') at F.reset (main.js:1:35867) at D.reduceContext (main.js:1:30888) at D.reduce (main.js:1:26987) at ct.advanceStack (main.js:1:44950) at ct.advance (main.js:1:42836) at V.advance (main.js:1:20164) at main.js:1:261995 at Pl.withContext (main.js:1:262699) at Pl.work (main.js:1:261734) at init (main.js:1:264689) ``` I had a hard time creating a stand-alone repro of the issue, but eventually I found that the error occurs with `@lezer/lr@1.3.1` but not `@lezer/lr@1.3.4`. I tried upgrading CodeMirror a couple times over the last few months but it didn't fix the issue so I had syntax highlighting disabled in the meantime. I didn't think of manually upgrading `@lezer/lr` or removing package-lock.json and reinstalling. Currently `@lezer/html` depends on `^1.0.0` – would it be possible to upgrade to a newer version? I think this would also apply to other repos like `@lezer/css` and `@codemirror/language`.
marijnh commented 2023-05-05 19:16:23 +02:00 (Migrated from github.com)

Currently @lezer/html depends on ^1.0.0 – would it be possible to upgrade to a newer version?

No. ^1.0.0 matches 1.3.4. I have no interest in re-releasing every dependent package every time a package gets an update in order to restrict the version ranges to the latest version.

If you've found that the error doesn't occur with the latest @lezer/lr, then I'm not sure why you are reporting this here.

> Currently @lezer/html depends on ^1.0.0 – would it be possible to upgrade to a newer version? No. `^1.0.0` matches `1.3.4`. I have no interest in re-releasing every dependent package every time a package gets an update in order to restrict the version ranges to the latest version. If you've found that the error doesn't occur with the latest @lezer/lr, then I'm not sure why you are reporting this here.
mattzeunert commented 2023-05-05 19:28:43 +02:00 (Migrated from github.com)

I spent over 8 hours looking into the issue I was facing, so I wanted to report it in case others face the same problem and to see if there's some way to fix it so that when someone upgrades Codemirror they automatically get the working version of lr as well.

I don't usually reset package-lock.json. Would you recommend doing that when upgrading Codemirror?

I spent over 8 hours looking into the issue I was facing, so I wanted to report it in case others face the same problem and to see if there's some way to fix it so that when someone upgrades Codemirror they automatically get the working version of lr as well. I don't usually reset package-lock.json. Would you recommend doing that when upgrading Codemirror?
marijnh commented 2023-05-05 21:19:24 +02:00 (Migrated from github.com)

I don't usually reset package-lock.json. Would you recommend doing that when upgrading Codemirror?

Yes. Unfortunately, npm is really dumb about partial upgrades.

> I don't usually reset package-lock.json. Would you recommend doing that when upgrading Codemirror? Yes. Unfortunately, npm is really dumb about partial upgrades.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lezer/html#8
No description provided.