我在 angularjs 应用程序中使用 UI-codemirror 进行 java 代码编辑,模式设置为“text/x-java”。现在我想使用自动完成和 lint 之类的插件。
对于自动完成,我使用 keyup 和 onKeyUp 设置了如下选项,这两个事件都不会被触发。
在控制器中配置选项:
_this.editorOptions = {
lineWrapping: true,
lineNumbers: true,
mode: 'text/x-java',
smartIndent: true,
tabSize: 4,
indentWithTabs: true,
tabindex: 4,
autofocus: true,
addModeClass: true,
keyup: function (e, s) {
console.log("Event Keyup");
},
onKeyUp: function (e, s) {
console.log("Event Keyup");
}
}
模板中的指令:
<ui-codemirror ui-codemirror-opts="vm.editorOptions" ng-model="vm.activeQuestion.candidateAnswer"></ui-codemirror>
要包含哪些插件 js 脚本以及为这些脚本设置哪些配置选项以进行锻炼?