dotansimha / dotansimha/graphql-code-generator
Generate source maps pointing from generated file to it's source
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
It would be great if one could easily jump to the `.graphql` file the symbol from the `.ts` file was created from.
E.g. we have this code in `main.tsx`:
```ts
import { withGetOverview } from 'graphql';
// ...
export const OverviewRoot = withGetOverview /* @Pos1 */(
{ options: props => ({ variables: { groupAmount: 1} }) }
)(OverviewConnected);
```
and the query in `query.graphql`:
```graphql
# @Pos2
query GetOverview($groupAmount: Int!) {
...
}
```
It would be great if I could navigate from `@Pos1` directly to `@Pos2`.
There are multiple ways to implement that:
* Sourcemaps
* Typescript Language Service Plugin
A sourcemap would map `graphql.tsx` to `query.graphql` and other graphql files. However, an editor extension would be required that navigates to the source (like `Source maps navigator` in vscode).
A typescript language service plugin would override the definition lookup method.
What do you think?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.