varabyte / kobweb-intellij-plugin

An official IntelliJ IDE plugin to include Kobweb-specific enhancements and understanding to your project
Apache License 2.0
10 stars 2 forks source link

Only run Kobweb actions if we're in a proper Kobweb module #25

Closed bitspittle closed 8 months ago

bitspittle commented 8 months ago

Probably some way to ask the current file context something like this:

enum class KobwebModuleType {
   APPLICATION,
   LIBRARY,
   WORKER;
}

// WORKER modules don't have access to the UI so many Kobweb actions / inspections are not relevant there
fun KobwebModuleType.isFramework() = this == APPLICATION || this == LIBRARY

fun Module.findKobwebType(): KobwebModuleType() = { /* how do we do this? */ }

// Later, say in UnusedInspectionSuppressor
someContext.module.findKobwebType()?.isFramework() ?: return // Early abort