How to get the name of the capture where the cursor/selection is?


I want to get the name of the grammar capture of my selection, or of my current cursor, how can I do this in the script? The name is defined in grammar cson file as the following.



With a Cursor, this will get an array of all the scopes at that point

With a TextEditor, this will get it for the provided Point.