texstudio icon indicating copy to clipboard operation
texstudio copied to clipboard

keyval completion fails if keys are last argument

Open mbertucci47 opened this issue 2 years ago • 3 comments

Environment

  • TeXstudio: 4.1.2
  • Qt: 6.2.1
  • OS: Windows 10
  • TeX distribution: miktex

Expected behavior

From this discussion it's clear that TeXstudio doesn't allow for multiple keyval completion in the same command, but it also does not allow for completion when the keys are the last argument of a non-environment command.

Actual behavior

The following cwl results in the highlighting shown:

\foo{arg}[options%keyvals]
\goo{arg1}[options%keyvals]{arg2}
\begin{env}[options%keyvals]
\end{env}

#keyvals:\foo,\goo,\begin{env}
key
#endkeyvals
bug

The highlighting and completer work correctly for \goo (keys not the last arg) and \begin{env} (keys last arg but for an environment) but not for \foo. The \foo{arg} is essentially the same as \begin{env}, so I thought it must be a bug.

mbertucci47 avatar Dec 10 '21 17:12 mbertucci47

there is special treatment for environments

sunderme avatar Dec 10 '21 17:12 sunderme

Is this necessary somewhere ?

sunderme avatar Dec 11 '21 09:12 sunderme

The \setmainfont{font}[font features%keyvals]-type commands in fontspec and unicode-math are the main places I can think of. \pgfpagesuselayout{layout}[options%keyvals] of pgfpages is another.

mbertucci47 avatar Dec 12 '21 03:12 mbertucci47