graphql / graphql/graphiql

A gql tag isn't recognized for syntax highlighting when it includes a type parameter.

Open
#1,675 3 comments 1 reaction 0 assignees View on GitHub
bug vscode-graphql-syntax
Dominant language
TypeScript
Stars
16.9k
Forks
1.9k
Avg merge
22h 45m
Merged PRs (30d)
70

Description

## Actual Behavior

```
const VehicleFragment = gql`
query getVehicle {
vehicle {
...VehicleMake
}
}
`

const VehicleFragment = gql<"Vehicle">`
fragment VehicleMake on Vehicle {
name
}
`
```

The plugin understands, and can validate, the fact that the `VehicleMake` fragment exists (no error in the top document). However, the second document appears without syntax highlighting or any other integration within the editor.

I've tested this in TypeScript, I'm unsure about Flow.

## Expected Behavior

Tagged template literals with type parameters work the same as without.

## Steps to Reproduce the Problem Or Description

Add a type parameter to any `gql` tag - this isn't project-specific. We wrap Apollo's `gql`, but I don't think it's really relevant since this problem is outside TypeScript or runtime.

## Specifications

- GraphQL for VSCode Extension Version:
- VSCode Version: 0.3.1
- OS Name: Windows / MacOS
- OS Version: Windows 10 / MacOS 10.14.6

## Logs Of TS Server || GraphQL Language Service

The two errors below show up regardless of project or file for me.

```
9/2/2020, 5:34:08 PM [4] (pid: 89125) graphql-language-service-usage-logs: {"type":"usage","messageType":"initialize"}

undefined
9/2/2020, 5:34:09 PM [1] (pid: 89125) graphql-language-service-usage-logs: invalid/unknown file in graphql config documents entry:
'./src/**/*.tsx'

9/2/2020, 5:34:09 PM [1] (pid: 89125) graphql-language-service-usage-logs: Error:
Unable to find any GraphQL type definitions for the following pointers:

- ./src/**/*.tsx

undefined
undefined
9/2/2020, 5:34:14 PM [4] (pid: 89125) graphql-language-service-usage-logs: {"type":"usage","messageType":"textDocument/didOpen","projectName":"default","fileName":"file:[path-to-file]"}

undefined
9/2/2020, 5:34:49 PM [4] (pid: 89125) graphql-language-service-usage-logs: {"type":"usage","messageType":"textDocument/didChange","projectName":"default","fileName":"file:[path-to-file]"}

undefined
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.