Compare commits

...

3 Commits

Author SHA1 Message Date
chylex 223fceb6b9
Release 1.3.3 2024-04-22 01:24:45 +02:00
chylex 640d95cddc
Work around missing class error when installed on Gateway Client
Closes #21
2024-04-22 00:06:16 +02:00
chylex fcd4d6588d
Revert "Strip HTML from inspection description"
This reverts commit e6be154f

Inspection description is not supposed to contain HTML, and IntelliJ itself does not render HTML in the Problems tool window. Issues with HTML in inspection descriptions should be reported to wherever those inspections are coming from.

Stripping HTML breaks any properly formatted inspections that include anything that looks like an HTML tag, so I'm reverting it.

I might remove unescaping HTML entities later, but I'm not currently aware of it breaking anything, so it can stay.
2024-03-17 02:08:21 +01:00
5 changed files with 37 additions and 8 deletions

View File

@ -8,7 +8,7 @@ plugins {
}
group = "com.chylex.intellij.inspectionlens"
version = "1.3.2"
version = "1.3.3"
repositories {
mavenCentral()

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

@ -39,13 +39,11 @@ class LensRenderer(info: HighlightInfo) : HintRenderer(null) {
private companion object {
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 {
return potentialHtml
.ifContains('<') { StringUtil.stripHtml(it, " ") }
.ifContains('&', StringUtil::unescapeXmlEntities)
private fun unescapeHtmlEntities(potentialHtml: String): String {
return potentialHtml.ifContains('&', StringUtil::unescapeXmlEntities)
}
private fun addMissingPeriod(text: String): String {

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.
*/

View File

@ -17,6 +17,11 @@
]]></description>
<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>
<ul>
<li>Fixed inspections randomly not disappearing.</li>