graphiql icon indicating copy to clipboard operation
graphiql copied to clipboard

Feature: Go to definition support for union

Open ba-nitesh opened this issue 3 years ago • 10 comments

Wonderful work team! This really helps during the development process! Thanks a lot.

Currently, go-to definition support is not there. It would be great if we can support the go-to definition for a union.

ba-nitesh avatar Jul 19 '22 05:07 ba-nitesh

Hey and thanks @ba-nitesh 👋 in our test schema I can successfully

  • Cmd-click a field that returns a union
  • Click the union type in the mouseover tooltip
  • Cmd-Click a union member type in an inline fragment

Can you specify which case exactly is not working for you? Can you also tell us which GraphiQL version you are seeing this issue in?

https://user-images.githubusercontent.com/22288634/179691052-4a75400e-20c3-409e-ad57-57551c3fbcca.mp4

thomasheyenbrock avatar Jul 19 '22 07:07 thomasheyenbrock

To clarify this repository getting used by vs-code extension GraphQl right?

ba-nitesh avatar Jul 19 '22 08:07 ba-nitesh

In the description mentioned that go to definition supports for input, enum, type only. (go to definition support (input, enum, type))

ba-nitesh avatar Jul 19 '22 08:07 ba-nitesh

Sorry, I implicitly assumed this is about GraphiQL 😅 🙈 I'm not that familiar with the VSCode extension, pinging @acao here

thomasheyenbrock avatar Jul 19 '22 09:07 thomasheyenbrock

No worry, Thanks for your response. Let me know if I can help you guys.

ba-nitesh avatar Jul 19 '22 12:07 ba-nitesh

@ba-nitesh thank you

Currently we only support these cases for definition lookup, however that file is where one would want to start to add this behavior!

And can I ask, are you referring to jumping to a union from a query?

# example.graphql
union MySearchUnion = Document | Media
# anotherfile.graphql
type Query {
   search: MySearchUnion # < this should jump to example.graphql on cmd/ctrl + click
}

correct?

acao avatar Jul 19 '22 15:07 acao

Right, your example is completely conveying what I am trying to say. Thanks!

ba-nitesh avatar Jul 19 '22 16:07 ba-nitesh

fabulous! we can add that

acao avatar Jul 19 '22 16:07 acao

You are great! When are we planning to add this and how long would it take to release the vs-code extension update?

ba-nitesh avatar Jul 19 '22 16:07 ba-nitesh

@ba-nitesh sorry I cannot say, I've been quite busy with work!

acao avatar Jul 24 '22 16:07 acao

https://github.com/graphql/graphiql/pull/3150

I believe this PR should resolve it! Raised the PR before realising there was an issue for it already.

That being said, pretty new to this codebase, so might be missing something with the approach!

AaronMoat avatar Apr 25 '23 06:04 AaronMoat