Extension:CodeEditor

The CodeEditor extension extends the 1>Special:MyLanguage/Extension:WikiEditor|WikiEditor advanced editing toolbar with an embedded [https://github.com/ajaxorg/ace Ace editor widget], providing some handy features for user/site JavaScript pages, CSS pages, JSON pages, and when extension  is also installed, for Lua pages, i.e. pages in the Module namespace. The code editor does not show on regular wiki pages, i.e. wiki pages with the "wikitext" content model. (See  for syntax highlighting of wikitext when using the source editor.)

It provides the following features:


 * syntax highlighting for JavaScript, CSS and Lua


 * auto-indent


 * tab key produces tab indents (since 1.22), soft indents before.


 * indent/unindent selection with Tab/Shift-Tab keys


 * syntax validity check for JavaScript


 * Pair-matching for parenthesis, braces and square brackets

Configuration

 * To disable the editor on JavaScript and CSS pages in the MediaWiki, User and other core namespaces, set  (default is "true")
 * To disable the editor on JavaScript and CSS pages in the MediaWiki, User and other core namespaces, set  (default is "true")


 * To disable this extension for ext-scribunto>Special:MyLanguage/Extension:Scribunto|Scribunto, i.e. in the module namespace set  (default is "true")
 * To disable this extension for ext-scribunto>Special:MyLanguage/Extension:Scribunto|Scribunto, i.e. in the module namespace set </> (default is "true")

JavaScript
It is possible to change the configuration of the ACE editor, by hooking into the res-loader>ResourceLoader/Core modules#mw.hook</>|MediaWiki JS hook (i.e. <tvar|configure> </>). The argument passed to your hook will be an [<tvar|ace-editor>http://ace.c9.io/api/edit_session.html</> ACE editor session].

License
While this extension is licensed 1>phab:diffusion/ECED/browse/master/COPYING</>|GNU General Public License v2.0 or later (GPL-2.0+) it makes use of the [<tvar|ace>https://ace.c9.io/#nav=about</> Ace editor software] which is licensed [<tvar|bsd>https://raw.githubusercontent.com/ajaxorg/ace/master/LICENSE</> BSD 3-clause "New" or "Revised" License (BSD-3-Clause)].