Skip to content

Commit 771636d

Browse files
committed
Added support for graphql-config (#125 and #164)
- Added settings dialog for schema discovery - Added JSON schema for .graphqlconfig - No longer using graphql.config.json for configuration
1 parent 2267c2a commit 771636d

37 files changed

+2214
-145
lines changed

build.gradle

+13-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ buildscript {
99

1010
plugins {
1111
id 'org.jetbrains.intellij' version '0.3.4'
12+
id "de.undercouch.download" version "3.4.3"
1213
}
1314

1415
group 'com.intellij.lang.jsgraphql'
15-
version '2.0.0-alpha-2'
16+
version '2.0.0-alpha-3'
1617

1718
apply plugin: 'java'
1819

@@ -25,12 +26,14 @@ repositories {
2526
dependencies {
2627
compile "com.graphql-java:graphql-java:9.0"
2728
compile "commons-io:commons-io:2.6"
28-
//compile project(':com.graphql-java:graphql-java')
29+
compile "fr.opensagres.js:minimatch.java:1.1.0"
30+
compile group: 'org.yaml', name: 'snakeyaml', version: '1.21'
31+
2932
testCompile group: 'junit', name: 'junit', version: '4.12'
3033
}
3134

3235
intellij {
33-
version '2017.3.5'
36+
version '2018.1.5'
3437
type 'IU'
3538
updateSinceUntilBuild = false
3639
pluginName 'JS GraphQL'
@@ -104,7 +107,14 @@ task generateGraphQLEndpointDocParser(type: GenerateParser) {
104107
pathToPsiRoot = 'com/intellij/lang/jsgraphql/endpoint/doc/psi'
105108
}
106109

110+
task downloadMinimatchNashorn(type: Download) {
111+
src 'https://github.com/raw/jimkyndemeyer/minimatch-nashorn/1.0.0/dist/minimatch-nashorn.js'
112+
dest 'resources/META-INF'
113+
overwrite false
114+
}
115+
107116
compileJava {
117+
dependsOn downloadMinimatchNashorn
108118
dependsOn generateGraphQLEndpointLexer
109119
dependsOn generateGraphQLEndpointParser
110120
dependsOn generateGraphQLEndpointDocLexer

js-graphql-intellij-plugin.iml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<module external.linked.project.id="js-graphql-intellij-plugin" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="com.intellij.lang.jsgraphql" external.system.module.version="2.0.0-alpha-2" type="JAVA_MODULE" version="4">
2+
<module external.linked.project.id="js-graphql-intellij-plugin" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="com.intellij.lang.jsgraphql" external.system.module.version="2.0.0-alpha-3" type="JAVA_MODULE" version="4">
33
<component name="NewModuleRootManager" inherit-compiler-output="true">
44
<exclude-output />
55
<content url="file://$MODULE_DIR$">

resources/META-INF/.graphqlconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extensions": {
3+
"endpoints": {
4+
"Default GraphQL Endpoint": {
5+
"url": "http://localhost:8080/graphql",
6+
"headers": {
7+
"user-agent": "JS GraphQL"
8+
}
9+
}
10+
}
11+
}
12+
}

resources/META-INF/graphql-javascript.xml

+5
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@
1515
<!-- Indexing -->
1616
<fileBasedIndex implementation="com.intellij.lang.jsgraphql.ide.project.javascript.GraphQLInjectionIndex"/>
1717
</extensions>
18+
19+
<extensions defaultExtensionNs="JavaScript">
20+
<JsonSchema.ProviderFactory implementation="com.intellij.lang.jsgraphql.ide.project.graphqlconfig.javascript.GraphQLConfigJsonSchemaProvider"/>
21+
</extensions>
22+
1823
</idea-plugin>

resources/META-INF/minimatch-nashorn.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/META-INF/plugin.xml

+14-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<idea-plugin>
1111
<id>com.intellij.lang.jsgraphql</id>
1212
<name>JS GraphQL</name>
13-
<version>2.0.0-alpha-2</version>
13+
<version>2.0.0-alpha-3</version>
1414
<vendor>Jim Kynde Meyer - [email protected]</vendor>
1515

1616
<description><![CDATA[
@@ -27,6 +27,7 @@
2727

2828
<change-notes><![CDATA[
2929
<ul>
30+
<li>2.0.0-alpha-3: graphql-config support</li>
3031
<li>2.0.0-alpha-2: Language support for GraphQL draft spec as of June 2018. Compatible with Android Studio 3.1 and IntelliJ IDEA Community Edition</li>
3132
</ul>
3233
]]>
@@ -53,10 +54,14 @@
5354
<projectService serviceInterface="com.intellij.lang.jsgraphql.ide.project.GraphQLPsiSearchHelper" serviceImplementation="com.intellij.lang.jsgraphql.ide.project.GraphQLPsiSearchHelper" />
5455
<projectService serviceInterface="com.intellij.lang.jsgraphql.ide.references.GraphQLReferenceService" serviceImplementation="com.intellij.lang.jsgraphql.ide.references.GraphQLReferenceService" />
5556
<projectService serviceInterface="com.intellij.lang.jsgraphql.v1.ide.project.JSGraphQLLanguageUIProjectService" serviceImplementation="com.intellij.lang.jsgraphql.v1.ide.project.JSGraphQLLanguageUIProjectService" />
57+
<projectService serviceInterface="com.intellij.lang.jsgraphql.GraphQLSettings" serviceImplementation="com.intellij.lang.jsgraphql.GraphQLSettings" />
58+
<projectService serviceInterface="com.intellij.lang.jsgraphql.ide.project.graphqlconfig.GraphQLConfigManager" serviceImplementation="com.intellij.lang.jsgraphql.ide.project.graphqlconfig.GraphQLConfigManager" />
59+
<projectService serviceInterface="com.intellij.lang.jsgraphql.ide.project.graphqlconfig.GraphQLConfigGlobMatcher" serviceImplementation="com.intellij.lang.jsgraphql.ide.project.graphqlconfig.GraphQLConfigGlobMatcherImpl" />
60+
<projectService serviceInterface="com.intellij.lang.jsgraphql.ide.project.scopes.GraphQLProjectScopesManager" serviceImplementation="com.intellij.lang.jsgraphql.ide.project.scopes.GraphQLProjectScopesManager" />
5661

5762
<!-- Startup -->
5863
<postStartupActivity implementation="com.intellij.lang.jsgraphql.endpoint.ide.startup.GraphQLStartupActivity" />
59-
64+
<postStartupActivity implementation="com.intellij.lang.jsgraphql.ide.project.graphqlconfig.GraphQLConfigProjectStartupActivity" />
6065

6166
<!-- Syntax and error highlighting -->
6267
<lang.syntaxHighlighterFactory language="GraphQL" implementationClass="com.intellij.lang.jsgraphql.ide.GraphQLSyntaxHighlighterFactory"/>
@@ -88,8 +93,14 @@
8893
<!-- Renaming -->
8994
<vetoRenameCondition implementation="com.intellij.lang.jsgraphql.ide.rename.GraphQLRenameVetoCondition" />
9095

96+
<!-- Settings -->
97+
<projectConfigurable groupId="language" instance="com.intellij.lang.jsgraphql.ui.GraphQLProjectConfigurable" />
9198

99+
<!-- .graphqlconfig JSON -->
100+
<fileTypeFactory implementation="com.intellij.lang.jsgraphql.ide.project.graphqlconfig.GraphQLConfigFileTypeFactory" />
92101

102+
<!-- Editor notifications -->
103+
<editorNotificationProvider implementation="com.intellij.lang.jsgraphql.ide.notifications.GraphQLScopeEditorNotificationProvider"/>
93104

94105
<!-- v2 above this point -->
95106

@@ -234,7 +245,7 @@
234245

235246

236247
<!-- Editor notification bars and markers -->
237-
<editorNotificationProvider implementation="com.intellij.lang.jsgraphql.v1.ide.notifications.JSGraphQLConfigEditorNotificationProvider"/>
248+
<!--<editorNotificationProvider implementation="com.intellij.lang.jsgraphql.v1.ide.notifications.JSGraphQLConfigEditorNotificationProvider"/>-->
238249
<!--
239250
<editorNotificationProvider implementation="JSGraphQLApolloLokkaEditorNotificationProvider"/>
240251
-->

resources/META-INF/schema.graphql

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
#
66
# See https://graphql.org/learn/schema/ for how to describe the types in your schema.
77
#
8-
# Edit the graphql.config.json file to add your endpoint location to be able to query from .graphql files.
8+
# GrapQL endpoint locations are configured using .graphqlconfig files.
9+
# Click the settings icon in the header of the editor be able to query from .graphql files.
910
#
10-
# If your project contains multiple schemas, you can keep them separate by configuring custom scopes under
11-
# "Settings" > "Appearance & Behavior" > "Scopes".
11+
# If your project contains multiple schemas, you can keep them separate by configuring the GraphQL project structure
12+
# under "Settings" > "Language & Frameworks" > "GraphQL"
1213

1314
schema {
1415
query: Query

0 commit comments

Comments
 (0)