How to use mirror working for ace editor with ace-builds

I use ace-builds to build my ace editor application using webpack.

I need to use a custom working to check the syntax. The wiki page here offers an extension of the employee named mirror , obtained as follows.

var Mirror = require("ace/worker/mirror").Mirror;

But ace-builds doesn't seem to provide this worker. How to create a custom syntax checker using ace-builds?

Any other advice on how to create an application for the Aces editor using special syntax that confirms the work (for a custom programming language) is welcome. (I can't use the ace library that should be used with require.js, since it uses require.toUrl , which the web package does not know about. See github issue )

+6
source share
1 answer

ace-builds repository provides only created workers and does not have an ace / worker / mirror source in a separate file.

You can use json worker to load your custom as it only contains 200 lines of additional code https://github.com/ajaxorg/ace-builds/blob/master/src/worker-json.js#L1409-L1699

rename this file to "<mymode>_worker.js" and add the employee 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; ... }); 
+1
source

Source: https://habr.com/ru/post/1015289/


All Articles