Skip to content

Commit a4104de

Browse files
committed
[vscode] Add support for Ruby documents
1 parent f5eb721 commit a4104de

4 files changed

Lines changed: 39 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
- `apollo-tools`
2525
- <First `apollo-tools` related entry goes here>
2626
- `vscode-apollo`
27-
- <First `vscode-apollo` related entry goes here>
27+
- Add support for Ruby source files using `<<-GRAPHQL...GRAPHQL` heredoc. [#1304](https://github.com/apollographql/apollo-tooling/pull/1304)
2828

2929
## `apollo@2.12.4`, `apollo-language-server@1.9.0`, `vscode-apollo@1.7.0`
3030

packages/vscode-apollo/package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@
100100
"embeddedLanguages": {
101101
"meta.embedded.block.graphql": "graphql"
102102
}
103+
},
104+
{
105+
"injectTo": [
106+
"source.ruby"
107+
],
108+
"scopeName": "inline.graphql.ruby",
109+
"path": "./syntaxes/graphql.rb.json",
110+
"embeddedLanguages": {
111+
"meta.embedded.block.graphql": "graphql"
112+
}
103113
}
104114
],
105115
"commands": [

packages/vscode-apollo/src/languageServerClient.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,15 @@ export function getLanguageServerClient(
4747
"javascriptreact",
4848
"typescriptreact",
4949
"vue",
50-
"python"
50+
"python",
51+
"ruby"
5152
],
5253
synchronize: {
5354
fileEvents: [
5455
workspace.createFileSystemWatcher("**/.env"),
55-
workspace.createFileSystemWatcher("**/*.{graphql,js,ts,jsx,tsx,vue,py}")
56+
workspace.createFileSystemWatcher(
57+
"**/*.{graphql,js,ts,jsx,tsx,vue,py,rb}"
58+
)
5659
]
5760
},
5861
outputChannel
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"fileTypes": ["rb"],
3+
"injectionSelector": "L:source -string -comment",
4+
"patterns": [
5+
{
6+
"contentName": "meta.embedded.block.graphql",
7+
"begin": "(?=(?><<[-~](['\"]?)((?:[_\\w]+_|)GRAPHQL)\\b\\1))",
8+
"beginCaptures": {
9+
"0": {
10+
"name": "punctuation.definition.string.begin.ruby"
11+
}
12+
},
13+
"end": "\\s*\\2$\\n?",
14+
"endCaptures": {
15+
"0": {
16+
"name": "punctuation.definition.string.end.ruby"
17+
}
18+
},
19+
"patterns": [{ "include": "source.graphql" }]
20+
}
21+
],
22+
"scopeName": "inline.graphql.ruby"
23+
}

0 commit comments

Comments
 (0)