CodeMirror.registerHelper(
"hint",
"csharp",
(cm, callback, options) => {
var cur = cm.getCursor();
var tok = cm.getTokenAt(cur);
$.post(
{
code: cm.getValue(),
position: cm.indexFromPos(cur),
language: 1,
line: cur.line,
},
(result) => {
callback({
list: JSON.parse(result) || [],
from: CodeMirror.Pos(cur.line, tok.end),
to: CodeMirror.Pos(cur.line, tok.end)
});
}
);
});
CodeMirror.commands.autocomplete = cm => {
CodeMirror.showHint(cm, CodeMirror.hint.csharp, { async: true });
};
It seems to be working fine.
But i have an issue. When autocomplete list box is displayed typing more does not filter the list. How to filter the autocomplete list base on what user types.