Skip to content

Commit 7dc1b2c

Browse files
committed
Added support for contextual queries (#6).
Introduced CHANGELOG.md.
2 parents 60f8782 + 09d80ad commit 7dc1b2c

File tree

8 files changed

+621
-4
lines changed

8 files changed

+621
-4
lines changed

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## 1.2.0 (2016-03-14)
2+
3+
Features:
4+
5+
- Contextual query support: Execute buffer, selection, or named operations at the caret position in the GraphQL editor
6+
7+
## 1.1.1 (2016-02-03)
8+
9+
Changes:
10+
11+
- Closes #4 Completion after ... fragment spread operator.
12+
- Language Service 1.1.1 based on graphql 0.4.16 and codemirror-graphql 0.2.2
13+
14+
## 1.1.0 (2016-01-31)
15+
16+
Features:
17+
18+
- Support for GraphQL Schema Language
19+
20+
21+
## v1.0.0 (2015-12-13)
22+
23+
Features:
24+
25+
- Initial release.

resources/META-INF/plugin.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<idea-plugin version="2">
1111
<id>com.intellij.lang.jsgraphql</id>
1212
<name>JS GraphQL</name>
13-
<version>1.1.1</version>
13+
<version>1.2.0</version>
1414
<vendor>Jim Kynde Meyer - [email protected]</vendor>
1515

1616
<description><![CDATA[
@@ -29,6 +29,7 @@
2929

3030
<change-notes><![CDATA[
3131
<ul>
32+
<li>1.2.0: Contextual query support: Execute buffer, selection, or named operations at the caret position in the GraphQL editor</li>
3233
<li>1.1.1: Completion after ... fragment spread operator. Language Service 1.1.1 based on graphql 0.4.16 and codemirror-graphql 0.2.2</li>
3334
<li>1.1.0: Find usages, schema viewer, structure view</li>
3435
</ul>
@@ -87,6 +88,10 @@
8788
<annotator language="TypeScript" implementationClass="com.intellij.lang.jsgraphql.ide.annotator.JSGraphQLRelayTemplateAnnotator" /><!-- Using the JSX dialect overwrites the default annotator -->
8889

8990

91+
<!-- Query context highlighter -->
92+
<highlightVisitor implementation="com.intellij.lang.jsgraphql.ide.editor.JSGraphQLQueryContextHighlightVisitor" />
93+
94+
9095
<!-- Formatting -->
9196
<lang.formatter language="GraphQL" implementationClass="com.intellij.lang.jsgraphql.ide.formatter.JSGraphQLFormattingModelBuilder"/>
9297
<lang.formatter language="JavaScript" implementationClass="com.intellij.lang.jsgraphql.ide.formatter.JSGraphQLInjectedFormattingModelBuilder" />

src/main/com/intellij/lang/jsgraphql/ide/actions/JSGraphQLEditEndpointsAction.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.intellij.openapi.actionSystem.AnAction;
1313
import com.intellij.openapi.actionSystem.AnActionEvent;
1414
import com.intellij.openapi.actionSystem.CommonDataKeys;
15+
import com.intellij.openapi.editor.ScrollType;
1516
import com.intellij.openapi.fileEditor.FileEditor;
1617
import com.intellij.openapi.fileEditor.FileEditorManager;
1718
import com.intellij.openapi.fileEditor.TextEditor;
@@ -48,6 +49,7 @@ public void actionPerformed(AnActionEvent e) {
4849
final int endpointsIndex = textEditor.getEditor().getDocument().getText().indexOf("\"endpoints\"");
4950
if(endpointsIndex != -1) {
5051
textEditor.getEditor().getCaretModel().moveToOffset(endpointsIndex);
52+
textEditor.getEditor().getScrollingModel().scrollToCaret(ScrollType.CENTER);
5153
}
5254
}
5355
}

src/main/com/intellij/lang/jsgraphql/ide/configuration/JSGraphQLConfigurationProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public void contentsChanged(@NotNull VirtualFileEvent event) {
166166
VirtualFileManager.getInstance().removeVirtualFileListener(this);
167167
return;
168168
}
169-
if(myProject.getBaseDir().equals(file.getParent())) {
169+
if(file.equals(getGraphQLConfigFile())) {
170170
final JSGraphQLConfiguration configuration = getConfiguration(file);
171171
if(configuration != null && configuration.endpoints != null) {
172172
synchronized (endpointsLock) {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Copyright (c) 2015-present, Jim Kynde Meyer
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
package com.intellij.lang.jsgraphql.ide.editor;
9+
10+
public class JSGraphQLQueryContext {
11+
12+
public String query;
13+
public Runnable onError;
14+
15+
public JSGraphQLQueryContext(String query, Runnable onError) {
16+
this.query = query;
17+
this.onError = onError;
18+
}
19+
}

0 commit comments

Comments
 (0)