From 28caa7c63cf88849e1d9c743fc217e43f93c6d9a Mon Sep 17 00:00:00 2001 From: Julian Valentin Date: Sat, 18 Dec 2021 10:07:20 +0100 Subject: [PATCH] Fix false positives when using siunitx Fixes #134. --- changelog.xml | 3 ++ .../LatexAnnotatedTextBuilderDefaults.kt | 46 +++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/changelog.xml b/changelog.xml index d86dd020..ccd2778d 100644 --- a/changelog.xml +++ b/changelog.xml @@ -25,6 +25,9 @@ Add support for `\newcaptionname` etc. from KOMA-Script and `\DefineBibliographyStrings` from BibLaTeX (LaTeX) + + Fix false positives when using siunitx (LaTeX) + diff --git a/src/main/kotlin/org/bsplines/ltexls/parsing/latex/LatexAnnotatedTextBuilderDefaults.kt b/src/main/kotlin/org/bsplines/ltexls/parsing/latex/LatexAnnotatedTextBuilderDefaults.kt index a991d32a..06c6d72b 100644 --- a/src/main/kotlin/org/bsplines/ltexls/parsing/latex/LatexAnnotatedTextBuilderDefaults.kt +++ b/src/main/kotlin/org/bsplines/ltexls/parsing/latex/LatexAnnotatedTextBuilderDefaults.kt @@ -358,7 +358,11 @@ object LatexAnnotatedTextBuilderDefaults { LatexCommandSignature("\\algdef{}[]{}{}"), LatexCommandSignature("\\algnewcommand{}{}"), LatexCommandSignature("\\algrenewcommand{}{}"), + LatexCommandSignature("\\ampere", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\arabic{}", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\arcminute", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\arcsecond", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\astronomicalunit", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\at{}[]", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\autocite{}", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\autocite[]{}", LatexCommandSignature.Action.Dummy), @@ -425,9 +429,12 @@ object LatexAnnotatedTextBuilderDefaults { LatexCommandSignature("\\autoref{}", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\autoref*{}", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\babeltags{}"), + LatexCommandSignature("\\becquerel", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\bel", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\bibitem{}"), LatexCommandSignature("\\bibliography{}"), LatexCommandSignature("\\bibliographystyle{}"), + LatexCommandSignature("\\candela", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\captionof{}"), LatexCommandSignature("\\captionsetup{}"), LatexCommandSignature("\\captionsetup[]{}"), @@ -535,12 +542,16 @@ object LatexAnnotatedTextBuilderDefaults { LatexCommandSignature("\\color[]{}"), LatexCommandSignature("\\colorbox{}"), LatexCommandSignature("\\colorlet{}{}"), + LatexCommandSignature("\\coulomb", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\counterwithin{}{}"), LatexCommandSignature("\\counterwithin*{}{}"), LatexCommandSignature("\\counterwithout{}{}"), LatexCommandSignature("\\counterwithout*{}{}"), LatexCommandSignature("\\cref{}", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\crefname{}{}{}"), + LatexCommandSignature("\\dalton", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\day", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\decibel", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\declaretheorem{}"), LatexCommandSignature("\\declaretheorem[]{}"), LatexCommandSignature("\\declaretheoremstyle{}"), @@ -556,9 +567,12 @@ object LatexAnnotatedTextBuilderDefaults { LatexCommandSignature("\\definecolor[][]"), LatexCommandSignature("\\definecolor{}{}{}"), LatexCommandSignature("\\definespotcolor{}{}{}"), + LatexCommandSignature("\\degree", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\degreeCelsius", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\directlua{}"), LatexCommandSignature("\\documentclass{}"), LatexCommandSignature("\\documentclass[]{}"), + LatexCommandSignature("\\electronvolt", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\email{}", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\enlargethispage{}"), LatexCommandSignature("\\eqref{}", LatexCommandSignature.Action.Dummy), @@ -566,6 +580,7 @@ object LatexAnnotatedTextBuilderDefaults { LatexCommandSignature("\\etocsetnexttocdepth{}"), LatexCommandSignature("\\etocsettocstyle{}{}"), LatexCommandSignature("\\externalfigure[]", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\farad", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\fcolorbox{}"), LatexCommandSignature("\\floatname{}{}"), LatexCommandSignature("\\floatstyle{}"), @@ -604,6 +619,11 @@ object LatexAnnotatedTextBuilderDefaults { LatexCommandSignature("\\glsxtrnewsymbol{}{}"), LatexCommandSignature("\\glsxtrnewsymbol[]{}{}"), LatexCommandSignature("\\graphicspath{}"), + LatexCommandSignature("\\gray", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\hectare", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\henry", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\hertz", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\hour", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\hphantom{}"), LatexCommandSignature("\\href{}{}", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\hyperref[]"), @@ -641,19 +661,32 @@ object LatexAnnotatedTextBuilderDefaults { LatexCommandSignature("\\input{}"), LatexCommandSignature("\\inputminted{}{}"), LatexCommandSignature("\\inputminted[]{}{}"), + LatexCommandSignature("\\joule", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\katal", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\kelvin", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\kilogram", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\label{}"), LatexCommandSignature("\\lettrine{}{}", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\lettrine[]{}{}", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\linespread{}"), + LatexCommandSignature("\\liter", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\litre", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\loadglsentries{}"), LatexCommandSignature("\\longnewglossaryentry{}{}"), LatexCommandSignature("\\luadirect{}"), LatexCommandSignature("\\luaexec{}"), + LatexCommandSignature("\\lumen", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\lux", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\mdfdefinestyle{}{}"), + LatexCommandSignature("\\meter", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\metre", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\mint{}{}"), LatexCommandSignature("\\mintinline{}{}", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\minute", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\mole", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\multicolumn{}{}"), LatexCommandSignature("\\multirow{}{}"), + LatexCommandSignature("\\neper", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\newabbreviation{}{}"), LatexCommandSignature("\\newabbreviation[]{}{}"), LatexCommandSignature("\\newacronym{}{}"), @@ -688,8 +721,10 @@ object LatexAnnotatedTextBuilderDefaults { LatexCommandSignature("\\newtheorem{}[]{}[]"), LatexCommandSignature("\\newtheorem*{}{}"), LatexCommandSignature("\\newtoggle{}"), + LatexCommandSignature("\\newton", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\nolinkurl{}", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\numberwithin{}{}"), + LatexCommandSignature("\\ohm", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\pagecolor{}"), LatexCommandSignature("\\pagenumbering{}"), LatexCommandSignature("\\pageref{}", LatexCommandSignature.Action.Dummy), @@ -701,6 +736,7 @@ object LatexAnnotatedTextBuilderDefaults { LatexCommandSignature("\\parencite*{}", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\parencite*[]{}", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\parencite*[][]{}", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\pascal", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\pdfbookmark{}{}"), LatexCommandSignature("\\pdfbookmark[]{}{}"), LatexCommandSignature("\\pgfdeclaredecoration{}{}{}"), @@ -721,6 +757,7 @@ object LatexAnnotatedTextBuilderDefaults { LatexCommandSignature("\\providecommand{}[]{}"), LatexCommandSignature("\\providecommand*{}{}"), LatexCommandSignature("\\providecommand*{}[]{}"), + LatexCommandSignature("\\radian", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\raisebox{}"), LatexCommandSignature("\\ref{}", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\ref*{}", LatexCommandSignature.Action.Dummy), @@ -740,6 +777,7 @@ object LatexAnnotatedTextBuilderDefaults { LatexCommandSignature("\\renewenvironment*{}[]{}{}"), LatexCommandSignature("\\renewlist{}{}{}"), LatexCommandSignature("\\scalebox{}"), + LatexCommandSignature("\\second", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\selectlanguage{}"), LatexCommandSignature("\\setabbreviationstyle{}"), LatexCommandSignature("\\setabbreviationstyle[]{}"), @@ -776,12 +814,16 @@ object LatexAnnotatedTextBuilderDefaults { LatexCommandSignature("\\setuppapersize[][]"), LatexCommandSignature("\\setuptoc{}{}"), LatexCommandSignature("\\setupwhitespace[]"), + LatexCommandSignature("\\siemens", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\sievert", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\sisetup{}"), LatexCommandSignature("\\smartcite{}", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\smartcite[]{}", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\smartcite[][]{}", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\stepcounter{}"), + LatexCommandSignature("\\steradian", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\supercite{}", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\tesla", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\textcite{}", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\textcite[]{}", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\textcite[][]{}", LatexCommandSignature.Action.Dummy), @@ -846,6 +888,7 @@ object LatexAnnotatedTextBuilderDefaults { LatexCommandSignature("\\todo[]{}"), LatexCommandSignature("\\togglefalse{}"), LatexCommandSignature("\\toggletrue{}"), + LatexCommandSignature("\\tonne", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\unsettoc{}{}"), LatexCommandSignature("\\url{}", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\useURL[][][][]"), @@ -856,9 +899,12 @@ object LatexAnnotatedTextBuilderDefaults { LatexCommandSignature("\\usepackage[]{}"), LatexCommandSignature("\\usetikzlibrary{}"), LatexCommandSignature("\\value{}"), + LatexCommandSignature("\\volt", LatexCommandSignature.Action.Dummy), LatexCommandSignature("\\vphantom{}"), LatexCommandSignature("\\vspace{}"), LatexCommandSignature("\\vspace*{}"), + LatexCommandSignature("\\watt", LatexCommandSignature.Action.Dummy), + LatexCommandSignature("\\weber", LatexCommandSignature.Action.Dummy), ) val babelLanguageMap: Map = LatexFragmentizer.BABEL_LANGUAGE_MAP