Open neopostmodern opened 6 years ago
Hi,
In order to add your custom snippet (for example for sql mode) you need to :
`const { snippetManager } = ace.acequire('ace/snippets');
const customSnippetText = [ "snippet log", " console.log(\"${1:}\")", "" ].join('\n');
const customSnippet = snippetManager.parseSnippetFile(customSnippetText, 'sql');
snippetManager.register(customSnippet, 'sql');`
Note: snippet content must be start with \t, example:
const customSnippetText = [
'snippet log',
'\tconsole.log("${1:}")',
].join('\n');
Otherwise an error(text.match is not a function) will be thrown when selecting a snippet . Because snippet content is undefined. parseSnippetFile
I tried copying one of the files in
brace/snippets/
and loading it from my own sources, but that seems to have no effect. Also, callingbrace.acequire(...)
manually for the defined virtual path is without effect.Any hints?