Skip to content

Commit

Permalink
Add \micro to autocompletion, fix #3795
Browse files Browse the repository at this point in the history
  • Loading branch information
PHPirates committed Dec 28, 2024
1 parent aee3572 commit 0e2cfe4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Fix parse erron when using inline math in cases* environment in inline math
* Fix exceptions #3813, #3818
* Fix false positive non-breaking space warning for \nameref
* Fix confusion with \micro and \mu unicode characters

## [0.9.10-alpha.4] - 2024-12-21

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class LatexUnicodeInspection : TexifyInspectionBase() {
// Try to find in lookup for special command
val replacement: String?
val command: LatexCommand? = if (inMathMode) {
LatexMathCommand.findByDisplay(c)?.firstOrNull()
LatexMathCommand.findByDisplay(c)?.firstOrNull() ?: LatexRegularCommand.findByDisplay(c)?.firstOrNull()
}
else {
LatexRegularCommand.findByDisplay(c)?.firstOrNull()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum class LatexSiunitxCommand(
NUM("num", "options".asOptional(), "number".asRequired(), dependency = SIUNITX),
UNIT("unit", "options".asOptional(), "unit".asRequired(), dependency = SIUNITX),
QTY("qty", "options".asOptional(), "number".asRequired(), "unit".asRequired(), dependency = SIUNITX),
MICRO("micro", display = "µ", dependency = SIUNITX),
NUMLIST("numlist", "options".asOptional(), "numbers".asRequired(), dependency = SIUNITX),
NUMPRODUCT("numproduct", "options".asOptional(), "numbers".asRequired(), dependency = SIUNITX),
NUMRANGE("numrange", "options".asOptional(), "number1".asRequired(), "number2".asRequired(), dependency = SIUNITX),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ class LatexUnicodeInspectionQuickFix : LatexUnicodeInspectionTest() {
testNamedQuickFix("é", "\\'e", "Escape Unicode character", 2)
}

fun `test mu`() {
setUnicodeSupport(false)

testNamedQuickFix("$ µ$", "$ \\micro$", "Escape Unicode character", 1)
testNamedQuickFix("$ μ$", "$ \\mu$", "Escape Unicode character", 1)
}

@Suppress("NonAsciiCharacters")
fun `test escape unicode quick fix î`() {
setUnicodeSupport(false)
Expand Down

0 comments on commit 0e2cfe4

Please sign in to comment.