React-ace: 无法让自动完成或片段工作

创建于 2020-04-03  ·  3评论  ·  资料来源: securingsincity/react-ace

问题

您好,我正在尝试在我的一个项目中使用 react-ace,但我无法让自动完成或片段工作。

我的渲染方法如下:

render(): JSX.Element {

        return (<>
                    <ContentPage>
                        <AceEditor
                            placeholder="Placeholder Text"
                            mode="html"
                            theme="monokai"
                            name="blah2"
                            width="inherit"
                            onChange={this.onCodeChange}
                            fontSize={14}
                            showPrintMargin={true}
                            showGutter={true}
                            highlightActiveLine={true}
                            setOptions={{
                                enableBasicAutocompletion: true,
                                enableLiveAutocompletion: true,
                                enableSnippets: true,
                                showLineNumbers: true,
                                tabSize: 2
                            }}
                        />
                    </ContentPage>
        </>);
    }

我的进口是:

import AceEditor from "react-ace";
import "ace-builds/src-noconflict/mode-html";
import "ace-builds/src-noconflict/theme-monokai";

页面加载良好,编辑器使用语法高亮显示,我只是没有看到自动完成/代码段对话框。

我得到的唯一警告是(这听起来像是问题):

ace.js:4316 misspelled option "enableBasicAutocompletion"
warn @ ace.js:4316
ace.js:4316 misspelled option "enableLiveAutocompletion"
warn @ ace.js:4316
ace.js:4316 misspelled option "enableSnippets"

任何帮助都会很棒,谢谢!

最有用的评论

加载语言工具扩展import "ace-builds/src-noconflict/ext-language_tools";来加载这些选项。

所有3条评论

加载语言工具扩展import "ace-builds/src-noconflict/ext-language_tools";来加载这些选项。

固定的! 非常感谢@nightwing

创建了一个 PR 来更新这个用例的文档,因为我想其他人可能会遇到同样的情况。

https://github.com/securingsincity/react-ace/pull/816

此页面是否有帮助?
0 / 5 - 0 等级