Also support type=speculationrules and type=importmap for <script> tags. #7

Closed
bmeurer wants to merge 1 commit from importmap_speculationrules into main
bmeurer commented 2023-08-28 15:26:48 +02:00 (Migrated from github.com)

This was noticed while fixing https://crbug.com/1473875 upstream (which was about pretty printing, unrelated to CodeMirror6), that there's currently no syntax highlighting for these inline JSON

This was noticed while fixing https://crbug.com/1473875 upstream (which was about pretty printing, unrelated to CodeMirror6), that there's currently no syntax highlighting for these inline JSON <script>s that are used on the Web Platform. Ref: https://crbug.com/1473875 cc @domenic
marijnh commented 2023-08-28 16:09:07 +02:00 (Migrated from github.com)

Attached patch provides something like this by using the JS parser (which is already a dependency) in expression mode instead, to avoid pulling in an additional parser.

Attached patch provides something like this by using the JS parser (which is already a dependency) in expression mode instead, to avoid pulling in an additional parser.
bmeurer commented 2023-08-28 16:38:27 +02:00 (Migrated from github.com)

Thanks, works like a charm!

Thanks, works like a charm!
lianee commented 2023-08-28 18:37:53 +02:00 (Migrated from github.com)

Line 18 causes the following error:

RangeError: Invalid top rule name SingleExpression
    at LRParser.configure (index.js:1523:23)
[Line 18](https://github.com/codemirror/lang-html/blob/a52e0263a89303c7aee48f334de09f483680881d/src/html.ts#L18) causes the following error: ``` RangeError: Invalid top rule name SingleExpression at LRParser.configure (index.js:1523:23) ```
marijnh commented 2023-08-29 10:28:38 +02:00 (Migrated from github.com)

@lianee I guess you have a very old version of @lezer/javascript locked in your package lock (and since the dependency is transitive there's no semver requirement in @codemirror/lang-html forcing it).

@lianee I guess you have a very old version of @lezer/javascript locked in your package lock (and since the dependency is transitive there's no semver requirement in @codemirror/lang-html forcing it).
lianee commented 2023-08-29 11:35:45 +02:00 (Migrated from github.com)

@marijnh that was it: I had @lezer/javascript@1.0.2 installed as a dependency of @codemirror/lang-javascript
npm i @lezer/javascript now install an up to date version and all is good.
Thanks a lot

@marijnh that was it: I had @lezer/javascript@1.0.2 installed as a dependency of @codemirror/lang-javascript `npm i @lezer/javascript` now install an up to date version and all is good. Thanks a lot

Pull request closed

Sign in to join this conversation.
No reviewers
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
codemirror/lang-html!7
No description provided.