-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An embedded syntax always has its main scope added #2482
Comments
I like this idea, because the alternative is to create a new named context that just BTW, the behavior of including the base scope seems to mainly be related to how ST resolves context references that refer to the |
Notice that the PHP syntax definition uses |
As a note: this is a side effect of compatibility with TextMate - when referencing a context in an external syntax, the |
A syntax definition has already indirect control about whether the main scope of an embedded syntax is added or not. Not sure whether it is a desirable solution or workaround though. In order to workaround #1062 a syntax needs to include both the As a side effect of this workaround the main scope of the embedded syntax is omitted. The solution with regards to the example of HTML.sublime-syntax looks like: style-css:
- meta_content_scope: meta.tag.style.begin.html
- include: style-common
- match: '>'
scope: punctuation.definition.tag.end.html
set:
- include: style-close-tag
- match: (?=\S)
embed: style-css-embedded
embed_scope: source.css.embedded.html
escape: (?i)(?=(?:-->\s*)?</style)
style-css-embedded:
# workaround for https://github.com/sublimehq/sublime_text/issues/1062
- include: scope:source.css#prototype
- include: scope:source.css The downside of this solution is that we literly never can embed a |
Edit: sorry, wrong issue.
|
Typically we use Because of this, we would know the scope of the syntax that we are embedding. Alternatively, if we are specifying the external syntax via a file name, we are presumably targeting a syntax we have control over. As a result, I propose that a solution would be to skip the external syntax scope name, if If the user wants to include the original scope and a new one, they specify both. That shouldn't be brittle since we are normally specifying the external syntax by scope anyway. Furthermore, Thoughts? |
Sounds sensible to me :) |
Sounds great and straight forward. Avoids the need of intermediate contexts just for meta scope handling. Don't need to abuse |
Unfortunately the implementation of this change looks to be extremely invasive. |
As of build 4075, if a .sublime-syntax has |
When embedding a scope/syntax and using
embed_scope
to set a different scope for the embed, theembed
's main scope is still added to the scope path. This results in duplicated scope names when setting an embed scope likesource.css.embedded.html
.Example from the default HTML.sublime-syntax:
The resulting scope in a
<style>
tag istext.html.basic source.css.embedded.html source.css
.I propose to add another key that control's whether the pushed, set or embedded context's meta scope is added to the scope path to prevent this.
The text was updated successfully, but these errors were encountered: