Skip to content

[lsp-server] Support JS/TS files as schema files #3587

Open
@addiebarron

Description

I left a related issue on the graphql-config repository: kamilkisiela/graphql-config#1425

Current Behavior (if applicable)

I work on a project that defines its GraphQL schema in gql tags across a number of .ts files in the server directory. We generate a schema.graphql file from those code files in the pre-commit step using graphql-codegen, but during development the most up-to-date information about the schema is in those gql tags, not in the schema.graphql file.

In VSCode, clicking through any client-side definitions (e.g. command-clicking a query name in an operation) sends me to the generated schema rather than the typescript (which is what we'd consider the "source of truth").

Desired Behavior

If JS/TS files are passed to the graphql-config schema field, VSCode should construct a schema from the gql tags in those files and use that as the source of truth.

This could be accomplished using the CodeFileLoader included in graphql-tools.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions