Sublime Forum

Is it possible to expand a capture inside a scope name?

#1

Im working a syntax highlighter for coldfusion, and want to implement paired tags which also name the scope of the tag specifically for themselves.
It is straight forward to use a capture from the begin regex in the end regex, but can it also be done in the scope name?

"pairedtag": {
      "begin": "(<cf(^\\s>]+)(^>]*)>)",
      "beginCaptures": {
        "1": { "name": "entity.tag.open.cfml.\\2" }
      },
      
      "patterns": { "include": "$self" }],
      
      "end": "(</cf\\2>)",
      "endCaptures": {
        "1": { "name": "entity.tag.close.cfml" }
      }
0 Likes

#2

I wouldn’t expect it to, but try it yourself and see.

0 Likes

#3

I have tried, several different syntaxes, but none of them worked.
Hence the question.

The reason that I want it is to allow completions for very specific scopes to be defined without having to explicitly create all of those scopes in the syntax file.

0 Likes

#4

[quote=“mmmpie”]I have tried, several different syntaxes, but none of them worked.
Hence the question.

The reason that I want it is to allow completions for very specific scopes to be defined without having to explicitly create all of those scopes in the syntax file.[/quote]

I’ve been wanting to do this too. It’s not a terrible amount of work if you use multiple selection and the json form then export to xml, finally copy-paste that into the existing ColdFusion.tmLanguage file from the Package Control ColdFusion package.

By the way, why not contribute to the existing ColdFusion package? I can add you on as a developer if we can agree on direction.
Edit: Did you go to law school, I think I remember you from IRC lol :smile:

0 Likes