Skip to content

Commit

Permalink
Support all command variants
Browse files Browse the repository at this point in the history
  • Loading branch information
niknetniko committed Mar 7, 2024
1 parent 671345c commit e2d9110
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ open class LatexNonBreakingSpaceInspection : TexifyInspectionBase() {
/**
* Commands redefined by cleveref, such that no non-breaking space is needed anymore.
*/
private val cleverefRedefinitions = setOf(THREF, VREF, VREF_CAPITAL, VREFRANGE, FULLREF).map { it.commandWithSlash }
private val cleverefRedefinitions = listOf(THREF.commandWithSlash) + setOf(VREF, VREFRANGE, FULLREF).map { it.command }.flatMap { c -> listOf(c, "$c*", c.replaceFirstChar { it.uppercase() }) }.map { "\\" + it }

override val inspectionGroup = InsightGroup.LATEX

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,25 @@ class LatexNonBreakingSpaceInspectionTest : TexifyInspectionTestBase(LatexNonBre
""".trimIndent()
)
}

fun `test no warning when using cleveref`() {
myFixture.configureByText(
LatexFileType,
"""
\documentclass{article}
\usepakackage{varioref}
\usepackage{cleveref}
\begin{document}
\begin{figure}
Figure text.
\caption{Caption}
\label{fig:some-figure}
\end{figure}
I ref \vref{fig:some-figure}
\end{document}
""".trimIndent()
)
myFixture.checkHighlighting(false, false, true, false)
}
}

0 comments on commit e2d9110

Please sign in to comment.