Sublime Forum

Including context in prototype context disables prototype everywhere

#1

Here’s a minimal repro for what I’m seeing:

contexts:
  prototype:
    - include: comment

  main:
    - include: expression

  comment:
    - match: '{-#'
      push:
        - match: '#-}'
          pop: true
        - include: expression
    - match: --.*
      scope: comment

  expression:
    - match: '\('
      push:
        - match: '\)'
          pop: true

for a test file

-- asdf1
(
  -- asdf2
)

Both of the -- lines should be comments, but with the above syntax definition, the asdf2 comment is not a comment. It seems like because the expression context is included in a subcontext of the comment context, it disables the prototype even though the match that includes the context is never triggered.

Is this expected behavior? I don’t see anything mentioned this in the docs. If so, is there any way I can disable this behavior?

0 Likes

#2

Contexts referenced from prototype have meta_include_prototype always set to false. Getting rid of the - include: expression inside comment resolves your issue.

0 Likes

#3

I see. Should the docs be updated to say that?

In my case, I do in fact need it in the prototype context. Am I forced to duplicate my entire expression context for the context?

0 Likes

#4

Ok I got it. I can manually add

  - include: prototype

inside expression as a workaround

0 Likes