@@ -3,15 +3,12 @@ import sidebarApps from "sidebarApps";
33import * as cmAutocomplete from "@codemirror/autocomplete" ;
44import * as cmCommands from "@codemirror/commands" ;
55import * as cmLanguage from "@codemirror/language" ;
6- import { HighlightStyle , syntaxHighlighting } from "@codemirror/language" ;
76import * as cmLint from "@codemirror/lint" ;
87import * as cmSearch from "@codemirror/search" ;
98import * as cmState from "@codemirror/state" ;
10- import { Compartment , EditorState , Prec , StateEffect } from "@codemirror/state" ;
119import * as cmView from "@codemirror/view" ;
12- import { EditorView } from "@codemirror/view" ;
1310import ajax from "@deadlyjack/ajax" ;
14- import { tags } from "@lezer/highlight" ;
11+ import * as lezerHighlight from "@lezer/highlight" ;
1512import {
1613 getRegisteredCommands as listRegisteredCommands ,
1714 refreshCommandKeymap ,
@@ -157,7 +154,7 @@ export default class Acode {
157154
158155 const createHighlightStyle = ( spec ) => {
159156 if ( ! spec ) return null ;
160- if ( Array . isArray ( spec ) ) return HighlightStyle . define ( spec ) ;
157+ if ( Array . isArray ( spec ) ) return cmLanguage . HighlightStyle . define ( spec ) ;
161158 return spec ;
162159 } ;
163160
@@ -170,12 +167,12 @@ export default class Acode {
170167 const ext = [ ] ;
171168
172169 if ( styles && typeof styles === "object" ) {
173- ext . push ( EditorView . theme ( styles , { dark : ! ! dark } ) ) ;
170+ ext . push ( cmView . EditorView . theme ( styles , { dark : ! ! dark } ) ) ;
174171 }
175172
176173 const resolvedHighlight = createHighlightStyle ( highlightStyle ) ;
177174 if ( resolvedHighlight ) {
178- ext . push ( syntaxHighlighting ( resolvedHighlight ) ) ;
175+ ext . push ( cmLanguage . syntaxHighlighting ( resolvedHighlight ) ) ;
179176 }
180177
181178 if ( Array . isArray ( extensions ) ) {
@@ -220,10 +217,10 @@ export default class Acode {
220217 createTheme,
221218 createHighlightStyle,
222219 cm : {
223- EditorView,
224- HighlightStyle,
225- syntaxHighlighting,
226- tags,
220+ EditorView : cmView . EditorView ,
221+ HighlightStyle : cmLanguage . HighlightStyle ,
222+ syntaxHighlighting : cmLanguage . syntaxHighlighting ,
223+ tags : lezerHighlight . tags ,
227224 } ,
228225 } ;
229226
@@ -325,6 +322,7 @@ export default class Acode {
325322 autocomplete : cmAutocomplete ,
326323 commands : cmCommands ,
327324 language : cmLanguage ,
325+ lezer : lezerHighlight ,
328326 lint : cmLint ,
329327 search : cmSearch ,
330328 state : cmState ,
@@ -381,6 +379,7 @@ export default class Acode {
381379 this . define ( "@codemirror/search" , cmSearch ) ;
382380 this . define ( "@codemirror/state" , cmState ) ;
383381 this . define ( "@codemirror/view" , cmView ) ;
382+ this . define ( "@lezer/highlight" , lezerHighlight ) ;
384383 this . define ( "createKeyboardEvent" , KeyboardEvent ) ;
385384 this . define ( "toInternalUrl" , helpers . toInternalUri ) ;
386385 this . define ( "commands" , this . #createCommandApi( ) ) ;
0 commit comments