Skip to content
This repository was archived by the owner on Jul 31, 2022. It is now read-only.

Commit fe8f15e

Browse files
authored
feature: embedded rescript & reason highlighting support (#290)
1 parent 33a5edc commit fe8f15e

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

grammars/graphql.re.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"fileTypes": ["re", "ml"],
3+
"injectionSelector": "L:source -string -comment",
4+
"patterns": [
5+
{
6+
"contentName": "meta.embedded.block.graphql",
7+
"begin": "({)(gql)(\\|)",
8+
"end": "(\\|)(\\2)(})",
9+
"patterns": [
10+
{
11+
"include": "source.graphql"
12+
}
13+
]
14+
},
15+
{
16+
"contentName": "meta.embedded.block.graphql",
17+
"begin": "(\\[%graphql)s*$",
18+
"end": "(?<=])",
19+
"patterns": [
20+
{
21+
"begin": "^\\s*({\\|)$",
22+
"end": "^\\s*(\\|})",
23+
"patterns": [{ "include": "source.graphql" }]
24+
}
25+
]
26+
},
27+
{
28+
"contentName": "meta.embedded.block.graphql",
29+
"begin": "(\\[%graphql {\\|)",
30+
"end": "(\\|}( )?])",
31+
"patterns": [{ "include": "source.graphql" }]
32+
}
33+
],
34+
"scopeName": "inline.graphql.re"
35+
}

grammars/graphql.rescript.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"fileTypes": ["res", "resi"],
3+
"injectionSelector": "L:source -string -comment",
4+
"patterns": [
5+
{
6+
"contentName": "meta.embedded.block.graphql",
7+
"begin": "(%graphql\\()\\s*$",
8+
"end": "(?<=\\))",
9+
"patterns": [
10+
{
11+
"begin": "^\\s*(`)$",
12+
"end": "^\\s*(`)",
13+
"patterns": [{ "include": "source.graphql" }]
14+
}
15+
]
16+
},
17+
{
18+
"contentName": "meta.embedded.block.graphql",
19+
"begin": "(%graphql\\(`)",
20+
"end": "(\\`( )?\\))",
21+
"patterns": [{ "include": "source.graphql" }]
22+
}
23+
],
24+
"scopeName": "inline.graphql.res"
25+
}

package.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,27 @@
7777
"meta.embedded.block.graphql": "graphql"
7878
}
7979
},
80+
{
81+
"injectTo": [
82+
"source.reason",
83+
"source.ocaml"
84+
],
85+
"scopeName": "inline.graphql.re",
86+
"path": "./grammars/graphql.re.json",
87+
"embeddedLanguages": {
88+
"meta.embedded.block.graphql": "graphql"
89+
}
90+
},
91+
{
92+
"injectTo": [
93+
"source.rescript"
94+
],
95+
"scopeName": "inline.graphql.res",
96+
"path": "./grammars/graphql.rescript.json",
97+
"embeddedLanguages": {
98+
"meta.embedded.block.graphql": "graphql"
99+
}
100+
},
80101
{
81102
"injectTo": [
82103
"text.html.markdown"

0 commit comments

Comments
 (0)