ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

ACE MySQL在线编辑器插件,能自动补全和语法高亮

2019-09-11 19:09:25  阅读:66  来源: 互联网

标签:getSession 补全 ACE 插件 ace &# editor 设置 true



<!DOCTYPE html>
<head>
    <style type="text/css" media="screen">
        #editor {width: 800px;height: 400px; position: absolute; top: 0; right: 0; bottom: 0; left: 0; font-size: 20px;
        }
    </style>
</head>
<body>
<div id="editor"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.3.0/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="./js/ace/sql.js" type="text/javascript" charset="utf-8"></script>
<script src="./js/ace/cb-complete-list.js" type="text/javascript" charset="utf-8"></script>
<script src="./js/ace/ext-language_tools.js" type="text/javascript" charset="utf-8"></script>
<script>
    var editor = ace.edit("editor");
    editor.setTheme("ace/theme/monokai"); //主题
    editor.getSession().setMode("ace/mode/drools"); // 语言高亮
    // editor.setReadOnly(false);//设置只读(true时只读,用于展示代码)
    //自动换行,设置为off关闭
    editor.setOption("wrap", "free");
    //以下部分是设置输入代码提示的
    editor.setOptions({
        enableBasicAutocompletion: true,
        enableSnippets: true,
        enableLiveAutocompletion: true
    });
    editor.getSession().setUseWrapMode(true); //支持代码折叠
    //editor.getSession().setMode(&#39;ace/mode/javascript&#39;); //设置语言模式
    editor.selection.getCursor(); //获取光标所在行或列
    //editor.gotoLine(lineNumber); //跳转到行
    editor.session.getLength(); //获取总行数
    // editor.insert("Something cool");
    editor.getSession().setUseSoftTabs(true);
</script>
</body>
</html>

最终效果



标签:getSession,补全,ACE,插件,ace,&#,editor,设置,true

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有