This is because the position given in the onDefinition handler seems to be after the selected text. Other language extensions rely on document.getWordRangeAtPosition to handle this.
This will take some more thought and probably looking at how getWordRangeAtPosition works, I would guess it is not sufficient as is for our uses (probably does not handle operators next to symbols with no space in between).