Javascript examples for CodeMirror:Configuration
CodeMirror custom showHint() call
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" type="text/css" href="https://codemirror.net/lib/codemirror.css"> <link rel="stylesheet" type="text/css" href="https://codemirror.net/addon/hint/show-hint.css"> <script type="text/javascript" src="https://codemirror.net/lib/codemirror.js"></script> <script type="text/javascript" src="https://codemirror.net/addon/hint/show-hint.js"></script> <script type="text/javascript"> window.onload=function(){//from ww w. j a va 2s . c o m var editor = CodeMirror.fromTextArea(document.getElementById("code"), { // options here }); editor.on('cursorActivity', function(){ var options = { hint: function() { return { from: editor.getDoc().getCursor(), to: editor.getDoc().getCursor(), list: ['foo', 'bar'] } } }; editor.showHint(options); }); } </script> </head> <body> <textarea id="code">// Move the cursor around here to activate showHint </textarea> </body> </html>