I'm working on a DSL and try to customize the webEditor. Using the editor works fine as well as the autocompletion when called manually with "Ctrl + Space". Now it would be handy if hinting would be called after any keyup. I found several possible solutions here. Unfortunately, the pop-up window is not shown (but log messages are shown).
Here is my code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Language" content="en-us">
<title>Example Web Editor</title>
<link rel="stylesheet" type="text/css" href="webjars/codemirror/5.41.0/lib/codemirror.css" />
<link rel="stylesheet" type="text/css" href="xtext/2.17.0/xtext-codemirror.css" />
<link rel="stylesheet" type="text/css" href="webjars/codemirror/5.41.0/addon/hint/show-hint.css" />
<script type="text/javascript" src="webjars/codemirror/5.41.0/lib/codemirror.js"></script>
<script type="text/javascript" src="webjars/codemirror/5.41.0/addon/hint/show-hint.js"></script>
<script src="webjars/requirejs/2.3.6/require.min.js"></script>
<script type="text/javascript">
var baseUrl = window.location.pathname;
var fileIndex = baseUrl.indexOf("index.html");
if (fileIndex > 0)
baseUrl = baseUrl.slice(0, fileIndex)
require.config({
baseUrl : baseUrl,
paths : {
"jquery" : "webjars/jquery/3.3.1-1/jquery.min",
"xtext/xtext-codemirror" : "xtext/2.17.0/xtext-codemirror"
},
packages : [ {
name : "codemirror",
location : "webjars/codemirror/5.41.0",
main : "lib/codemirror"
} ]
});
require([ "xtext/xtext-codemirror" ], function(xtext) {
var editor = xtext.createEditor();
editor.on('inputRead', function onChange(editor, input) {
console.log("hey");
CodeMirror.commands.autocomplete(editor);
});
});
</script>
</head>
<body>
<div class="content">
<div id="xtext-editor" data-editor-xtext-lang="adv"></div>
</div>
</body>
</html>
Nothing fancy happens here, I just try to get the autocompletion after any keyup to work.