1
0
mirror of https://github.com/chylex/IntelliJ-Inspection-Lens.git synced 2025-04-24 15:15:47 +02:00

Work around missing class error when installed on Gateway Client

Closes 
This commit is contained in:
chylex 2024-04-21 23:47:48 +02:00
parent fcd4d6588d
commit 640d95cddc
Signed by: chylex
GPG Key ID: 4DE42C8F19A80548
2 changed files with 28 additions and 2 deletions
src/main/kotlin/com/chylex/intellij/inspectionlens

View File

@ -0,0 +1,23 @@
package com.chylex.intellij.inspectionlens.compatibility
import com.chylex.intellij.inspectionlens.editor.LensSeverity
import com.intellij.lang.annotation.HighlightSeverity
import com.intellij.openapi.diagnostic.logger
import com.intellij.profile.codeInspection.InspectionProfileManager
import com.intellij.spellchecker.SpellCheckerSeveritiesProvider
object SpellCheckerSupport {
private val log = logger<SpellCheckerSupport>()
fun load() {
typoSeverity?.let { LensSeverity.registerMapping(it, LensSeverity.TYPO) }
}
private val typoSeverity: HighlightSeverity?
get() = try {
SpellCheckerSeveritiesProvider.TYPO
} catch (e: NoClassDefFoundError) {
log.warn("Falling back to registered severity search due to ${e.javaClass.simpleName}: ${e.message}")
InspectionProfileManager.getInstance().severityRegistrar.getSeverity("TYPO")
}
}

View File

@ -1,8 +1,8 @@
package com.chylex.intellij.inspectionlens.editor
import com.chylex.intellij.inspectionlens.InspectionLensRefresher
import com.chylex.intellij.inspectionlens.compatibility.SpellCheckerSupport
import com.intellij.lang.annotation.HighlightSeverity
import com.intellij.spellchecker.SpellCheckerSeveritiesProvider
import com.intellij.ui.ColorUtil
import com.intellij.ui.ColorUtil.toAlpha
import com.intellij.ui.JBColor
@ -43,9 +43,12 @@ enum class LensSeverity(baseColor: Color, lightThemeDarkening: Int, darkThemeBri
HighlightSeverity.WARNING to WARNING,
HighlightSeverity.WEAK_WARNING to WEAK_WARNING,
HighlightSeverity.GENERIC_SERVER_ERROR_OR_WARNING to SERVER_PROBLEM,
SpellCheckerSeveritiesProvider.TYPO to TYPO,
))
init {
SpellCheckerSupport.load()
}
/**
* Registers a mapping from a [HighlightSeverity] to a [LensSeverity], and refreshes all open editors.
*/