Skip to content

Commit

Permalink
Merge pull request #3485 from niknetniko/master
Browse files Browse the repository at this point in the history
Add support for \Vref
  • Loading branch information
PHPirates authored Mar 8, 2024
2 parents c5a6244 + e2d9110 commit fa5549a
Show file tree
Hide file tree
Showing 3 changed files with 23 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, 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 @@ -385,6 +385,7 @@ enum class LatexGenericRegularCommand(
VDOTS("vdots", display = ""),
VLINE("vline"),
VREF("vref", "key".asRequired(Argument.Type.LABEL), dependency = VARIOREF),
VREF_CAPITAL("Vref", "key".asRequired(Argument.Type.LABEL), dependency = VARIOREF),
VREFRANGE("vrefrange", "start".asRequired(), "end".asRequired(), "text".asOptional(), dependency = VARIOREF),
VSPACE("vspace", "length".asRequired()),
VSPACE_STAR("vspace*", "length".asRequired()),
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 fa5549a

Please sign in to comment.