Skip to content

Commit

Permalink
chore(docs): minor updates to readme, package.json, ruby start pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
Kumar Harsh committed Oct 24, 2017
1 parent bd42e6d commit 88e077a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 27 deletions.
28 changes: 7 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ VSCode extension for GraphQL schema authoring & consumption.

To see the full configuration, check out the [GQL](https://github.com/Mayank1791989/gql) project's docs.

4. To enable autocomplete support within your JS(X)/TS(X) files, and even your gherkin feature files, add these lines to your `.gqlconfig` file:
4. To enable autocomplete support within your code, add these lines to your `.gqlconfig` file. The `query` section of the config contains an array of `file` config with matchers. You can add more files by directing the `EmbeddedQueryParser` to run when your code within the `startTag` and `endTag` matches:
```js
/* .gqlconfig */
{
Expand All @@ -73,14 +73,18 @@ VSCode extension for GraphQL schema authoring & consumption.
query: {
files: [ /* define file paths which you'd like the gql parser to watch and give autocomplete suggestions for */
{
match: 'ui/src/**/*.js',
match: 'ui/src/**/*.js', // for js
parser: ['EmbeddedQueryParser', { startTag: 'Relay\\.QL`', endTag: '`' }],
isRelay: true,
},
{
match: 'features/**/*.feature',
match: 'features/**/*.feature', // for gherkin
parser: ['EmbeddedQueryParser', { startTag: 'graphql request\\s+"""', endTag: '"""' }],
},
{
"match": "lib/**/*.rb", // sample config you might use for Ruby-aware highlighting (inside `<<-GRAPHQL` heredocs)
"parser": ["EmbeddedQueryParser", { "startTag": "<<-GRAPHQL", "endTag": "GRAPHQL" }]
}
{
match: 'fixtures/**/*.gql',
parser: 'QueryParser',
Expand All @@ -90,24 +94,6 @@ VSCode extension for GraphQL schema authoring & consumption.
}
```

5. Here's an example of a sample config you might use for Ruby-aware highlighting (inside `<<-GRAPHQL` heredocs):

```
{
schema: {
files: "schemas/**/*.gql"
},
query: {
files: [
{
"match": "lib/**/*.rb",
"parser": ["EmbeddedQueryParser", { "startTag": "<<-GRAPHQL", "endTag": "GRAPHQL" }]
}
]
}
}
```

Again, refer to [GQL](https://github.com/Mayank1791989/gql) docs for details about configuring your .gqlconfig.

## Future Plans
Expand Down
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,6 @@
"meta.embedded.block.graphql": "graphql"
}
},
{
"language": "graphql",
"scopeName": "source.graphql",
"path": "./syntaxes/graphql.json"
},
{
"injectTo": [
"source.ruby"
Expand Down
2 changes: 1 addition & 1 deletion syntaxes/graphql.rb.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "taggedTemplates",
"contentName": "meta.embedded.block.graphql",
"begin": "(?=(?><<[-~]('?)|(\"?)((?:[_\\w]+_|)GRAPHQL)\\b\\1))",
"begin": "(?=(?><<[-~](['\"]?)((?:[_\\w]+_|)GRAPHQL)\\b\\1))",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.ruby"
Expand Down

0 comments on commit 88e077a

Please sign in to comment.