ACE 编辑器中的自动完成 [英] Autocompletion in ACE editor

查看:71
本文介绍了ACE 编辑器中的自动完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了类似的问题:Ace 编辑器自动完成和多种语言

但答复是 ACE 不支持自动完成,并且根据 Ace 编辑器的 Google 群组这是我对 Ace 的愿望,我们绝对需要它适用于 Cloud9".

But the responses were that autocompletion is not supported by ACE, and according to Google group for Ace Editor "It is on my wishlish for Ace and we definitively need it for Cloud9".

这篇文章已经有一年了,如您所见,cloud9 现在支持自动补全:https://c9.io/site/features/

This post is one year old and as you can see, the cloud9 supports autocompletion now: https://c9.io/site/features/

那么 Ace Editor 中是否默认提供自动补全功能?我找不到有关它的任何信息.

So is autocompletion available in Ace Editor by default? I cannot find any information about it.

推荐答案

自动完成现在是 API 的正式部分.启用它需要 3 行代码:

Autocomplete is now an official part of the API. Enabling it takes 3 lines of code:

ace.require("ace/ext/language_tools");
var editor = ace.edit("editor");
editor.setOptions({
    enableBasicAutocompletion: true
});

根据您对 require-js 的设置,您可能还需要在页面的 html 中包含一个额外的 javascript 文件:

Depending on your setup with require-js, you may also need to include an additional javascript file in the html for your page:

<script src="ace/ext-language_tools.js"></script>

您可以在 https://github.com/找到演示ajaxorg/ace/blob/master/demo/autocompletion.html

这是我刚刚写的关于这个主题的 wiki 页面:

And here's the wiki page I just wrote on the topic:

https://github.com/ajaxorg/ace/wiki/How-to-enable-Autocomplete-in-the-Ace-editor

这篇关于ACE 编辑器中的自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