Skip to content

Commit 9ecb0a2

Browse files
committed
Fix test data formatting
1 parent b2355ec commit 9ecb0a2

27 files changed

+178
-138
lines changed

plugin/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ dependencies {
160160
zipSigner()
161161
}
162162

163+
// Coroutines must be excluded to avoid a conflict with the version bundled with the IDE
164+
// See https://plugins.jetbrains.com/docs/intellij/using-kotlin.html#coroutinesLibraries
163165
implementation(libs.apollo.gradle.plugin.external) {
164166
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-core")
165167
}

plugin/src/main/java/com/apollographql/ijplugin/psi/ApolloGraphQLLexer.java

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,54 @@
1111
*/
1212
package com.apollographql.ijplugin.psi;
1313

14-
import java.util.Stack;
15-
1614
import com.intellij.lexer.FlexLexer;
1715
import com.intellij.psi.tree.IElementType;
1816

17+
import java.util.Stack;
18+
19+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.AMP;
20+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.AT;
21+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.BANG;
22+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.BRACE_L;
23+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.BRACE_R;
24+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.BRACKET_L;
25+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.BRACKET_R;
26+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.CLOSING_QUOTE;
27+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.CLOSING_TRIPLE_QUOTE;
28+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.COLON;
29+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.DIRECTIVE_KEYWORD;
30+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.DOLLAR;
31+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.ENUM_KEYWORD;
32+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.EOL_COMMENT;
33+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.EQUALS;
34+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.EXTEND_KEYWORD;
35+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.FLOAT;
36+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.FRAGMENT_KEYWORD;
37+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.IMPLEMENTS_KEYWORD;
38+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.INPUT_KEYWORD;
39+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.INTERFACE_KEYWORD;
40+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.MUTATION_KEYWORD;
41+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.NAME;
42+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.NUMBER;
43+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.ON_KEYWORD;
44+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.OPEN_QUOTE;
45+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.OPEN_TRIPLE_QUOTE;
46+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.PAREN_L;
47+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.PAREN_R;
48+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.PIPE;
49+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.QUERY_KEYWORD;
50+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.REGULAR_STRING_PART;
51+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.REPEATABLE_KEYWORD;
52+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.SCALAR_KEYWORD;
53+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.SCHEMA_KEYWORD;
54+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.SPREAD;
55+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.SUBSCRIPTION_KEYWORD;
56+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.TEMPLATE_CHAR;
57+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.TYPE_KEYWORD;
58+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.UNION_KEYWORD;
59+
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.VARIABLE_NAME;
1960
import static com.intellij.psi.TokenType.BAD_CHARACTER;
2061
import static com.intellij.psi.TokenType.WHITE_SPACE;
21-
import static com.apollographql.ijplugin.psi.ApolloGraphQLElementTypes.*;
2262

2363

