mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeEditor
synced 2024-11-27 16:40:07 +00:00
CodeEditor: Add basic code completion and snippet support
Bug: 48828 Change-Id: If7d165fc849ca9687dd7d511b0d111b9969fb2a7
This commit is contained in:
parent
26973c1fa9
commit
1373c915df
|
@ -68,6 +68,7 @@ $wgResourceModules['ext.codeEditor.ace'] = array(
|
|||
'ace/mode-json.js',
|
||||
'ace/mode-css.js',
|
||||
'ace/mode-lua.js',
|
||||
'ace/ext-language_tools.js',
|
||||
),
|
||||
) + $tpl;
|
||||
|
||||
|
|
|
@ -183,6 +183,10 @@
|
|||
container.width( box.width() )
|
||||
.height( box.height() );
|
||||
|
||||
// Non-lazy loaded dependencies: Enable code completion
|
||||
ace.require( 'ace/ext/language_tools' );
|
||||
|
||||
// Load the editor now
|
||||
context.codeEditor = ace.edit( editdiv[0] );
|
||||
context.codeEditor.getSession().setValue( box.val() );
|
||||
|
||||
|
@ -193,6 +197,12 @@
|
|||
|
||||
context.codeEditor.setReadOnly( box.prop( 'readonly' ) );
|
||||
|
||||
// The options to enable
|
||||
context.codeEditor.setOptions( {
|
||||
enableBasicAutocompletion: true,
|
||||
enableSnippets: true
|
||||
} );
|
||||
|
||||
// fakeout for bug 29328
|
||||
context.$iframe = [
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue