Skip to content

Commit a34e36b

Browse files
Merge pull request #232 from jimkyndemeyer/v2
Apply v2 to master
2 parents ae48064 + 693fadf commit a34e36b

File tree

622 files changed

+27964
-13382
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

622 files changed

+27964
-13382
lines changed

.gitignore

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,15 @@ $RECYCLE.BIN/
6666

6767
# Windows shortcuts
6868
*.lnk
69-
.idea/dictionaries/*
70-
.idea/workspace.xml
71-
.idea/uiDesigner.xml
72-
.idea/vcs.xml
73-
.idea/pure-run-config-templates.xml
74-
resources/META-INF/dist/
69+
.idea
70+
resources/META-INF/dist/
71+
72+
.gradle
73+
build
74+
75+
# documentation website
76+
website/translated_docs
77+
website/build/
78+
website/yarn.lock
79+
website/node_modules
80+
website/i18n/*

.idea/.name

Lines changed: 0 additions & 1 deletion
This file was deleted.

.idea/compiler.xml

Lines changed: 5 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copyright/profiles_settings.xml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.idea/encodings.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/libraries/commons_io_2_5.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.idea/misc.xml

Lines changed: 4 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 2.0.0 (2019-04-06)
2+
3+
Changes:
4+
5+
- Support for the June 2018 GraphQL specification including SDL (#118, #133, #137, #129, #141, #144, #150, #164)
6+
- Support for multiple schemas using graphql-config (#84, #125, #140, #145, #164)
7+
- Replaced Node.js based language service with native parser, lexer, and graphql-java to be compatible with all IDEs based on the IntelliJ Platform (#62, #164)
8+
19
## 1.7.4 (2019-04-03)
210

311
Fixes:

README.md

Lines changed: 20 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -2,105 +2,43 @@
22

33
# JS GraphQL IntelliJ Plugin
44

5-
__Note:__ V2.0 is in active development. See the [v2 branch](https://github.com/jimkyndemeyer/js-graphql-intellij-plugin/tree/v2) and [#164]( https://github.com/jimkyndemeyer/js-graphql-intellij-plugin/issues/164)
5+
GraphQL language support for WebStorm, IntelliJ IDEA and other IDEs based on the IntelliJ Platform.
66

7-
GraphQL language support including Relay.QL tagged templates in JavaScript and TypeScript.
8-
9-
It provides the following features in IntelliJ IDEA, WebStorm, RubyMine, PhpStorm, and PyCharm:
7+
## Features overview
108

9+
- Full language support for the June 2018 GraphQL Specification including the Type System Definition Language (SDL)
10+
- The plugin discovers your local schema on the fly. Remote schemas are easily fetched using introspection
11+
- Schema discovery is configured using [graphql-config](https://github.com/prisma/graphql-config) files, including support for multi-schema projects
12+
- Built-in support for Relay and Apollo projects: `graphql` and `gql` tagged template literals in JavaScript and TypeScript are automatically recognized as GraphQL
13+
- Execute queries using variables against configurable endpoints, including support for custom headers and environment variables
1114
- Schema-aware completion, error highlighting, and documentation
1215
- Syntax highlighting, code-formatting, folding, commenter, and brace-matching
13-
- 'Find Usages' and 'Go to Declaration' for schema types and fields
14-
- Schema viewer and 'Go to Implementation' for schema interfaces
15-
- 'Structure view' to navigate GraphQL and GraphQL Schema files
16-
- Configurable GraphQL schema retrieval and reloading based on a local file or a url using 'then-request'
17-
- Execute queries with variables against configurable endpoints
18-
19-
V1.x depends on [js-graphql-language-service](https://github.com/jimkyndemeyer/js-graphql-language-service) that it manages using a Node.js process handler.
20-
21-
## Installation
22-
1. Install Node JS
23-
```
24-
# Ubuntu
25-
sudo apt install nodejs
26-
27-
# Mac OS
28-
brew install node
29-
```
30-
31-
2. Install Node JS and JS GraphQL Plugin in IntelliJ
32-
```
33-
1. File | Settings | Plugins
34-
2. Search for: nodejs and graphql
35-
3. Install both plugins and Restart
36-
```
37-
38-
3. Set Node JS Interpreter in IntelliJ
39-
```
40-
1. File | Settings | Languages & Frameworks | Node.js and NPM Node interpreter
41-
2. Add... (search for nodejs bin path in your system)
42-
43-
# Ubuntu
44-
whereis nodejs
45-
/usr/bin/nodejs
46-
47-
# Mac OS
48-
which node
49-
50-
# Windows
51-
where node
52-
```
53-
At this point JS GraphQL will recognize your `.graphql` files. However, if you wish to customize your schema, follow the FAQ.
16+
- 'Find Usages' and 'Go to Declaration' for schema types, fields, and fragments
17+
- 'Structure view' to navigate GraphQL files
5418

5519
## Documentation
5620

57-
The plugin uses a `graphql.config.json` file in the project root to configure the location of your GraphQL schema.
58-
59-
To get started, please see the [FAQ](#faq).
60-
61-
## Features demo
62-
63-
**Schema setup, completion, error highlighting, documentation**
64-
![](docs/js-graphql-webstorm-demo.gif)
65-
66-
**Find usages, schema viewer, structure view**
67-
![](docs/js-graphql-webstorm-usages-structure-demo.gif)
68-
69-
## FAQ
70-
71-
**How do I configure the plugin in a project**
72-
73-
The plugin is activated as soon as you view or edit GraphQL in the editor. This includes GraphQL inside `Relay.QL` and `gql` templates in JavaScript and TypeScript. You can also use `.graphql` physical files and scratch files. These files allow you to query your endpoint directly from your IDE.
74-
75-
An editor notification bar should prompt you to "Create a graphql.config.json". Accept and edit this config file to point the plugin at your local `schema.json` or your endpoint for introspection. The plugin uses the schema to provide completion and error highlighting.
76-
77-
**How do I reload a GraphQL Schema that was loaded from a URL?**
78-
79-
In the the GraphQL tool window, select the "Current Errors" tab and click the "Restart JS GraphQL Language Service" button.
80-
81-
**I clicked "No thanks" when asked to create a graphql.config.json. Now what?**
82-
83-
Download [graphql.config.json](https://github.com/jimkyndemeyer/js-graphql-intellij-plugin/blob/master/resources/META-INF/graphql.config.json) from this repository and place it in your project root (next to your package.json for JS projects). Re-open the project and edit `graphql.config.json` to point the plugin at your schema.
21+
The main documentation site is available at https://jimkyndemeyer.github.io/js-graphql-intellij-plugin/
8422

85-
**Fields are shown as errors with "Cannot query field..." messages**
23+
## Which IDEs are compatible with the plugin?
8624

87-
Make sure you've edited your `graphql.config.json` to point it at your schema. This enables the plugin to properly recognize the available types and their fields.
25+
The plugin is compatible with version 2018.2+ (182.711 or later) of all IDEs based on the IntelliJ Platform, including but not limited to WebStorm, IntelliJ IDEA, Android Studio, RubyMine, PhpStorm, and PyCharm.
8826

89-
**Which IDEs are compatible with the plugin?**
27+
## Where can I get the plugin?
9028

91-
The plugin is compatible with version 143+ of IntelliJ IDEA, WebStorm, RubyMine, PhpStorm, and PyCharm.
29+
The plugin is published to the [JetBrains Plugin Repository](https://plugins.jetbrains.com/plugin/8097?pr=).
9230

93-
PyCharm CE is not supported since the plugin depends on two other plugins: NodeJS and JavaScript.
31+
To install it, open your IDE "Settings", "Plugins", "Marketplace" and search for "GraphQL".
9432

95-
Experimental support for Android Studio is available in the [`android-studio`](https://github.com/jimkyndemeyer/js-graphql-intellij-plugin/tree/android-studio) branch. Download it from there.
33+
## Acknowledgements
9634

97-
**Where can I get the plugin?**
35+
This plugin was heavily inspired by [GraphiQL](https://github.com/graphql/graphiql) from Facebook.
9836

99-
The plugin is available from the JetBrains Plugin Repository at https://plugins.jetbrains.com/plugin/8097?pr=
37+
A number of language features such as query and schema validation are powered by [graphql-java](https://github.com/graphql-java/graphql-java).
10038

101-
To install it, open "Settings", "Plugins", "Browse repositories..." and search for "GraphQL".
39+
A thanks also goes out to the [Apollo](https://github.com/apollographql) and [Prisma](https://github.com/prisma) teams for their continued efforts to improve the GraphQL Developer Experience.
10240

103-
**Note**: The experimental version in the `android-studio` branch is not available from the JetBrains Plugin Repository.
41+
And finally, a thank you to the [JetBrains WebStorm team](https://twitter.com/WebStormIDE) and the Alpha/Beta testers for all their help in getting the 2.0 release across the finish line.
10442

10543
## License
10644
MIT
2.09 MB
Binary file not shown.
2.09 MB
Binary file not shown.
2.43 MB
Binary file not shown.
2.57 MB
Binary file not shown.
2.59 MB
Binary file not shown.
2.67 MB
Binary file not shown.
2.67 MB
Binary file not shown.
2.7 MB
Binary file not shown.
2.54 MB
Binary file not shown.
2.55 MB
Binary file not shown.
2.55 MB
Binary file not shown.

alpha-releases/updatePlugins.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<plugins>
2+
<plugin id="com.intellij.lang.jsgraphql" url="https://github.com/jimkyndemeyer/js-graphql-intellij-plugin/blob/v2/alpha-releases/JS%20GraphQL-2.0.0-end-of-beta.zip?raw=true" version="2.0.0-end-of-beta"/>
3+
</plugins>

build.gradle

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
buildscript {
2+
repositories {
3+
maven { url 'https://jitpack.io'}
4+
}
5+
dependencies{
6+
classpath "com.github.JetBrains:gradle-grammar-kit-plugin:2018.3"
7+
}
8+
}
9+
10+
plugins {
11+
id 'org.jetbrains.intellij' version '0.4.4'
12+
id "de.undercouch.download" version "3.4.3"
13+
id "com.github.ManifestClasspath" version "0.1.0-RELEASE"
14+
}
15+
16+
group 'com.intellij.lang.jsgraphql'
17+
version '2.0.0'
18+
19+
apply plugin: 'java'
20+
21+
sourceCompatibility = 1.8
22+
23+
repositories {
24+
mavenCentral()
25+
}
26+
27+
dependencies {
28+
compile ("com.graphql-java:graphql-java:11.0") {
29+
exclude group: "org.reactivestreams", module: "reactive-streams"
30+
exclude group: "com.graphql-java", module: "java-dataloader"
31+
exclude group: "org.slf4j", module: "slf4j-api"
32+
}
33+
compile "commons-io:commons-io:2.6"
34+
compile "com.atlassian.commonmark:commonmark:0.12.1"
35+
compile group: 'org.yaml', name: 'snakeyaml', version: '1.21'
36+
37+
testCompile group: 'junit', name: 'junit', version: '4.12'
38+
}
39+
40+
intellij {
41+
version '2018.2'
42+
type 'IU'
43+
updateSinceUntilBuild = false
44+
pluginName 'JS GraphQL'
45+
plugins = ['JavaScriptLanguage', 'CSS']
46+
ideaDependencyCachePath = project.buildDir
47+
}
48+
49+
runIde {
50+
jvmArgs '-Xmx2G'
51+
}
52+
53+
patchPluginXml {
54+
55+
}
56+
57+
sourceSets {
58+
59+
main.java.srcDirs = ['src/main', 'gen']
60+
main.resources.srcDir 'resources'
61+
62+
test.java.srcDirs = ['src/test']
63+
test.resources.srcDir 'test-resources'
64+
65+
}
66+
67+
apply plugin: 'org.jetbrains.grammarkit'
68+
69+
// import is optional to make task creation easier
70+
import org.jetbrains.grammarkit.tasks.*
71+
72+
// GraphQL Parser and Lexer
73+
task generateGraphQLLexer(type: GenerateLexer) {
74+
source 'src/grammars/GraphQLLexer.flex'
75+
targetDir 'gen/com/intellij/lang/jsgraphql/'
76+
targetClass 'GraphQLLexer'
77+
purgeOldFiles = true
78+
}
79+
80+
task generateGraphQLParser(type: GenerateParser) {
81+
source "src/grammars/GraphQLParser.bnf"
82+
targetRoot = 'gen/'
83+
purgeOldFiles = true
84+
pathToParser = 'com/intellij/lang/jsgraphql/GraphQLParser'
85+
pathToPsiRoot = 'com/intellij/lang/jsgraphql/psi'
86+
}
87+
88+
// GraphQL Endpoint Parser and Lexer
89+
task generateGraphQLEndpointLexer(type: GenerateLexer) {
90+
source 'src/grammars/JSGraphQLEndpointLexer.flex'
91+
targetDir 'gen/com/intellij/lang/jsgraphql/endpoint/lexer/'
92+
targetClass 'JSGraphQLEndpointLexer'
93+
purgeOldFiles = true
94+
}
95+
96+
task generateGraphQLEndpointParser(type: GenerateParser) {
97+
source "src/grammars/JSGraphQLEndpointParser.bnf"
98+
targetRoot = 'gen/'
99+
purgeOldFiles = true
100+
pathToParser = 'com/intellij/lang/jsgraphql/endpoint/parser/JSGraphQLEndpointParser'
101+
pathToPsiRoot = 'com/intellij/lang/jsgraphql/endpoint/psi'
102+
}
103+
104+
105+
// GraphQL Endpoint Doc Parser and Lexer
106+
task generateGraphQLEndpointDocLexer(type: GenerateLexer) {
107+
source 'src/grammars/JSGraphQLEndpointDocLexer.flex'
108+
targetDir 'gen/com/intellij/lang/jsgraphql/endpoint/doc/lexer/'
109+
targetClass 'GraphQLLexer'
110+
purgeOldFiles = true
111+
}
112+
113+
task generateGraphQLEndpointDocParser(type: GenerateParser) {
114+
source "src/grammars/JSGraphQLEndpointDocParser.bnf"
115+
targetRoot = 'gen/'
116+
purgeOldFiles = true
117+
pathToParser = 'com/intellij/lang/jsgraphql/endpoint/doc/JSGraphQLEndpointDocParser'
118+
pathToPsiRoot = 'com/intellij/lang/jsgraphql/endpoint/doc/psi'
119+
}
120+
121+
task downloadMinimatchNashorn(type: Download) {
122+
src 'https://raw.githubusercontent.com/jimkyndemeyer/minimatch-nashorn/1.0.1/dist/minimatch-nashorn.js'
123+
dest 'resources/META-INF'
124+
overwrite false
125+
}
126+
127+
compileJava {
128+
dependsOn downloadMinimatchNashorn
129+
dependsOn generateGraphQLEndpointLexer
130+
dependsOn generateGraphQLEndpointParser
131+
dependsOn generateGraphQLEndpointDocLexer
132+
dependsOn generateGraphQLEndpointDocParser
133+
dependsOn generateGraphQLLexer
134+
dependsOn generateGraphQLParser
135+
}
136+
137+
compileJava.options.encoding = 'UTF-8'
20.5 KB
Loading

docs/assets/installation.png

27 KB
Loading

docs/assets/introspect-endpoint.png

22.5 KB
Loading

docs/assets/introspect-re-run.png

17.9 KB
Loading

docs/assets/introspect-startup.png

10.8 KB
Loading

0 commit comments

Comments
 (0)