3

How can I create an autocomplete and how to highlight html, javascript and css inside php for the Ace editor http://ace.ajax.org/.

<html>
    <head>
        <title><?=$title; ?></title>
        <style>
            body {
                background: black;
                color: white;
            }
        </style>
        <script>
            alert("this is only a no-sense test script....");
        </script>
    </head>
    <body>
        This is only a no-sense test script but I want that html tags, css styles and javascript code are highlighted....<br />
        Is it possible?
    </body>
</html>

(sorry for my english)

4

3 回答 3

2

这是两个问题。

  1. 如何创建完成 PHP 的自动完成程序?

  2. 如何在 PHP 代码中语法高亮 HTLM 代码?

对于第二个问题,Google 群里有一些 Ace Editor的讨论在我看来,这个问题是否可能并没有真正得到回答,但至少看起来是可行的。查看 highlighter 的文档,尤其是“嵌入不同的荧光笔”部分。

对于自动完成,我根本看不到机会。请参阅有关类似(最近)问题的Google 群组条目。

于 2011-10-29T14:18:00.360 回答
2

几个月前,Ace 编辑器现在支持自动完成(参见:http ://ace.c9.io/#nav=about )

于 2013-09-07T04:19:15.250 回答
0

对于仍在寻找这个的任何人,我在这里找到了我需要的东西:https ://github.com/ajaxorg/ace/wiki/How-to-enable-Autocomplete-in-the-Ace-editor

我想启用实时自动完成功能,因此还有另一个选项enableLiveAutocompletionenableSnippets(如果可用,请简要说明建议)。

我这样使用它:

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

还有一个示例演示了如何添加自定义完成程序以返回为您的特定项目量身定制的结果。

于 2017-08-04T17:39:51.960 回答