-
Notifications
You must be signed in to change notification settings - Fork 153
Closed
Description
The current behaviour of treating the top level scope as a meta_content_scope
on main doesn't match Sublime. From @keith-hall:
From my testing, I think the top level scope behaviour is:
- for the top level syntax, the scope is never popped off the stack unless clear_scopes is used
- pushing (or setting to) another syntax's main context will cause that syntax's top level scope to be pushed onto the stack, until the main context is no longer on the stack - i.e. like a meta content scope - so what you have now is correct from that regard
- including (as opposed to pushing or setting) another syntax's main context will never cause that syntax's top level scope to be pushed onto the stack
- pushing, setting or including a syntax's non-main context will never cause that syntax's top level scope to be pushed onto the stack
I think I can fix this by rewriting the syntax definitions on load. I'll add the following two contexts to every syntax:
__start:
- meta_content_scope: some.file.scope
- match: ''
push: __main
# The difference below is that including it doesn't include the meta_content_scope
__main:
- include: main
This actually fixes another problem as well which is that the Scala syntax actually can pop the main scope, which causes a panic since there is no context to take patterns from. With this it will just immediately re-push the main context, which I think is what Sublime does.
Metadata
Metadata
Assignees
Labels
No labels