graphql / graphql/graphiql

[vscode-graphql] Auto-complete doesn't work when string is not assigned to variable

Open
#2,443 0 comments 0 reactions 0 assignees View on GitHub
lsp-server
Dominant language
TypeScript
Stars
16.9k
Forks
1.9k
Avg merge
22h 45m
Merged PRs (30d)
70

Description

This might be related to #2270? I can reliably reproduce the following. I'm using the `/* GraphQL */` comment prefixing a normal template literal (not using `gql` tag). If this string is assigned to a variable, the auto-complete works, if not then it won't. Either way the syntax highlighting will be applied, but only in the first case does it actually provide the auto-complete.

Working:
```
const anything = /* GraphQL */ `
...etc
`
```

Not working:
```
/* GraphQL */ `
...etc
`
```

Note this doesn't occur when using the `gql` tag in the same way. I haven't been able to track this down as to why that is the case.

------

For context, my GraphQL strings are being processed by an external tool and code is generated from them, but they are never used in the app directly. So it is helpful to not assign them to variables to make it clear they are never used (and shouldn't be used).

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.