question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No language features for .graphql files since v0.5.0 (only colorization)

See original GitHub issue

I’ve been trying to make the latest versions of this extension to work but it seems like completion (and most other language features) broke since v0.5.0. Note that everything works fine in v0.4.15.

The project I’m currently working on is here, in case you want to check out my setup. But as a summary, my graphql.config.json file looks like this:

{
    "schema": "./graphql-server/introspection.json",
    "documents": "./graphql-server/**/*.graphql"
}

And I’m using codegen with the following configuration:

schema: './graphql-server/schema.ts'
documents: './graphql-server/**/*.graphql'
generates:
  ./graphql-server/introspection.json:
    plugins:
      - introspection
    config:
      minify: true
  ./graphql-server/sdk.ts:
    plugins:
      - add:
          content: '// @ts-nocheck Ignore this file, it is just codegen output'
      - typescript
      - typescript-operations
      - typescript-graphql-request
      - plugin-typescript-swr
    config:
      skipTypename: true
  ./graphql-server/resolvers-types.ts:
    plugins:
      - add:
          content: '// @ts-nocheck Ignore this file, it is just codegen output'
      - typescript
      - typescript-resolvers

The logs only show the following:

8/14/2022, 2:55:11 PM [3] (pid: 7005) graphql-language-service-usage-logs: {"type":"usage","messageType":"initialize"}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:20 (20 by maintainers)

github_iconTop GitHub Comments

1reaction
MariaSolOscommented, Aug 28, 2022

@MariaSolOs another clue, i suspect maybe logic I introduced with cacheProjectFiles() in messageprocessor could have caused some issues here

@acao So I’m not sure if it is a caching issue per se, but I think I have a fix 😃 #2720

1reaction
MariaSolOscommented, Aug 26, 2022

Okay so I have an update: After debugging for a bit today I discovered that the problem is not parseDocument but in getTokenAtPosition. The returned token is not correct, resulting in whack completions that don’t apply to the cursor’s position.

As an example, I was comparing the behaviour in v0.4.15 versus the current one with the following mutation:

mutation createSnippet(
    $name: String!, 
    $description: String!
) {
    createSnippet(
        name: $name, 
        description: $description
    ) {
        id
        | <- cursor triggering completions
    }
}

In v0.4.15, the kind of this token would be Field, but now it is Document.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GraphQL: Language Feature Support
Extension for Visual Studio Code - GraphQL LSP extension that adds autocompletion, validation, go to definition, hover, outline and more.
Read more >
GraphQL schema basics - Apollo GraphQL Docs
This article describes the fundamental building blocks of a schema and how to create one for your GraphQL server. The schema definition language....
Read more >
feature: language support for vue files · Issue #1678 · graphql ...
Just create a .vue file and try to write a query using gql tag, you will just get graphql snippets and basic syntax...
Read more >
GraphQL specification
GraphQL is not a programming language capable of arbitrary computation, ... Documents are only executable by a GraphQL service if they contain an ......
Read more >
vocab.txt - Hugging Face
0 1 2 3 4 5 6 7 8 9 : ; < = > ? ... ##ources base ##igger github Since color...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found