nicolaslopezj / atom-graphql-autocomplete Goto Github PK
View Code? Open in Web Editor NEWAutocomplete and lint from a GraphQL endpoint in atom.
License: MIT License
Autocomplete and lint from a GraphQL endpoint in atom.
License: MIT License
add a script where we can add headers
Getting these errors since updating to Atom 1.19 (macOS):
LinterError TypeError: Cannot read property 'join' of undefined
at Linter.<anonymous> (/Users/chris/.atom/packages/graphql-autocomplete/lib/Linter/index.js:57:46)
at Generator.next (<anonymous>)
at step (/Users/chris/.atom/packages/graphql-autocomplete/lib/Linter/index.js:9:273)
at /Users/chris/.atom/packages/graphql-autocomplete/lib/Linter/index.js:9:443
at Linter.<anonymous> (/Users/chris/.atom/packages/graphql-autocomplete/lib/Linter/index.js:9:99)
at promises.push.Promise.then._this2.emitter.emit.number (/Users/chris/.atom/packages/linter/lib/linter-registry.js:101:24)
at _loop (/Users/chris/.atom/packages/linter/lib/linter-registry.js:99:21)
at LinterRegistry.<anonymous> (/Users/chris/.atom/packages/linter/lib/linter-registry.js:87:40)
at Generator.next (<anonymous>)
at LinterRegistry.<anonymous> (/Users/chris/.atom/packages/linter/lib/linter-registry.js:143:4)
at Generator.next (<anonymous>)
at step (/Users/chris/.atom/packages/linter/lib/linter-registry.js:5:273)
at /Users/chris/.atom/packages/linter/lib/linter-registry.js:5:443
at LinterRegistry.<anonymous> (/Users/chris/.atom/packages/linter/lib/linter-registry.js:5:99)
at /Users/chris/.atom/packages/linter/lib/main.js:125:30
at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:25:20)
at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:141:34)
at /Users/chris/.atom/packages/linter/lib/editor-linter.js:32:22
at later (/Users/chris/.atom/packages/linter/node_modules/sb-debounce/index.js:9:14)
Uncaught (in promise) TypeError: Cannot read property '4' of undefined
at Snippets.getLine (/Users/chris/.atom/packages/graphql-autocomplete/lib/Snippets/index.js:13:31)
at Snippets.<anonymous> (/Users/chris/.atom/packages/graphql-autocomplete/lib/Snippets/index.js:17:27)
at Generator.next (<anonymous>)
at step (/Users/chris/.atom/packages/graphql-autocomplete/lib/Snippets/index.js:9:273)
at /Users/chris/.atom/packages/graphql-autocomplete/lib/Snippets/index.js:9:443
at Snippets.<anonymous> (/Users/chris/.atom/packages/graphql-autocomplete/lib/Snippets/index.js:9:99)
at /Applications/Atom.app/Contents/Resources/app/node_modules/autocomplete-plus/lib/autocomplete-manager.js:337:60
at Array.forEach (native)
at AutocompleteManager.getSuggestionsFromProviders (/Applications/Atom.app/Contents/Resources/app/node_modules/autocomplete-plus/lib/autocomplete-manager.js:313:23)
at AutocompleteManager.findSuggestions (/Applications/Atom.app/Contents/Resources/app/node_modules/autocomplete-plus/lib/autocomplete-manager.js:302:25)
If I start typing gql template literals, atom jams up and doesn't become responsive again. :(
Eg.
// file.js
import { gql } from 'react-apollo';
const myQuery = gql`
query { *query here* }
`
Is it possible to have autocomplete support inside such tags?
It seems that there is a consensus towards using a .graphqlconfig
file rather than a .graphqlrc
file in graphql projects.
I think it would be a good idea to migrate this project to use the new configuration file to be consistent with other projects. Currently in my personal projects I have to maintain two different configuration files in order to use this package.
Hi,
i've created the .graphqlrc
file as suggested:
{
"request": {
"url": "http://app.dev.local/graphql"
}
}
When i open a .graphql
file nothing happen.
It seems that the .graphqlrc file is never readed. I tried to mess with the file to see if any errors blow up but nothing seems to happen.
First of all, this is awesome, thank you for putting this together! ๐
I have a use case where I need to point the local app to different graphql endpoints/servers (e.g. staging, dev, production, etc) to test out features and schema changes as they're being developed. Is there any way to have the .graphqlrc take in some environment variable? Or could it be a JS file that's imported and executed by this plugin to get the graphql server at runtime?
Happy to contribute this as a PR as well, just point me in the right direction! :)
I tried putting some wrong port into my .graphqlrc
and there is no indication that the schema failed to load from that url. Would be nice to display just a warning toast message or maybe some in the status bar?
I don't really care where, but it would be nice to let the user know his URL is wrong.
would be great if this worked for Relay in JS and TypeScript files
[Enter steps to reproduce:]
Atom: 1.40.1 x64
Electron: 3.1.10
OS: Microsoft Windows 10 Pro
Thrown From: graphql-autocomplete package 1.3.0
Failed to load the graphql-autocomplete package
At regeneratorRuntime is not defined
ReferenceError: regeneratorRuntime is not defined
at /packages/graphql-autocomplete/node_modules/graphql-language-service-interface/dist/GraphQLLanguageService.js:69:7
at /packages/graphql-autocomplete/node_modules/graphql-language-service-interface/dist/GraphQLLanguageService.js:193:6
at /packages/graphql-autocomplete/node_modules/graphql-language-service-interface/dist/GraphQLLanguageService.js:451:2)
at /packages/graphql-autocomplete/node_modules/graphql-language-service-interface/dist/GraphQLLanguageService.js:454:3)
at Module.get_Module._compile (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:147429)
at Object.value [as .js] (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:150977)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
at Function.Module._load (internal/modules/cjs/loader.js:551:3)
at Module.require (/app.asar/static/index.js:72:46)
at require (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:146745)
at /packages/graphql-autocomplete/node_modules/graphql-language-service-interface/dist/index.js:103:31)
at /packages/graphql-autocomplete/node_modules/graphql-language-service-interface/dist/index.js:104:3)
at Module.get_Module._compile (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:147429)
at Object.value [as .js] (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:150977)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
at Function.Module._load (internal/modules/cjs/loader.js:551:3)
at Module.require (/app.asar/static/index.js:72:46)
at require (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:146745)
at /packages/graphql-autocomplete/lib/Snippets/getSnippets.js:11:40)
at /packages/graphql-autocomplete/lib/Snippets/getSnippets.js:54:2)
at Module.get_Module._compile (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:147429)
at Object.value [as .js] (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:150977)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
at Function.Module._load (internal/modules/cjs/loader.js:551:3)
at Module.require (/app.asar/static/index.js:72:46)
at require (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:146745)
at /packages/graphql-autocomplete/lib/Snippets/index.js:13:20)
atom-ternjs 0.18.3
autocomplete-modules 1.12.0
busy-signal 1.4.3
convert-file-encoding 0.1.0
docblockr 0.13.7
Fast_Duplicate 1.2.0
git-log 0.4.1
graphql-autocomplete 1.3.0
hyperclick 0.1.5
intentions 1.1.5
js-hyperclick 1.14.2
js-hyperclick-project-path 1.12.0
language-babel 2.85.0
language-graphql 1.0.0
language-javascript-jsx 0.3.7
linter 2.2.0
linter-eslint 8.4.1
linter-ui-default 1.7.1
react 0.18.0
react-snippets 1.1.1
split-diff 1.5.3
Sublime-Style-Column-Selection 1.7.5
sync-settings 0.8.6
tabs-to-spaces 1.0.5
yui-doc-snippets 0.1.0
Hello! Could you please provide an example of a file with schemas?
And thanks for awesome work!
Unfortunately I can't use this tool, because headers have to be passed.
Can you include an option for this? :)
Using apollo client you should be able to do this
const fragments = gql`
fragment Details on ContentType {
...DetailsEditor on ContentType
...DetailsViewer on ContentType
}
${DetailsEditor.fragments.ContentType}
${DetailsViewer.fragments.ContentType}
`
However the plugin is annoyed with ${}
.
Error:
Syntax Error GraphQL (6:3) Unexpected $
5: }
6: ${DetailsEditor.fragments.ContentType}
^
7: ${DetailsViewer.fragments.ContentType}
: /Users/grumpyOldRussian/Documents/web-projects/med-yacht-sales/mys-cms-frontend/src/modules/content-type-editor/details/Details.js:12
[Enter steps to reproduce:]
Looks like there may need to be an upgrade for 1.4
Atom: 1.40.1 x64
Electron: 3.1.10
OS: Mac OS X 10.14.6
Thrown From: graphql-autocomplete package 1.3.0
Failed to load the graphql-autocomplete package
At regeneratorRuntime is not defined
ReferenceError: regeneratorRuntime is not defined
at /packages/graphql-autocomplete/node_modules/graphql-language-service-interface/dist/GraphQLLanguageService.js:69:7
at /packages/graphql-autocomplete/node_modules/graphql-language-service-interface/dist/GraphQLLanguageService.js:193:6
at /packages/graphql-autocomplete/node_modules/graphql-language-service-interface/dist/GraphQLLanguageService.js:451:2)
at /packages/graphql-autocomplete/node_modules/graphql-language-service-interface/dist/GraphQLLanguageService.js:454:3)
at Module.get_Module._compile (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:147429)
at Object.value [as .js] (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:150977)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
at Function.Module._load (internal/modules/cjs/loader.js:551:3)
at Module.require (/app.asar/static/index.js:72:46)
at require (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:146745)
at /packages/graphql-autocomplete/node_modules/graphql-language-service-interface/dist/index.js:103:31)
at /packages/graphql-autocomplete/node_modules/graphql-language-service-interface/dist/index.js:104:3)
at Module.get_Module._compile (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:147429)
at Object.value [as .js] (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:150977)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
at Function.Module._load (internal/modules/cjs/loader.js:551:3)
at Module.require (/app.asar/static/index.js:72:46)
at require (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:146745)
at /packages/graphql-autocomplete/lib/Snippets/getSnippets.js:11:40)
at /packages/graphql-autocomplete/lib/Snippets/getSnippets.js:54:2)
at Module.get_Module._compile (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:147429)
at Object.value [as .js] (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:150977)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
at Function.Module._load (internal/modules/cjs/loader.js:551:3)
at Module.require (/app.asar/static/index.js:72:46)
at require (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:146745)
at /packages/graphql-autocomplete/lib/Snippets/index.js:13:20)
angularjs 0.5.3
atom-beautify 0.33.4
atom-ide-debugger-node 0.7.3
atom-ide-debugger-python 0.7.3
atom-ide-debugger-react-native 0.7.3
atom-ide-ui 0.13.0
atom-prettify 0.1.3
autocomplete-python 1.16.0
graphql-autocomplete 1.3.0
ide-python 1.4.2
kite 0.172.0
language-cypher 0.5.0
language-graphql 1.0.0
language-scala 1.1.10
language-sparql 0.3.0
markdown-preview-plus 3.10.0
minimap 4.29.9
pretty-json 2.1.2
react 0.18.0
split-diff 1.6.1
xml-formatter 0.13.0
Hi,
How do I use the plugin on .vue files?
<script>
import {gql} from 'graphql-tag'
const query = gql`
mutation { ... }
`
</script>
This plugin is great when working on projects that might potentially be consuming queries from disparate GraphQL servers, or when working with other developers that use atom, however the .graphqlrc
convention tends to lose its luster when working on larger projects with a more diverse developer base.
I propose that a new, atom-based setting be exposed that allows users to define a "global" HTTP server or JSON file for building the autocomplete. This way atom users can continue to enjoy the benefit of this plugin without burdening project maintainers with another file.
With this change in mind, when the plugin begins, it will:
.graphqlrc
file with the appropriate schematic, as defined in the README.Open Questions:
I am using https://github.com/APIs-guru/graphql-lodash and am getting a bunch of errors about unknown directive "_"
would be nice if it wer possible to disable the unkonwn directive warnings just like the unknown fragment warnings.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.