Skip to content

[apollo-graphql] vscode gql tag functionality broken when relative globs used in includes config #1002

@warmbowski

Description

@warmbowski

Auto-complete and type hints do not work in gql tagged template literals when the includes config setting in apollo.config.js file has relative globs in it (globs that start with ./). Some of this is documented in issue #690.

Intended outcome:

When I set my includes glob to includes: ['./examples/**/*.{ts,tsx}'], I expect that project files with gql tagged template literals that match that glob work with apollo-graphql extension auto-complete and type hint hover functionality in the graphql query. And when clicking the status bar ApolloGraphQL button when in a file that matches the glob, a status message similar to below is displayed.

------------------------------
🚀 Apollo GraphQL v1.4.5
------------------------------
✅ Service Loaded!
🆔 Service ID: OSTK GraphQL Demo1
🏷 Schema Tag: current
📈 Number of Types: 45 (0 client types)
------------------------------

Actual outcome:

apollo-graphql extension functionality doesn't work in vscode. There are no type hints or auto-complete based on schema. Moreover, when clicking the status bar ApolloGraphQL button when in a file other than apollo.config.js the error message below is shown in the OUTPUT panel.

------------------------------
🚀 Apollo GraphQL v1.4.5
------------------------------
❌ Service stats could not be loaded. This may be because you're missing an apollo.config.js file or it is misconfigured. For more information about configuring Apollo projects, see the guide here (https://bit.ly/2ByILPj).

Changing the includes config to includes: ['examples/**/*.{ts,tsx}'], (relative but without ./ at the beginning) makes it work as expected.

How to reproduce the issue:
Open an apollo-graphql based project that has client.service.localSchemaFile, client.service.url, or apollo engine set up and working properly. Set up a folder outside of the src/ folder (this should skirt the default includes - in my case it was examples/) with a component the uses a gql tagged template literal. Try different includes config setting with and without ./ at the beginning to see the difference in behaviour

Versions
apollo@2.4.4
vscode@1.31.0
apollo-graphql@1.4.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions