Dylan Vester
Dylan Vester

Reputation: 2726

Ace Editor RequireJS Referencing ace/ext-language_tools Dependencies "ace/lib/oop" and "ace/lib/event_emitter"

I'm using RequireJS to load the ace editor. I'm not having any issues getting most of the editor and its dependencies loaded. But I'm specifically referencing ace/ext-language_tools, but it loads additional references "ace/lib/oop" and "ace/lib/event_emitter", but these files don't exist in the ace-build bower library. They only exist in the source code. I'm trying to use the built and minified version, but I can't seem to get these additional files referenced. What am I doing wrong? Is there some reason these files aren't being built with either the CDN version at https://cdnjs.com/libraries/ace/ or the ace-build bower library?

Upvotes: 1

Views: 1437

Answers (2)

Ttonmobile Tonton
Ttonmobile Tonton

Reputation: 1

<div id="editor"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.3/ace.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.3/ext-language_tools.js"></script>

<script>
  editor = ace.edit("editor")
  document.body.appendChild(editor.container)
  editor.container.style.height = '200px'
  editor.setValue("<p>Paragraph</p>")

  editor.setOptions({
    enableBasicAutocompletion: true,
    enableLiveAutocompletion: true,
    enableSnippets: true,
  })
  
editor.session.setMode("ace/mode/html")
editor.setTheme("ace/theme/dracula")
</script>

Upvotes: 0

a user
a user

Reputation: 24149

In built version ace/lib/oop and ace/lib/event_emitter are declared in ace.js file

see the example below

<script src=https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.3/ace.js></script>
<script src=https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.3/ext-language_tools.js></script>

<script>
  editor = ace.edit()
  document.body.appendChild(editor.container)
  editor.container.style.height = '100px'
  editor.setOptions({
    enableBasicAutocompletion: true,
    enableLiveAutocompletion: true,
    enableSnippets: true,
  })
  editor.session.setMode("ace/mode/javascript")
</script>

Upvotes: 1

Related Questions