Gatsby: VSCode goto Definition navigation not working

Created on 12 Feb 2019  路  8Comments  路  Source: gatsbyjs/gatsby

Summary

I have created 3 different projects with Gatsby, and i used VSCode as an editor, and in all of them I cannot get "go to Definition" feature working.

That means for example hovering over a js import and doing Ctrl + click does not navigate to the imported file, something that slows down my development.

Anyone else facing the same issue?

stale? bug

Most helpful comment

I've got a solution...specify a jsconfig.json:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "*": ["src/*"]
    },
    "jsx": "react"
  }
}

@wardpeet @pieh @chatzipan

All 8 comments

Seems to work here:
kapture 2019-02-12 at 21 55 40
I'm no expert in vs code tho, so I don't know why it doesn't work for You :(

Hmm.. its really weird, I use VScode as my standard editor, and its just my Gatsby projects where this doesn't work.. i guess i need to search it more

I don't have any issues either 馃槢 Does peek definition work?

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

Thanks for being a part of the Gatsby community! 馃挭馃挏

Hey again!

It鈥檚 been 30 days since anything happened on this issue, so our friendly neighborhood robot (that鈥檚 me!) is going to close it.

Please keep in mind that I鈥檓 only a robot, so if I鈥檝e closed this issue in error, I鈥檓 HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

Thanks again for being part of the Gatsby community!

I'm also seeing this issue, though it works for installed modules located in node_modules folder, but no user created files...

I believe this is because I am using the gatsby-plugin-root-import plugin:

_gatsby-config.js_

{
  plugins: [
      resolve: "gatsby-plugin-root-import",
      options: {
        components: path.join(__dirname, "src/components"),
        hooks: path.join(__dirname, "src/hooks"),
        images: path.join(__dirname, "src/images"),
        utils: path.join(__dirname, "src/utils"),
      },
    },
  ]
}

To test this, I created a new gatsby site using npx gatsby-cli new testing. On loading the Layout component, I successfully clicked through to the Header component.

@wardpeet @pieh @chatzipan

I've got a solution...specify a jsconfig.json:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "*": ["src/*"]
    },
    "jsx": "react"
  }
}

@wardpeet @pieh @chatzipan

jsconfig.json

Doesn't work. After 1-5 seconds with loaded gatsby project, "Go to definition", path suggestions on import. and other Intellisence stuff of VSCode stopped working. Very annoying.

"Typescritp Restart TS Server" from command palette can help temporarily.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

totsteps picture totsteps  路  3Comments

kalinchernev picture kalinchernev  路  3Comments

hobochild picture hobochild  路  3Comments

andykais picture andykais  路  3Comments

brandonmp picture brandonmp  路  3Comments