Hello,i am struggling to make ghosttext work.
I am not sure if this is the right way to implement it but ghosttext is showing.
But when i press tab it does not apply the text and adds tab from cursor position.
var ghostTextArray = ["foo", "bar"];
//Find Match Text
editor.on('input', function(){
var position = editor.getCursorPosition();
var token = editor.session.getTokenAt(position.row, position.column);
for(var i = 0; i < ghostTextArray.length; i++){
//If Match
if(ghostTextArray[i].startsWith(tokenVal)){
editor.setGhostText(ghostTextArray[i].slice(tokenVal.length), position);
break;
};
};
});
Is there any example of implementation of ghosttext?
Thanks