From 88e077a249e67f72c96747f1d3cdd2402b4084b7 Mon Sep 17 00:00:00 2001 From: Kumar Harsh Date: Tue, 24 Oct 2017 23:05:40 +0530 Subject: [PATCH] chore(docs): minor updates to readme, package.json, ruby start pattern --- README.md | 28 +++++++--------------------- package.json | 5 ----- syntaxes/graphql.rb.json | 2 +- 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index eebe767..b57fe02 100644 --- a/README.md +++ b/README.md @@ -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 */ { @@ -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', @@ -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 diff --git a/package.json b/package.json index 431dd36..8e8d9a2 100644 --- a/package.json +++ b/package.json @@ -105,11 +105,6 @@ "meta.embedded.block.graphql": "graphql" } }, - { - "language": "graphql", - "scopeName": "source.graphql", - "path": "./syntaxes/graphql.json" - }, { "injectTo": [ "source.ruby" diff --git a/syntaxes/graphql.rb.json b/syntaxes/graphql.rb.json index ecc385a..505d056 100644 --- a/syntaxes/graphql.rb.json +++ b/syntaxes/graphql.rb.json @@ -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"