facebook / relay

Relay is a JavaScript framework for building data-driven React applications.
https://relay.dev
MIT License
18.27k stars 1.8k forks source link

[resolution-path] Add support for SchemaDocument #4626

Closed tobias-tengler closed 3 months ago

tobias-tengler commented 4 months ago

This extends the resolution-path module with the capability to resolve paths within a SchemaDocument. The following new types have gained path resolution support:

This is in preparation for better LSP support within schema (extension) documents.

captbaritone commented 4 months ago

Ah! I've wanted this for so long but haven't gotten around to it. Let me know when this is ready to review.

It might also be worth checking if we need additional changes in the VSCode extension to get this working end to end. It's possible that we don't hook into .graphql files in the same way we do for js/ts/tsx (I'm really not sure)

tobias-tengler commented 4 months ago

Yes, the extension doesn't activate on .graphql files and the internal lsp resources are also not created until you open a document with "JavaScriptFeatures". I've started to address this in https://github.com/facebook/relay/pull/4627 (still early).

captbaritone commented 3 months ago

Overall, this looks good! That said it's a pretty huge PR. I know GitHub makes this a bit of a pain, but what do you think about splitting this into a few different PRs?

Maybe:

  1. Add the spans to the schema AST
  2. Other changes to existing structs (e.g. default_value, ConstantArg,
  3. Resolution code for schema AST
tobias-tengler commented 3 months ago

Sounds good. I've created the one for the Spans here: https://github.com/facebook/relay/pull/4633

captbaritone commented 3 months ago

Spans PR has been merged