Skip to content

Commit 90fc1e0

Browse files
committed
Add more formatters
[skip ci]
1 parent bc12022 commit 90fc1e0

File tree

14 files changed

+902
-838
lines changed

14 files changed

+902
-838
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@ on:
2222
pull_request:
2323

2424
jobs:
25-
2625
# Run Gradle Wrapper Validation Action to verify the wrapper's checksum
2726
gradleValidation:
2827
name: Gradle Wrapper
2928
runs-on: ubuntu-latest
3029
steps:
31-
3230
# Check out current repository
3331
- name: Fetch Sources
3432
uses: actions/[email protected]
@@ -43,7 +41,6 @@ jobs:
4341
needs: gradleValidation
4442
runs-on: ubuntu-latest
4543
steps:
46-
4744
# Check out current repository
4845
- name: Fetch Sources
4946
uses: actions/[email protected]
@@ -100,7 +97,6 @@ jobs:
10097
version: ${{ steps.properties.outputs.version }}
10198
changelog: ${{ steps.properties.outputs.changelog }}
10299
steps:
103-
104100
# Check out current repository
105101
- name: Fetch Sources
106102
uses: actions/[email protected]
@@ -149,7 +145,6 @@ jobs:
149145
needs: build
150146
runs-on: ubuntu-latest
151147
steps:
152-
153148
# Check out current repository
154149
- name: Fetch Sources
155150
uses: actions/[email protected]

.github/workflows/release.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ on:
77
types: [prereleased, released]
88

99
jobs:
10-
1110
# Prepare and publish the plugin to the Marketplace repository
1211
release:
1312
name: Publish Plugin
1413
runs-on: ubuntu-latest
1514
steps:
16-
1715
# Check out current repository
1816
- name: Fetch Sources
1917
uses: actions/[email protected]

.github/workflows/run-ui-tests.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88
# Workflow is triggered manually.
99

1010
name: Run UI Tests
11-
on:
12-
workflow_dispatch
11+
on: workflow_dispatch
1312

1413
jobs:
15-
1614
testUI:
1715
runs-on: ${{ matrix.os }}
1816
strategy:
@@ -30,7 +28,6 @@ jobs:
3028
runIde: ./gradlew runIdeForUiTests &
3129

3230
steps:
33-
3431
# Check out current repository
3532
- name: Fetch Sources
3633
uses: actions/[email protected]

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Spring GraphQL Support
22

