mirror of
https://github.com/chylex/IntelliJ-Inspection-Lens.git
synced 2024-11-24 22:42:52 +01:00
Compare commits
3 Commits
1c92cf000f
...
223fceb6b9
Author | SHA1 | Date | |
---|---|---|---|
223fceb6b9 | |||
640d95cddc | |||
fcd4d6588d |
@ -8,7 +8,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "com.chylex.intellij.inspectionlens"
|
group = "com.chylex.intellij.inspectionlens"
|
||||||
version = "1.3.2"
|
version = "1.3.3"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@ -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")
|
||||||
|
}
|
||||||
|
}
|
@ -39,13 +39,11 @@ class LensRenderer(info: HighlightInfo) : HintRenderer(null) {
|
|||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
private fun getValidDescriptionText(text: String?): String {
|
private fun getValidDescriptionText(text: String?): String {
|
||||||
return if (text.isNullOrBlank()) " " else addMissingPeriod(convertHtmlToText(text))
|
return if (text.isNullOrBlank()) " " else addMissingPeriod(unescapeHtmlEntities(text))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun convertHtmlToText(potentialHtml: String): String {
|
private fun unescapeHtmlEntities(potentialHtml: String): String {
|
||||||
return potentialHtml
|
return potentialHtml.ifContains('&', StringUtil::unescapeXmlEntities)
|
||||||
.ifContains('<') { StringUtil.stripHtml(it, " ") }
|
|
||||||
.ifContains('&', StringUtil::unescapeXmlEntities)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addMissingPeriod(text: String): String {
|
private fun addMissingPeriod(text: String): String {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.chylex.intellij.inspectionlens.editor
|
package com.chylex.intellij.inspectionlens.editor
|
||||||
|
|
||||||
import com.chylex.intellij.inspectionlens.InspectionLensRefresher
|
import com.chylex.intellij.inspectionlens.InspectionLensRefresher
|
||||||
|
import com.chylex.intellij.inspectionlens.compatibility.SpellCheckerSupport
|
||||||
import com.intellij.lang.annotation.HighlightSeverity
|
import com.intellij.lang.annotation.HighlightSeverity
|
||||||
import com.intellij.spellchecker.SpellCheckerSeveritiesProvider
|
|
||||||
import com.intellij.ui.ColorUtil
|
import com.intellij.ui.ColorUtil
|
||||||
import com.intellij.ui.ColorUtil.toAlpha
|
import com.intellij.ui.ColorUtil.toAlpha
|
||||||
import com.intellij.ui.JBColor
|
import com.intellij.ui.JBColor
|
||||||
@ -43,9 +43,12 @@ enum class LensSeverity(baseColor: Color, lightThemeDarkening: Int, darkThemeBri
|
|||||||
HighlightSeverity.WARNING to WARNING,
|
HighlightSeverity.WARNING to WARNING,
|
||||||
HighlightSeverity.WEAK_WARNING to WEAK_WARNING,
|
HighlightSeverity.WEAK_WARNING to WEAK_WARNING,
|
||||||
HighlightSeverity.GENERIC_SERVER_ERROR_OR_WARNING to SERVER_PROBLEM,
|
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.
|
* Registers a mapping from a [HighlightSeverity] to a [LensSeverity], and refreshes all open editors.
|
||||||
*/
|
*/
|
||||||
|
@ -17,6 +17,11 @@
|
|||||||
]]></description>
|
]]></description>
|
||||||
|
|
||||||
<change-notes><![CDATA[
|
<change-notes><![CDATA[
|
||||||
|
<b>Version 1.3.3</b>
|
||||||
|
<ul>
|
||||||
|
<li>Partially reverted fix for inspections that include HTML in their description due to breaking inspections with angled brackets.</li>
|
||||||
|
<li>Fixed plugin not working when installed on JetBrains Gateway Client.</li>
|
||||||
|
</ul>
|
||||||
<b>Version 1.3.2</b>
|
<b>Version 1.3.2</b>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Fixed inspections randomly not disappearing.</li>
|
<li>Fixed inspections randomly not disappearing.</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user