get token string for ace editor
ace-editor, token
Solution
In this way:
editor.on('mousemove', function(e) {
var position = e.getCursorPosition();
var token = editor.session.getTokenAt(position.row, position.column);
});
It will return an Object:
token = {
type: "paren.rparen",
value: "}",
index: 0,
start: 0
}
Problem
I just looked at the kitchen sink demo and see that there is an option "Show token info" that shows up what type of text the mouse is over (variable, function etc.) I want to create something similar that can get the current token string of the word at the current cursor position. Does anyone knows how to do that ? Thanks!