33
## [Unreleased]
4+
45
### Added
6+
57
- Temporary

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
[![Downloads](https://img.shields.io/jetbrains/plugin/d/17963-spring-graphql-support.svg)](https://plugins.jetbrains.com/plugin/17963-spring-graphql-support)
88

99
<!-- Plugin description -->
10+
1011
This plugin adds support for [Spring GraphQL](https://spring.io/projects/spring-graphql). **The plugin is currently Work in Progress!**
1112

1213
Features:
14+
1315
- Autocompletion of types and fields in @SchemaMapping annotations
1416
- Navigation between mappings and the schema
1517
- Checks for @BatchMapping return type
@@ -19,10 +21,10 @@ Features:
1921
## Installation
2022

2123
- Using IDE built-in plugin system:
22-
24+
2325
<kbd>Settings/Preferences</kbd> > <kbd>Plugins</kbd> > <kbd>Marketplace</kbd> > <kbd>Search for "Spring GraphQL Support"</kbd> >
2426
<kbd>Install Plugin</kbd>
25-
27+
2628
- Manually:
2729

2830
Download the [latest release](https://github.com/jord1e/spring-graphql-intellij-plugin/releases/latest) and install it manually using

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ spotless {
4343
googleJavaFormat("1.13.0")
4444
}
4545
format("prettier") {
46+
prettier(mapOf("prettier" to "2.5.1", "@prettier/plugin-xml" to "1.2.0"))
4647
target(
4748
"/*.md",
4849
"/*.yml",
4950
"/.github/**/*.yml",
5051
"/src/main/resources/META-INF/plugin.xml",
5152
"/src/main/resources/inspectionDescriptions/*.html"
5253
)
53-
prettier("2.5.1")
5454
}
5555
}
5656

src/main/java/nl/jrdie/idea/springql/references/QLArgumentNamePolyReference.java

Lines changed: 52 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -10,77 +10,74 @@
1010
import com.intellij.psi.PsiPolyVariantReferenceBase;
1111
import com.intellij.psi.ResolveResult;
1212
import com.intellij.util.ArrayUtilRt;
13+
import java.util.Objects;
1314
import nl.jrdie.idea.springql.icons.QLIcons;
1415
import nl.jrdie.idea.springql.svc.QLIdeService;
1516
import nl.jrdie.idea.springql.types.SchemaMappingSummary;
1617
import org.jetbrains.annotations.NotNull;
1718
import org.jetbrains.uast.UMethod;
1819
import org.jetbrains.uast.UastContextKt;
1920

20-
import java.util.Objects;
21-
2221
public class QLArgumentNamePolyReference extends PsiPolyVariantReferenceBase<PsiElement> {
2322

24-
public QLArgumentNamePolyReference(@NotNull PsiElement psiElement) {
25-
super(Objects.requireNonNull(psiElement, "element"));
26-
}
27-
28-
@NotNull
29-
@Override
30-
public Object[] getVariants() {
31-
final UMethod uMethod = UastContextKt.getUastParentOfType(myElement, UMethod.class);
32-
if (uMethod == null) {
33-
return ArrayUtilRt.EMPTY_OBJECT_ARRAY;
34-
}
23+
public QLArgumentNamePolyReference(@NotNull PsiElement psiElement) {
24+
super(Objects.requireNonNull(psiElement, "element"));
25+
}
3526

36-
final QLIdeService svc = myElement.getProject().getService(QLIdeService.class);
37-
final SchemaMappingSummary summary = svc.getSummaryForMethod(uMethod);
38-
if (summary == null) {
39-
return ArrayUtilRt.EMPTY_OBJECT_ARRAY;
40-
}
27+
@NotNull
28+
@Override
29+
public Object[] getVariants() {
30+
final UMethod uMethod = UastContextKt.getUastParentOfType(myElement, UMethod.class);
31+
if (uMethod == null) {
32+
return ArrayUtilRt.EMPTY_OBJECT_ARRAY;
33+
}
4134

42-
final FieldDefinition fieldDefinition = svc.getSchemaRegistry()
43-
.getFieldDefinition(summary.getTypeName(), summary.getFieldName());
44-
if (fieldDefinition == null) {
45-
return ArrayUtilRt.EMPTY_OBJECT_ARRAY;
46-
}
35+
final QLIdeService svc = myElement.getProject().getService(QLIdeService.class);
36+
final SchemaMappingSummary summary = svc.getSummaryForMethod(uMethod);
37+
if (summary == null) {
38+
return ArrayUtilRt.EMPTY_OBJECT_ARRAY;
39+
}
4740

48-
return fieldDefinition
49-
.getInputValueDefinitions()
50-
.stream()
51-
.map(input -> LookupElementBuilder.create(input.getName())
52-
.withTypeText(TypeUtil.simplePrint(input.getType()))
53-
.withPsiElement(input.getElement())
54-
.withIcon(QLIcons.INSTANCE.getVariable()))
55-
.toArray(LookupElement[]::new);
41+
final FieldDefinition fieldDefinition =
42+
svc.getSchemaRegistry().getFieldDefinition(summary.getTypeName(), summary.getFieldName());
43+
if (fieldDefinition == null) {
44+
return ArrayUtilRt.EMPTY_OBJECT_ARRAY;
5645
}
5746

58-
@NotNull
59-
@Override
60-
public ResolveResult[] multiResolve(boolean incompleteCode) {
61-
final UMethod uMethod = UastContextKt.getUastParentOfType(myElement, UMethod.class);
62-
if (uMethod == null) {
63-
return ResolveResult.EMPTY_ARRAY;
64-
}
47+
return fieldDefinition.getInputValueDefinitions().stream()
48+
.map(
49+
input ->
50+
LookupElementBuilder.create(input.getName())
51+
.withTypeText(TypeUtil.simplePrint(input.getType()))
52+
.withPsiElement(input.getElement())
53+
.withIcon(QLIcons.INSTANCE.getVariable()))
54+
.toArray(LookupElement[]::new);
55+
}
6556

66-
final QLIdeService svc = myElement.getProject().getService(QLIdeService.class);
67-
final SchemaMappingSummary summary = svc.getSummaryForMethod(uMethod);
68-
if (summary == null) {
69-
return ResolveResult.EMPTY_ARRAY;
70-
}
57+
@NotNull
58+
@Override
59+
public ResolveResult[] multiResolve(boolean incompleteCode) {
60+
final UMethod uMethod = UastContextKt.getUastParentOfType(myElement, UMethod.class);
61+
if (uMethod == null) {
62+
return ResolveResult.EMPTY_ARRAY;
63+
}
7164

72-
final FieldDefinition fieldDefinition = svc.getSchemaRegistry()
73-
.getFieldDefinition(summary.getTypeName(), summary.getFieldName());
74-
if (fieldDefinition == null) {
75-
return ResolveResult.EMPTY_ARRAY;
76-
}
65+
final QLIdeService svc = myElement.getProject().getService(QLIdeService.class);
66+
final SchemaMappingSummary summary = svc.getSummaryForMethod(uMethod);
67+
if (summary == null) {
68+
return ResolveResult.EMPTY_ARRAY;
69+
}
7770

78-
return fieldDefinition
79-
.getInputValueDefinitions()
80-
.stream()
81-
.map(AbstractNode::getElement)
82-
.filter(Objects::nonNull)
83-
.map(PsiElementResolveResult::new)
84-
.toArray(ResolveResult[]::new);
71+
final FieldDefinition fieldDefinition =
72+
svc.getSchemaRegistry().getFieldDefinition(summary.getTypeName(), summary.getFieldName());
73+
if (fieldDefinition == null) {
74+
return ResolveResult.EMPTY_ARRAY;
8575
}
76+
77+
return fieldDefinition.getInputValueDefinitions().stream()
78+
.map(AbstractNode::getElement)
79+
.filter(Objects::nonNull)
80+
.map(PsiElementResolveResult::new)
81+
.toArray(ResolveResult[]::new);
82+
}
8683
}

0 commit comments

Comments
 (0)