James-Yu / LaTeX-Workshop

Boost LaTeX typesetting efficiency with preview, compile, autocomplete, colorize, and more.
MIT License
10.74k stars 535 forks source link

Argument hint of command IntelliSense contains unexpected characters included `%` #4441

Closed Yarakashi-Kikohshi closed 1 month ago

Yarakashi-Kikohshi commented 1 month ago

Pre-checks

Environment

The Issue

Argument hint of command IntelliSense contains unexpected characters included %.

Reproduction Steps

Example of \dfrac by amsmath.

  1. Make a tex file as following:
    \documentclass{article}
    \usepackage{amsmath}
    \begin{document}
      \begin{equation}
        \dfrac
      \end{equation}
    \end{document}
  2. Show the suggestion for \dfrac and complete the command
  3. Get the following result:
    \documentclass{article}
    \usepackage{amsmath}
    \begin{document}
      \begin{equation}
        \dfrac{num%:translatable}{den%:translatable}
      \end{equation}
    \end{document}

This issue is likely due to the following code:

https://github.com/James-Yu/LaTeX-Workshop/blob/42da1749013da3bae16a9a9a3a63d25b4aa8399c/data/packages/amsmath.json#L84-L90

This kind of problem can exist even with other packages. I haven't checked all files in data/packages/ so I don't know about other packages.

Expected Behavior

The hint to the right of the % is not necessary.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
  \begin{equation}
    \dfrac{num}{den}
  \end{equation}
\end{document}

Anything Else?

Thank you for everything.