diff --git a/intellij-plugin/src/main/scala/io/github/dreamylost/plugin/ScalaMacroProcessorProvider.scala b/intellij-plugin/src/main/scala/io/github/dreamylost/plugin/ScalaMacroProcessorProvider.scala index 3f25e07b..6bf16a66 100644 --- a/intellij-plugin/src/main/scala/io/github/dreamylost/plugin/ScalaMacroProcessorProvider.scala +++ b/intellij-plugin/src/main/scala/io/github/dreamylost/plugin/ScalaMacroProcessorProvider.scala @@ -2,8 +2,8 @@ package io.github.dreamylost.plugin import com.intellij.openapi.Disposable import io.github.dreamylost.plugin.processor.Processor -import io.github.dreamylost.plugin.processor.clazz.{ApplyProcessor, BuilderProcessor, ConstructorProcessor, JsonProcessor, LogProcessor} -import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.{ScClass, ScObject, ScTypeDefinition} +import io.github.dreamylost.plugin.processor.clazz.{ ApplyProcessor, BuilderProcessor, ConstructorProcessor, JsonProcessor, LogProcessor } +import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.{ ScClass, ScObject, ScTypeDefinition } import scala.collection.mutable @@ -33,9 +33,9 @@ class ScalaMacroProcessorProvider extends Disposable { def findProcessors(source: ScTypeDefinition): Seq[Processor] = { processors.filter { p => source match { - case obj: ScObject => obj.hasAnnotation(p._1) || obj.fakeCompanionClassOrCompanionClass.hasAnnotation(p._1) + case obj: ScObject => obj.hasAnnotation(p._1) || obj.fakeCompanionClassOrCompanionClass.hasAnnotation(p._1) case clazz: ScClass => clazz.hasAnnotation(p._1) - case _ => source.hasAnnotation(p._1) + case _ => source.hasAnnotation(p._1) } }.values.toSeq } diff --git a/intellij-plugin/src/main/scala/io/github/dreamylost/plugin/processor/clazz/ApplyProcessor.scala b/intellij-plugin/src/main/scala/io/github/dreamylost/plugin/processor/clazz/ApplyProcessor.scala index 794b04a7..c3e9cfdb 100644 --- a/intellij-plugin/src/main/scala/io/github/dreamylost/plugin/processor/clazz/ApplyProcessor.scala +++ b/intellij-plugin/src/main/scala/io/github/dreamylost/plugin/processor/clazz/ApplyProcessor.scala @@ -1,8 +1,8 @@ package io.github.dreamylost.plugin.processor.clazz import io.github.dreamylost.plugin.processor.ProcessType.ProcessType -import io.github.dreamylost.plugin.processor.{AbsProcessor, ProcessType} -import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.{ScClass, ScObject, ScTypeDefinition} +import io.github.dreamylost.plugin.processor.{ AbsProcessor, ProcessType } +import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.{ ScClass, ScObject, ScTypeDefinition } /** * Desc: Processor for annotation apply diff --git a/intellij-plugin/src/main/scala/io/github/dreamylost/plugin/processor/clazz/ConstructorProcessor.scala b/intellij-plugin/src/main/scala/io/github/dreamylost/plugin/processor/clazz/ConstructorProcessor.scala index 3f7192b1..636a3354 100644 --- a/intellij-plugin/src/main/scala/io/github/dreamylost/plugin/processor/clazz/ConstructorProcessor.scala +++ b/intellij-plugin/src/main/scala/io/github/dreamylost/plugin/processor/clazz/ConstructorProcessor.scala @@ -2,10 +2,10 @@ package io.github.dreamylost.plugin.processor.clazz import io.github.dreamylost.plugin.ScalaMacroNames import io.github.dreamylost.plugin.processor.ProcessType.ProcessType -import io.github.dreamylost.plugin.processor.{AbsProcessor, ProcessType} +import io.github.dreamylost.plugin.processor.{ AbsProcessor, ProcessType } import org.jetbrains.plugins.scala.lang.psi.api.expr.ScMethodCall import org.jetbrains.plugins.scala.lang.psi.api.statements.ScVariableDefinition -import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.{ScClass, ScTypeDefinition} +import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.{ ScClass, ScTypeDefinition } import org.jetbrains.plugins.scala.lang.psi.types.ScLiteralType /** diff --git a/intellij-plugin/src/main/scala/io/github/dreamylost/plugin/processor/clazz/LogProcessor.scala b/intellij-plugin/src/main/scala/io/github/dreamylost/plugin/processor/clazz/LogProcessor.scala index a6e9cfb9..219d5bc0 100644 --- a/intellij-plugin/src/main/scala/io/github/dreamylost/plugin/processor/clazz/LogProcessor.scala +++ b/intellij-plugin/src/main/scala/io/github/dreamylost/plugin/processor/clazz/LogProcessor.scala @@ -21,15 +21,16 @@ class LogProcessor extends AbsProcessor { typ match { case ProcessType.Field => source match { - case clazz@(_: ScClass | _: ScObject) => - clazz.annotations(ScalaMacroNames.LOG).lastOption.fold[Seq[String]](Nil) { an => { - an.annotationExpr.getText match { - case expr if expr.contains("Slf4j") => Seq(logExpr("org.slf4j.Logger")) - case expr if expr.contains("Log4j2") => Seq(logExpr("org.apache.logging.log4j.Logger")) - case _ => Seq(logExpr()) + case clazz @ (_: ScClass | _: ScObject) => + clazz.annotations(ScalaMacroNames.LOG).lastOption.fold[Seq[String]](Nil) { an => + { + an.annotationExpr.getText match { + case expr if expr.contains("Slf4j") => Seq(logExpr("org.slf4j.Logger")) + case expr if expr.contains("Log4j2") => Seq(logExpr("org.apache.logging.log4j.Logger")) + case _ => Seq(logExpr()) + } } } - } case _ => Nil } case _ => Nil