Open KiddoV opened 2 years ago
Debugging other's code is outside the scope of github issues.
I dont see any problem with AceGrammar. The error is that window
is not defined, so it matters what is the scope and context of the function/closure that runs this code. Maybe you can setup a jsfiddle with only the necessary to reproduce the error.
I can't create JSFiddle
. There is no ace_grammar.js
on any CDN platforms.
Can you provide a CDN
link?
My JSFiddle so far: https://jsfiddle.net/KiddoV/vkfg9cos/20/
You can include it manually or you can use the link from github.io https://foo123.github.io/examples/common/js/ace_grammar.min.js
I cannot re-produce the error. Now I got a different error when separate ace.js
and ace_grammar.js
:(
At first, I put the entire library in the same file with ace.js
.
Now I got this error, when doing the same thing...
ace_grammar.min.js?nocache=nonce_1_1657909554027_629:1078
Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'http://wails.localhost/http://wails.localhost/assets/worker-json.js?nocache=nonce_1_1657909554027_629' failed to load.
at ue (http://wails.localhost/assets/ace_grammar.min.js?nocache=nonce_1_1657909554027_629:1078:46)
ue @ ace_grammar.min.js?nocache=nonce_1_1657909554027_629:1078
This is so frustrating. Maybe I use too many libs?
Do I really need worker-json.js
for ace editor?
Ace uses workers in order to handle syntax errors and Ace Grammar uses workers too, taken from Ace. If jsfiddle has problem with that, I dont know. Maybe create a simple example in your own server where this problem is not present.
My App has a few grammar modes defined in global vars:
When I try to set the editor to a different mode,
ace.js
gave me this error:I think it is because I pass global value to the
editor.session.setMode()
, and somehow it would mess withace.js
window global object. Is there anyway that I can set editor to a differentAceGrammar
mode without produce this error?