question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature request] Support injection/highlighting in gatsby's "graphql(`...`)"

See original GitHub issue

Thanks for an incredibly useful plugin!

Gatby has an unusual way of calling graphql in it’s Node Apis.

const result = await graphql(`
    query {
      allMarkdownRemark {
        edges {
          node {
            fields {
              slug
            }
          }
        }
      }
    }
  `)

In this case graphql is not a tag, but a function that returns a Promise. It would be nice if this plugin was able to recognize queries inside of it. You can see an official example here https://www.gatsbyjs.org/docs/node-apis/#createPages

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:8
  • Comments:6

github_iconTop GitHub Comments

9reactions
jimkyndemeyercommented, Oct 23, 2019

Hi le0nik.

Thanks for using the plugin.

I’ll label this as an enhancement.

For now you can manually trigger GraphQL language injection by adding a //language=GraphQL comment on the line above the graphql function, e.g.:

//language=GraphQL
const result = await graphql(`
    query {
      allMarkdownRemark {
        edges {
          node {
            fields {
              slug
            }
          }
        }
      }
    }
  `)

Best regards, Jim.

5reactions
jimmyncommented, Mar 16, 2020

Please add support for /* GraphQL */, this is very much needed

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Feature request] Support injection/highlighting in gatsby's ...
I believe syntax highlight detection is different per framework. Example. Gatsby - graphql(; Apollo - gql(; My project - dispatch("graphql/query ...
Read more >
GraphQL Query Options - Gatsby
This page will walk you through a series of GraphQL queries, each designed to demonstrate a particular feature of GraphQL. These examples will...
Read more >
ADDING FEATURES TO YOUR GATSBY SITE - This Dot Labs
Enter $ gatsby develop on the terminal (make sure you are in the project directory) which will enable Gatsby spin up a local...
Read more >
Featured Plugin: JS GraphQL | The WebStorm Blog
The plugin brings full support for the GraphQL Schema Definition Language (SDL). That means your .graphql file will include syntax highlighting, ...
Read more >
GraphQL - Diving Deep – The Guild
This will help us to make the end-end request-response lifecycle ... of this would be Gatsby where irrespective of the source of data, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found