I am using ace-builds to build my ace editor app with webpack.
I need to use a custom worker for syntax validation. The wiki page here suggests to extend a worker named mirror
obtained by following.
var Mirror = require("ace/worker/mirror").Mirror;
But ace-builds does not seem to provide this worker. How do I create a custom worker for syntax validation using ace-builds?
Any other advice on how to build an ace editor app with a custom syntax validating worker (for a custom programming language) is much appreciated. (I cannot use the ace library supposed to be used with require.js, as it uses require.toUrl
which webpack does not know about. See github issue)
ace-builds repository provides only built workers, and doesn't have source of ace/worker/mirror in a separate file.
You can use json worker to bootstrap your custom one, since it contains only 200 lines of extra code https://github.com/ajaxorg/ace-builds/blob/master/src/worker-json.js#L1409-L1699
rename that file to "<mymode>_worker.js"
and add worker definition at the end.
define("ace/mode/<mymode>_worker",["require","exports","module"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var Mirror = require("../worker/mirror").Mirror;
...
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With