graphql / vscode-graphql

MIGRATED: VSCode GraphQL extension (autocompletion, go-to definition, syntax highlighting)
https://marketplace.visualstudio.com/items?itemName=Prisma.vscode-graphql
MIT License
557 stars 71 forks source link

Extension does not show autocomplete/annotations if gql file is included in documents field #288

Closed ChrisW-B closed 2 years ago

ChrisW-B commented 3 years ago

Actual Behavior

If my .graphqlrc file looks like the following:

projects:
  projA:
    schema: ./schema/projA.generated.graphql
    include: '**/projA/**/*.gql'
    extensions:
      endpoints:
        default:
          url: ${PROJ_A_QUERY_URL}
  projB:
    schema: ./schema/projB.generated.graphql
    include: '**/*.gql'
    extensions:
      endpoints:
        default:
          url: ${PROJ_B_QUERY_URL}

I have full working annotations and autocomplete. However, this means that certain linting does not work with https://github.com/dotansimha/graphql-eslint, as some of those require the documents field be used rather than the include.

This same config

projects:
  projA:
    schema: ./schema/projA.generated.graphql
    documents: '**/projA/**/*.gql'
    extensions:
      endpoints:
        default:
          url: ${PROJ_A_QUERY_URL}
  projB:
    schema: ./schema/projB.generated.graphql
    documents: '**/*.gql'
    extensions:
      endpoints:
        default:
          url: ${PROJ_A__QUERY_URL}

does not surface annotations. With debugging turned on, the only output from vscode-graphql is

Debugger listening on ws://localhost:6009/1957c500-62e2-4b13-aefa-99772de13fd1
Debugger listening on ws://localhost:6009/1957c500-62e2-4b13-aefa-99772de13fd1
For help, see: https://nodejs.org/en/docs/inspector
3/5/2021, 3:34:35 PM [4] (pid: 14457) graphql-language-service-usage-logs: {"type":"usage","messageType":"initialize"}

Expected Behavior

Annotations and autocomplete should still work

Steps to Reproduce the Problem Or Description

  1. configure project with a schema similar to
    schema: ./schema.graphql
    documents: '**/*.gql'
    extensions:
    endpoints:
    default:
      url: ${QUERY_URL}
  2. Attempt to edit a .gql file

    Specifications

    • GraphQL for VSCode Extension Version: v0.3.15
    • VSCode Version: 1.55.0-insider
    • OS Name: MacOS
    • OS Version: v11.2.2

Logs Of TS Server || GraphQL Language Service

Debugger listening on ws://localhost:6009/1957c500-62e2-4b13-aefa-99772de13fd1
Debugger listening on ws://localhost:6009/1957c500-62e2-4b13-aefa-99772de13fd1
For help, see: https://nodejs.org/en/docs/inspector
3/5/2021, 3:34:35 PM [4] (pid: 14457) graphql-language-service-usage-logs: {"type":"usage","messageType":"initialize"}
rohit-gohri commented 3 years ago

I have the same problem, the only difference being I'm using .graphql files.

waterdrop01 commented 3 years ago

Could it be the same issue as mine https://github.com/graphql/vscode-graphql/issues/315?

In my case queries are written in .js files using graphql-tag package. However even removing include or documents doesn't enable autocomplete.

acao commented 2 years ago

the issues you are having should be fixed now, let me know if I should re-open