react-ace
react-ace copied to clipboard
Can't load snippets/python.js file
When I set up enableSnippets: true, the page can not load the snippets/python.js file, how can I fix it?
Thanks very much.
@TimonPeng Can you give a code example? Also, did you make sure to include ext-language_tools (https://github.com/ajaxorg/ace/blob/master/demo/autocompletion.html)
@TimonPeng you can import the snippets and mode directly through brace along with the language_tools. Here is an example below
import React from 'react';
import { render } from 'react-dom';
import brace from 'brace';
import AceEditor from 'react-ace';
import 'brace/mode/python';
import 'brace/snippets/python';
import 'brace/ext/language_tools';
import 'brace/theme/github';
function onChange(newValue) {
console.log('change',newValue);
}
// Render editor
render(
<AceEditor
mode="python"
theme="github"
onChange={onChange}
name="UNIQUE_ID_OF_DIV"
editorProps={{$blockScrolling: true}}
enableBasicAutocompletion={true}
enableLiveAutocompletion={true}
enableSnippets={true}
/>,
document.getElementById('example')
);