2464
public class ApolloGraphQLLexer implements FlexLexer {

plugin/src/main/kotlin/com/apollographql/ijplugin/normalizedcache/NormalizedCacheToolWindowFactory.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,12 @@ class NormalizedCacheWindowPanel(
318318
}
319319

320320
private fun openNormalizedCache(cacheSource: NormalizedCacheSource) {
321-
project.telemetryService.logEvent(when (cacheSource) {
322-
is ApolloDebugServer -> ApolloIjNormalizedCacheOpenApolloDebugCache()
323-
is DeviceFile -> ApolloIjNormalizedCacheOpenDeviceFile()
324-
is LocalFile -> ApolloIjNormalizedCacheOpenLocalFile()
325-
}
321+
project.telemetryService.logEvent(
322+
when (cacheSource) {
323+
is ApolloDebugServer -> ApolloIjNormalizedCacheOpenApolloDebugCache()
324+
is DeviceFile -> ApolloIjNormalizedCacheOpenDeviceFile()
325+
is LocalFile -> ApolloIjNormalizedCacheOpenLocalFile()
326+
}
326327
)
327328
setContent(createLoadingContent())
328329
object : Task.Backgroundable(

plugin/src/main/kotlin/com/apollographql/ijplugin/refactoring/migration/v3tov4/ApolloV3ToV4MigrationProcessor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import com.intellij.openapi.project.Project
3434
*/
3535
class ApolloV3ToV4MigrationProcessor(project: Project) : ApolloMigrationRefactoringProcessor(project) {
3636
companion object {
37-
const val apollo4LatestVersion = "4.1.1"
37+
const val apollo4LatestVersion = "4.3.0"
3838
}
3939

4040
override val refactoringName = ApolloBundle.message("ApolloV3ToV4MigrationProcessor.title")

plugin/src/test/kotlin/com/apollographql/ijplugin/navigation/KotlinDefinitionMarkerProviderTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import org.junit.Test
1111
import org.junit.runner.RunWith
1212
import org.junit.runners.JUnit4
1313

14-
1514
@RunWith(JUnit4::class)
1615
class KotlinDefinitionMarkerProviderTest : ApolloTestCase() {
1716

@@ -33,7 +32,7 @@ class KotlinDefinitionMarkerProviderTest : ApolloTestCase() {
3332

3433
@Test
3534
fun fragmentMarker() {
36-
val (fragmentSource, fragmentTarget) = infoList[1].sourceAndTarget()
35+
val (fragmentSource, fragmentTarget) = infoList[3].sourceAndTarget()
3736
fragmentSource.assertTypeAndText<PsiElement>("ScreenFields")
3837
fragmentTarget.assertTypeAndText<GraphQLFragmentDefinition>("fragment ScreenFields")
3938
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
query MyQuery {
2-
<caret>person {
3-
identity {
4-
firstName @catch(to: THROW)
5-
lastName
6-
}
7-
}
2+
<caret>person {
3+
identity {
4+
firstName @catch(to: THROW)
5+
lastName
6+
}
7+
}
88
}

plugin/src/test/testData/migration/compat-to-operationbased/reworkInlineFragmentFields.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class FruitListQuery() : Query<FruitListQuery.Data> {
1515
public override fun name(): String = TODO()
1616
public override fun serializeVariables(
1717
writer: JsonWriter,
18-
customScalarAdapters: CustomScalarAdapters,
18+
customScalarAdapters: CustomScalarAdapters
1919
): Unit {
2020
}
2121

plugin/src/test/testData/migration/compat-to-operationbased/reworkInlineFragmentFields_after.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class FruitListQuery() : Query<FruitListQuery.Data> {
1515
public override fun name(): String = TODO()
1616
public override fun serializeVariables(
1717
writer: JsonWriter,
18-
customScalarAdapters: CustomScalarAdapters,
18+
customScalarAdapters: CustomScalarAdapters
1919
): Unit {
2020
}
2121

@@ -32,13 +32,13 @@ public class FruitListQuery() : Query<FruitListQuery.Data> {
3232
)
3333

3434
public data class List(
35-
public val __typename: String,
36-
public val id: String,
37-
/**
35+
public val __typename: String,
36+
public val id: String,
37+
/**
3838
* Synthetic field for inline fragment on Cherry
3939
*/
4040
public val asCherry: OnCherry?,
41-
/**
41+
/**
4242
* Synthetic field for inline fragment on Apple
4343
*/
4444
public val asApple: OnApple?,
@@ -51,14 +51,14 @@ public class FruitListQuery() : Query<FruitListQuery.Data> {
5151
)
5252

5353
public data class AsApple(
54-
public val __typename: String,
55-
public val id: String,
56-
public val color: String,
57-
/**
54+
public val __typename: String,
55+
public val id: String,
56+
public val color: String,
57+
/**
5858
* Synthetic field for inline fragment on Golden
5959
*/
6060
public val asGolden: OnGolden?,
61-
/**
61+
/**
6262
* Synthetic field for inline fragment on Granny
6363
*/
6464
public val asGranny: OnGranny?,

plugin/src/test/testData/migration/v2-to-v3/addCustomTypeAdapter.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ enum class CustomType : ScalarType {
2121

2222
suspend fun main() {
2323
val apolloClient = ApolloClient.builder()
24-
.addCustomTypeAdapter(CustomType.DATETIME, DateTimeAdapter())
25-
.addCustomTypeAdapter(CustomType.URL, UrlAdapter())
26-
.build()
24+
.addCustomTypeAdapter(CustomType.DATETIME, DateTimeAdapter())
25+
.addCustomTypeAdapter(CustomType.URL, UrlAdapter())
26+
.build()
2727
}
2828

2929
class DateTimeAdapter : CustomTypeAdapter<Date> {

plugin/src/test/testData/migration/v2-to-v3/addCustomTypeAdapter_after.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ enum class CustomType : ScalarType {
2121

2222
suspend fun main() {
2323
val apolloClient = ApolloClient.Builder()
24-
// TODO: Use addCustomScalarAdapter instead. See https://www.apollographql.com/docs/kotlin/migration/3.0/#custom-scalar-adapters
25-
.addCustomTypeAdapter(DateTime.type, DateTimeAdapter())
26-
// TODO: Use addCustomScalarAdapter instead. See https://www.apollographql.com/docs/kotlin/migration/3.0/#custom-scalar-adapters
27-
.addCustomTypeAdapter(Url.type, UrlAdapter())
28-
.build()
24+
// TODO: Use addCustomScalarAdapter instead. See https://www.apollographql.com/docs/kotlin/migration/3.0/#custom-scalar-adapters
25+
.addCustomTypeAdapter(DateTime.type, DateTimeAdapter())
26+
// TODO: Use addCustomScalarAdapter instead. See https://www.apollographql.com/docs/kotlin/migration/3.0/#custom-scalar-adapters
27+
.addCustomTypeAdapter(Url.type, UrlAdapter())
28+
.build()
2929
}
3030

3131
class DateTimeAdapter : CustomTypeAdapter<Date> {

0 commit comments

Comments
 (0)