-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
Could not get external grammar injections to work #6858
Comments
At the moment injects are only applied to tokens generated by begin/end rules. |
To verify, inject against the string scope in typescript. |
@aeschli - i'm trying to get this working for a graphql plugin, but can't get it to work. It's unclear to me what you mean by
does that mean that the injected grammar will only work when the also,
If it helps, this is my config: /* package.json */
"grammars": [
{
"language": "graphql",
"path": "./syntaxes/graphql.json",
"scopeName": "source.graphql"
},
{
"scopeName": "text.mxyzptlk",
"path": "./syntaxes/gql-query.json",
"injectTo": [
"source.graphql"
]
}
], /* gql-todo.json */
{
"fileTypes": [],
"injectionSelector": "comment.graphql",
"name": "TODO",
"patterns": [
{
"match": "\\b(TODO|FIXME|CHANGED)\\b",
"name": "storage.type.class.${1:/downcase}"
},
{
"captures": {
"1": {
"name": "markup.underline.link.radar"
}
},
"match": "<(ra?dar:/(?:/problem|)/(?:[&0-9]+))>",
"name": "storage.type.class.radar"
}
],
"scopeName": "text.mxyzptlk"
} |
@aeschli I also gave this a try recently and was unable to get it working. Are there any example extensions that have a grammar with |
@aeschli It seems like the behavior in 1.8.0-inside is following the begin/end injection. This needs to be expanded somehow to allow the injection to happen on the entire document. Take for example a YAML document using the Jinja templating language - the first value in the document could be a Jinja comment and not necessarily part of the YAML syntax. |
@wholroyd We're using the text mate injection mechanism. Are you saying we lack a feature of it, or are you saying the injection mechanism (restricted to begin/end rules) is too limited? |
@aeschli The later half |
@aeschli running into same problems with graphql-for-vscode plugin. The regex to match starting of the |
@aeschli - I guess the biggest issue I have, which I have not figured out over a couple months of playing with it on the weekends here and there - is how to inject a language syntax regardless of where it is present in the other language's file or syntax structure. How would I inject at the document level instead of within established language patterns? If I have `{{ something }}`` present anywhere in a file, regardless of the language colorized the way I want, how would I go about doing that? |
You can choose a very open selector such as 'source.ts', but unfortunately injected rules will only be looked at when inside a begin/end rule. |
I suppose you can put something equally open like |
Testing #6693
Modified
$\extensions\typescript\package.json
, added to thegrammars
section:Added
$\extensions\typescript\syntaxes\todo.json
:I don't see it being picked up in TypeScript comments (inspecting the tokens also did not show it being picked up):
![image](https://cloud.githubusercontent.com/assets/5047891/15531100/b4f2008c-2258-11e6-96ad-b022373b1738.png)
The text was updated successfully, but these errors were encountered: