graphql / vscode-graphql

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

Extension not associated with `.graphqls` files #176

Closed cailloumajor closed 4 years ago

cailloumajor commented 4 years ago

Actual Behavior

While this extension supports .graphqls files, Visual Studio Code is not aware of it.

Expected Behavior

Associate this extension with .graphqls files.

Steps to Reproduce the Problem Or Description

Open a .grapphqls file:

Specifications

Logs Of TS Server || GraphQL Language Service

Not relevant

acao commented 4 years ago

this extension loads .graphql files. i have never seen the .graphqls extension before, sorry!

cailloumajor commented 4 years ago

@acao:

this extension loads .graphql files

Not only, as I already said, this extension supports, among others, .graphqls file type. Taking a look at grammars/graphql.json, you can find:

https://github.com/prisma-labs/vscode-graphql/blob/4ac143f52f47baa9a9e139865a0ecf930a0f9430/grammars/graphql.json#L4

i have never seen the .graphqls extension before

This doesn't mean there is no need for it:

cailloumajor commented 4 years ago

See also:

acao commented 4 years ago

i’m not in disagrement at all! just haven’t noticed it before. i will be sure to add it to the underlying LSP server repo, which is in graphql/graphiql. most of the business logic for this extension lives there

cailloumajor commented 4 years ago

i’m not in disagrement at all!

Sorry, I felt you were by closing the issue...

acao commented 4 years ago

ope i guess i did. will get to all this soon!

acao commented 4 years ago

if you can, re-create this ticket for the language server? and you can add this extension to the list in a PR. they are all defined in one place

cailloumajor commented 4 years ago

@acao thank you for re-opening.

I think the problem is simpler than you think: the contents of .graphqls files is standard GraphQL language, the extension is just different to denote the purpose of the file, i.e. schema definition. My request here is just that VSCode handles .graphqls files exactly the same manner as .graphql files. There is no need to add a new language.

My apologies if my request was not clear enough.

I achieved to obtain the needed behavior by adding ".graphqls" to the array below in package.json. https://github.com/prisma-labs/vscode-graphql/blob/6bdfa89e63f737134b2d9a6a4e8959092b0e2fbf/package.json#L48-L51

If you agree with this change, I would be glad to open a pull request.

acao commented 4 years ago

please open the PR, you don’t need my permission! you will also need a PR to graphql/graphiql repo, otherwise you’ll only have highlighting support for .graphqls files

acao commented 4 years ago

for reference, this line would be the only other thing you need to change for this to work end to end!

changing the configuration you are pointing to will only add highlighting support. the graphql/graphiql repo is where all the logic for validation, code completion (aka intellisense), and everything else live.