Ace Editor autocomplete and multiple languages

ぃ、小莉子 提交于 2019-12-06 13:06:49

These are two questions.

  1. How can I create an autocompleter that completes PHP?

  2. How can I syntax highlight HTLM code inside PHP code?

For the second question, there is some discussion in the Google group for Ace Editor In my opinion, the question is not really answered if it is possible or not, but it seems at least doable. Have a look at the documentation for highlighter, especially about the part "Embedding a different highlighter".

For autocompletion, I don't see a chance at all. See the Google group entry about a similar (recent) question.

As of a few months ago the Ace Editor now supports autocomplete (see: http://ace.c9.io/#nav=about)

I would like to suggest you can see this project : gherkin-editor. It implements the code complete function upon ace editor

For any one still looking around for this, I found exactly what I needed here: https://github.com/ajaxorg/ace/wiki/How-to-enable-Autocomplete-in-the-Ace-editor

I wanted to enable live auto-completion, so there is another option enableLiveAutocompletion and enableSnippets (to give a brief description of the suggestion if available).

I used it like this:

editor.setOptions({
     enableLiveAutocompletion: true,
     enableSnippets: true
 });

There is also an example demonstrating how you could add a custom completer to return results tailored to your specific project.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!