Open jtaseff-gfms opened 4 months ago
The way you could do this right now is to grab the tokens of the whole document, then loop across the tokens and use the utils.TextmateScopeSelector
utility to query for scopes such as meta.myblock.custom
and variable.myword.custom
.
If you wanted, I could add a third options
argument that accepts the scope meta.myblock.custom
and gets that scope range for you.
I'm assuming your code is closed source and I can't contribute? :stuck_out_tongue:
Hey thanks for the reply. I found a different way by checking if it's already within the meta
block, and then doing a couple small regex after that, so not needed directly. It could still be a cool option for others or in the future but probably a pretty limited use case.
⚡️️ Feature Request
vscode-textmate-languageservice
available.Is your feature request related to a problem?
I have a textmate grammar defined. It includes nested scopes, such as a
meta.myblock.custom
that matches a larger part of the line, and then a specific word scope such asvariable.myword.custom
.I would like to getScopeRange for all of the matched scopes. Right now it returns an array of both scope names, and returns more information about the innermost scope like the position/range of
variable.myword.custom
, but I would love to see the position/range ofmeta.myblock.custom
which is also matched. In the end I'm trying to have some hover text dependent on what's at the start of the meta block.Describe alternatives you've considered
I can reimplement a bunch of the regex defined in the grammar so I can locate the start of the block. But I was hoping since Code already knows these different scopes it would be easy to retrieve.
Found this extension in a long chain of searching around for how to access the scope information at all, thanks for developing this!