Skip to content

Commit

Permalink
refactor: rename AsyncAPISchemaDetector to AsyncAPISpecificationDetector
Browse files Browse the repository at this point in the history
  • Loading branch information
Pakisan committed Dec 10, 2023
1 parent 7c9625e commit 1f0d9b3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.asyncapi.plugin.idea.extensions.icon

import com.asyncapi.plugin.idea.extensions.inspection.AsyncAPISchemaDetector
import com.asyncapi.plugin.idea.extensions.inspection.AsyncAPISpecificationDetector
import com.intellij.ide.IconProvider
import com.intellij.json.psi.JsonFile
import com.intellij.psi.PsiElement
Expand All @@ -13,12 +13,12 @@ import javax.swing.Icon
*/
class AsyncAPIIconProvider: IconProvider() {

private val asyncApiSchemaDetector = AsyncAPISchemaDetector()
private val asyncApiSpecificationDetector = AsyncAPISpecificationDetector()

override fun getIcon(element: PsiElement, flags: Int): Icon? {
if (element is JsonFile || element is YAMLFile) {
if (asyncApiSchemaDetector.isAsyncAPISchema(element as? PsiFile) ||
asyncApiSchemaDetector.isReferencedAsyncAPISchema(element as? PsiFile)
if (asyncApiSpecificationDetector.isAsyncAPISchema(element as? PsiFile) ||
asyncApiSpecificationDetector.isReferencedAsyncAPISchema(element as? PsiFile)
) {
return Icons.ASYNCAPI_ICON
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import com.jetbrains.jsonSchema.impl.JsonSchemaComplianceChecker
*/
class AsyncAPIJsonSchemaInspection: LocalInspectionTool() {

private val asyncAPISchemaDetector = AsyncAPISchemaDetector()
private val asyncAPISpecificationDetector = AsyncAPISpecificationDetector()
private val asyncAPIJsonSchemaProvider = service<AsyncAPIJsonSchemaProvider>()

override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean, session: LocalInspectionToolSession): PsiElementVisitor {
if (!asyncAPISchemaDetector.isAsyncAPIJsonSchema(holder.file)) {
if (!asyncAPISpecificationDetector.isAsyncAPIJsonSchema(holder.file)) {
return PsiElementVisitor.EMPTY_VISITOR
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import org.jetbrains.yaml.psi.YAMLFile
/**
* @author Pavel Bodiachevskii
*/
class AsyncAPISchemaDetector {
class AsyncAPISpecificationDetector {

fun isAsyncAPIJsonSchema(psiFile: PsiFile?): Boolean {
psiFile ?: return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import org.jetbrains.yaml.psi.YamlPsiElementVisitor
*/
class AsyncAPIYamlSchemaInspection: LocalInspectionTool() {

private val asyncAPISchemaDetector = AsyncAPISchemaDetector()
private val asyncAPISpecificationDetector = AsyncAPISpecificationDetector()
private val asyncAPIJsonSchemaProvider = service<AsyncAPIJsonSchemaProvider>()

override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean, session: LocalInspectionToolSession): PsiElementVisitor {
if (!asyncAPISchemaDetector.isAsyncAPIYamlSchema(holder.file)) {
if (!asyncAPISpecificationDetector.isAsyncAPIYamlSchema(holder.file)) {
return PsiElementVisitor.EMPTY_VISITOR
}

Expand Down

0 comments on commit 1f0d9b3

Please sign in to comment.