apollographql / apollographql/apollo-tooling

Extension treats entire TS file as GraphQL document

Open
#2,222 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

![Captura de pantalla 2021-02-26 a las 11 28 27](https://user-images.githubusercontent.com/10449993/109294972-dbb30e00-7825-11eb-9af9-4213d11cb625.png)

**Intended outcome:**

To have only jurisdiction over content inside ` gql`` ` tags

**Actual outcome:**

The extension treats TS file as a whole as GraphQL schema. I don't know if it is connected to this issue but also I get errors about **@client** directive not being defined, not being able to query local fields on Query/Mutation and the whole error checking feature is not refreshing even if I fix the problem, for example: when I change in schema **`type`** to **`tye`** it reports it's a syntax error but when I fix it, the editor still complains about the error. Additionally, just after the VSCode launch, no errors are shown in any file as long as I don't make an error in .graphql file.

There should be no conflict with other extension as Apollo GraphQL is the only GraphQL extension I have installed.

**How to reproduce the issue:**

Config:


module.exports = {
client: {
service: 'ForgeServe-Hermes-36d71',
// Files processed by the extension
includes: [
'src/**/*.vue',
'src/**/*.js',
'src/**/*.ts',
'src/**/*.graphql',
],
},
}

**Versions**

v1.18.2

Contributor guide

Open the contributing guide

Research direction

Start with the Apollo GraphQL extension configuration, especially the client.includes entries for .ts and .graphql files, and reproduce the behavior using version v1.18.2. Verify that TypeScript files are parsed only for content inside gql tags, that @client and local-field diagnostics behave correctly, and that errors refresh after edits.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.