こんにちは。私のプロジェクトで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";
をロードして、これらのオプションを機能させます。
修理済み! どうもありがとう
他の人が同じように遭遇する可能性があると思うので、このユースケースでドキュメントを更新するためのPRを作成しました。
最も参考になるコメント
言語ツール拡張機能
import "ace-builds/src-noconflict/ext-language_tools";
をロードして、これらのオプションを機能させます。