Is there a way to get the positions of a particular symbol (that come from the Grammar)in a text ? view.syntaxName() give me the symbol name for a position but I want the opposite. I've found the view.getSymbols() but it work only for the symbols declared in Symbol List, but it's close to what I want.
If it doesn't exists what about add it to next version ? Please...
sublimator wrote:view.matchSelector(pt, s) will determine if scope 's' matches at point 'pt'
You'll have to create your own function to findAll regions matching a scope, but that's not very hard.
I'm not sure I'm understand what You mean.
If I want the positions of all functions in a python source, so basically all occurrence of the scope "source.python meta.function.python". So to use view.matchSelector() I need to check every word in the source, it would be really inefficient. Or is it something hidden behind findAll ?
I suppose ST already parse the source and record the positions of the scopes, so we only need a method to ask ST where the scopes 'x' are.
I raise this question because I need this kind of functionality and look the best way to implement it. A priori, only Jon could answer.
A practical example is a command to switch from interface to implementation of a method when both are in same file, like Delphi. Using scope mean that I use the already defined syntax from language versus define my own RE to find them.
Actually, is finding occurrences of a scope using internal ST2 command quicker than a find with RE (is there some internal structure that hold this information when syntax highlight is processed) ? Do you think my request have a chance to be heard ?
The realistic case can be a control to switch through program to rendering of a technique whenever the two are usually in identical file, including Delphi. Applying setting imply I exploit your by now defined syntax through vocabulary compared to outline my very own RE to uncover all of them.In fact, is actually discovering events of a setting making use of inner ST2 control more quickly than a discover along with RE (is presently there a few inner design that carry these records whenever syntax spotlight is actually processed)? Think my own demand get an opportunity to be noticed?