From 7c9625e3a3a0eb97784cdf8401747a9efaa097f8 Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Mon, 11 Dec 2023 03:52:57 +0400 Subject: [PATCH] refactor: rename AsyncAPISchemaIndexer to AsyncAPISpecificationIndexer --- .../idea/extensions/index/AsyncAPISpecificationIndex.kt | 2 +- ...PISchemaIndexer.kt => AsyncAPISpecificationIndexer.kt} | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) rename src/main/kotlin/com/asyncapi/plugin/idea/extensions/index/{AsyncAPISchemaIndexer.kt => AsyncAPISpecificationIndexer.kt} (78%) diff --git a/src/main/kotlin/com/asyncapi/plugin/idea/extensions/index/AsyncAPISpecificationIndex.kt b/src/main/kotlin/com/asyncapi/plugin/idea/extensions/index/AsyncAPISpecificationIndex.kt index 1e04d03..38f8710 100644 --- a/src/main/kotlin/com/asyncapi/plugin/idea/extensions/index/AsyncAPISpecificationIndex.kt +++ b/src/main/kotlin/com/asyncapi/plugin/idea/extensions/index/AsyncAPISpecificationIndex.kt @@ -18,7 +18,7 @@ class AsyncAPISpecificationIndex: FileBasedIndexExtension>() override fun getName(): ID> = asyncapiIndexId - override fun getIndexer(): DataIndexer, FileContent> = AsyncAPISchemaIndexer() + override fun getIndexer(): DataIndexer, FileContent> = AsyncAPISpecificationIndexer() override fun getKeyDescriptor(): KeyDescriptor = EnumeratorStringDescriptor.INSTANCE diff --git a/src/main/kotlin/com/asyncapi/plugin/idea/extensions/index/AsyncAPISchemaIndexer.kt b/src/main/kotlin/com/asyncapi/plugin/idea/extensions/index/AsyncAPISpecificationIndexer.kt similarity index 78% rename from src/main/kotlin/com/asyncapi/plugin/idea/extensions/index/AsyncAPISchemaIndexer.kt rename to src/main/kotlin/com/asyncapi/plugin/idea/extensions/index/AsyncAPISpecificationIndexer.kt index 6ee6f9a..fed351a 100644 --- a/src/main/kotlin/com/asyncapi/plugin/idea/extensions/index/AsyncAPISchemaIndexer.kt +++ b/src/main/kotlin/com/asyncapi/plugin/idea/extensions/index/AsyncAPISpecificationIndexer.kt @@ -10,7 +10,7 @@ import org.jetbrains.yaml.psi.YAMLFile /** * @author Pavel Bodiachevskii */ -class AsyncAPISchemaIndexer: DataIndexer, FileContent> { +class AsyncAPISpecificationIndexer: DataIndexer, FileContent> { private val asyncAPISpecificationRecognizer = service() @@ -21,16 +21,16 @@ class AsyncAPISchemaIndexer: DataIndexer, FileContent> { return index } - val asyncapiSchema = when(inputData.psiFile) { + val asyncapiSpecification = when(inputData.psiFile) { is JsonFile -> inputData.psiFile as JsonFile is YAMLFile -> inputData.psiFile as YAMLFile else -> null } - asyncapiSchema ?: return index + asyncapiSpecification ?: return index index[AsyncAPISpecificationIndex.asyncapi] = setOf(inputData.file.path) var foundReferences = emptySet() - AsyncAPISpecificationReferencesCollector(asyncapiSchema, inputData.file.parent).collectFiles().forEach { (referenceType, references) -> + AsyncAPISpecificationReferencesCollector(asyncapiSpecification, inputData.file.parent).collectFiles().forEach { (referenceType, references) -> index[referenceType] = references foundReferences = foundReferences.plus(references)