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.

Definition support for operation fields

See original GitHub issue

When writing a query, you should be able to go-to definition on individual fields, but that is not working.

Here is a demo repo with reproducible config.

No definition found for [field name]

Given this graphql.config.js

module.exports = {
  schema: "./build/schema.graphql",
};

And this build/schema.graphql

type Query {
  items: [Item]!
}

type Item {
  fieldOne: String!
  fieldTwo: String!
}

When writing this query, I’d expect go-to definition on items to take me to line 2 of the schema or go-to definition on fieldOne or fieldTwo to take me to line 6 or 7, respectively, of the schema.

query MyQuery {
  items {
    fieldOne
    fieldTwo
  }
}

As far as I can tell, the graphql config is correct, which is demonstrated by the fact that code completion and validation is happening.

See this demo below, where you can see code completion working, but go-to definition failing.

https://user-images.githubusercontent.com/3206804/171949633-9b2d0a07-f7fe-419b-8613-006e17fd1c1c.mov

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
acaocommented, Jun 15, 2022

This should be available in the last few vscode-graphql releases now, thanks to @stonexer . Thanks everyone for reporting this!

2reactions
stonexercommented, Jun 6, 2022

It could be added to this file in the LSP server, one would just need to add another case to the switch statement, and a method, like this:

Screenshot 2022-06-04 at 15 00 05

perhaps a utility function in graphql-language service/interface getDefinition.ts. which, as a side note, should eventually contain a generalized, node.js-free function that can be used by the LSP server’s language service and monaco-graphql. either way, this code will end up being used by monaco-graphql when we add definitions support.

if anyone is interested in learning how to add this feature, let me know!

CC @stonexer @zth @orta

It looks interesting, I’d like to give a try

Read more comments on GitHub >

github_iconTop Results From Across the Web

Field operation Definition | Law Insider
Field operation means an operation conducted by employees that is outside of the employer's fixed establishment, such as mobile clinics, health screening ...
Read more >
Field Operations Manager: Definition, Job Description, Salary ...
Field operations managers are responsible for executing and improving their company's field marketing, sales, and merchandising initiatives. This may include ...
Read more >
Field of operation - Definition, Meaning & Synonyms
the activity of providing goods and services involving financial and commercial and industrial aspects.
Read more >
Operational Support Job | Primary Services | Career Fit
Operational support staff ensures that the business runs smoothly, effectively, and professionally. This includes everyone from management to front line workers ...
Read more >
Field Operations Manager: Definition, Job Description, Salary
He/she is responsible for quality management and productivity by continually analyzing, assessing, and improving processes while supporting the ...
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