I’m aware of with_prototype
that adds the rules to the scopes prototype, but I was wondering if there was a way to include a rule as part of the included scopes main context?
includeOtherSyntax:
- match: '{'
set: Packages/MySyntax/MyIncludedSyntax.sublime-syntax
with: # <- some special keyword to merge this with main
- match: '}'
pop: true
I don’t want to add my pop rule to with_prototype
because }
is a valid character in my included syntax so i don’t want to mess with that. Instead I only want my pop rule to be considered if there are no other contexts on the stack.
This is the hack I’ve come up with for now, but I lose the source.myincludedsyntax scope.
MyIncludedSyntax.sublime-syntax:
# define a custom scope that is used only for including
included:
# The prototype is not applied here, so we need to duplicate it
- include: comments
- include: main
- match: '(?=})'
pop: true
MySyntax.sublime-syntax:
popClosingBrace:
- match: '}'
pop: true
optionAfterAssignment_POP:
- match: '{'
set:
- popClosingBrace
- Packages/MySyntax/MyIncludedSyntax.sublime-syntax#included