texstudio
texstudio copied to clipboard
xargs commands with more than one optional argument are not recognized as optional
Environment
- TeXstudio: VERSION 4.2.3 (git 4.2.3)
- Qt: 6.3.0 R
- OS: Windows 10 Pro
- TeX distribution: MiKTeX-pdfTeX 4.10 (MiKTeX 22.1)
Desired behavior
Using xargs to create a command with more than one optional argument, TexStudio recognizes that those are optional arguments and autocompletes the command as such.
Current behavior
The command is used as if those arguments were not optional and thus the command doesn't read those arguments at all (since they should be enclosed by [] instead of {}).
How to reproduce
Create a command with more than one optional argument using xargs.
please provide a complete example with source text.
I don't know if there's a way to know whether an argument is optional or not, specially since this is from a specific package, but here's an example:
\usepackage{xargs, mathtools} \newcommand{\R}{\mathbb{R}} \newcommandx{\function}[3][1=f, 2=\R, 3=\R]{#1 \colon #2 \to #3} \function{arg1}{arg2}{arg3} -> f \colon \R \to \R {arg1}{arg2}{arg3} \function -> f \colon \R \to \R \function[arg1] -> arg1 \colon \R \to \R \function[arg1][arg2] -> arg1 \colon arg2 \to \R \function[arg1][arg2][arg3] -> arg1 \colon arg2 \to arg3
Whenever txs autocompletes \function it write] this \function{arg1}{arg2}{arg3} as the placeholder, shouldn't it write this: \function[opt. arg1][opt. arg2}[opt. arg3], instead?
There is no full support for xargs.
In this case you may often have to change braces to brackets. This can be done by macro Toggle between {...} and [...] from the repository. Open menu macro/Edit Macros.... Use Browse button there, click on addedFeature and check the 4th macro (you can read macro's description). Press ok. By default this macro is used with shortcut Alt+A.
There is no full support for xargs.
Yeah, that's what I thought, sorry for using the bug template then.