如何使codiad编辑器能够显示'自动完成建议'我每次在编辑器中输入内容时都使用代码(不使用Ctrl + Space)

时间:2017-04-30 18:06:37

标签: php jquery ace-editor

我知道Codiad使用ace编辑器,如何在codiad中实现这个(下面)ace编辑器的Javascript:

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

1 个答案:

答案 0 :(得分:1)

我自己找到了解决方案。 首先我需要添加

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

index.php中的

。然后编辑&#39; component / editor / init.js&#39;并在下面&#39;应用配置&#39;评论编辑: 老:

applySettings: function(i) {
        // Check user-specified settings
        this.getSettings();`

        // Apply the current configuration settings:
        i.setTheme('ace/theme/' + this.settings.theme);
        i.setFontSize(this.settings.fontSize);
        i.setPrintMarginColumn(this.settings.printMarginColumn);
        i.setShowPrintMargin(this.settings.printMargin);
        i.setHighlightActiveLine(this.settings.highlightLine);
        i.setDisplayIndentGuides(this.settings.indentGuides);
        i.getSession().setUseWrapMode(this.settings.wrapMode);
        this.setTabSize(this.settings.tabSize, i);
        this.setSoftTabs(this.settings.softTabs, i);
                i.setOptions({
    enableBasicAutocompletion: true,
    enableSnippets: true,
    enableLiveAutocompletion: true
});
    },

如:

applySettings: function(i) {
        // Check user-specified settings
        this.getSettings();

        // Apply the current configuration settings:
        i.setTheme('ace/theme/' + this.settings.theme);
        i.setFontSize(this.settings.fontSize);
        i.setPrintMarginColumn(this.settings.printMarginColumn);
        i.setShowPrintMargin(this.settings.printMargin);
        i.setHighlightActiveLine(this.settings.highlightLine);
        i.setDisplayIndentGuides(this.settings.indentGuides);
        i.getSession().setUseWrapMode(this.settings.wrapMode);
        this.setTabSize(this.settings.tabSize, i);
        this.setSoftTabs(this.settings.softTabs, i);
                i.setOptions({
    enableBasicAutocompletion: true,
    enableSnippets: true,
    enableLiveAutocompletion: true
});
    },