[Question] [language server] implied fragments and support for imports
See original GitHub issueIn my GraphQL build system that I set up (built on top of graphql-code-generator and @graphql-tools/import) I require explicit fragment imports:
# import SomeFragment from "./some-path.graphql"
query MyQuery {
someField { ...SomeFragment }
}
I do this in order to minimize the potential for fragment name conflicts and make it easier to share fragments across packages.
However, this language server seems to assume that all fragments are globally available which is not always the case. Is there a way to configure this? If not, would you accept a contribution to make this configurable?
I’m also curious to learn how others deal with sharing fragments across packages. Is using explicit imports good practice? Or is it better to make all fragments globally available and then be careful to make all fragment names unique across the codebase?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Standard C++20 Modules support with MSVC in Visual Studio ...
/std:c++latest Implies C++ Modules. Private Module fragments are a new form of API encapsulation for primary Module interfaces.
Read more >Fragment manager - Android Developers
FragmentManager allows you to support multiple back stacks with the saveBackStack() and restoreBackStack() methods. These methods allow you to ...
Read more >IO tools (text, CSV, HDF5, …) — pandas 1.5.2 documentation
In [1]: import pandas as pd In [2]: from io import StringIO In [3]: data = "col1,col2,col3\na,b ... New in version 1.5.0: Support...
Read more >API - esbuild
#ESM. The esm format stands for "ECMAScript module". It assumes the environment supports import and export syntax. Entry points ...
Read more >Frequently Asked Questions About Studio
The Studio Editor supports Hebrew and Arabic characters, as well as bidirectional editing. Importing Files. Question: Can I import class definitions or routines ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dotansimha I can believe that it’s hard to implement, and from what I’ve seen so far all the tooling support for imports is pretty variable (which is understandable given that this is not something that’s standarised).
However, I find it hard to imagine a world where we don’t support imports. Implied fragments work fine for small codebases, but for large monorepos where fragments are shared between many packages I feel like it’s going to be really hard to ensure that all fragments are unique.
All excellent questions!
There is no agreed on/specified way to handle fragment imports, so we opted for the easier implied path for now
It would great to support graphql import style syntax as an opt-in feature