Menu

#629 \NewDocumentCommand support

None
closed
nobody
None
1
2018-02-01
2014-01-08
sungmin817
No

I am wondering the command \NewDocumentCommand defined in xparse package will be supported in texstudio just like the support for \newcommand.

I am sure the support for \NewDocumentCommand is going to be much more complex(because of the optional arguments?) but I am also certain that this will be a valuable addition.

Discussion

  • Tim Hoffmann

    Tim Hoffmann - 2014-01-08

    You can already do it in a basic version by writing a xparse.cwl. Simply add the following definition (and the likes for the similar commands of xparse):

    \DeclareDocumentCommand{%<name%>}{%<spec%>}{%<code%>}#d
    

    With this the syntax checker and completer will learn about the commands you define. It won't have any information on the posible arguments, but that's anyway beyond the latex parser and cwl format we currently use.

    We appreciate if you want to create and share cwls for new packages.

     

    Last edit: Tim Hoffmann 2014-01-08
  • sungmin817

    sungmin817 - 2014-01-09

    Thank you. As you suggested, I could bet minimal support from the way you explained.

    As suggested, I tried to make a cwl file for xparse.
    Since it is quite experimental at this stage,
    I marked #* for the commands which is not stable now.

    Among others, I was not able to support \DeclareDocumentEnvironment since there does not seem to exist a suitable classifier for an environment in the cwl format.

    Anyway, I attached my cwl file.

     
  • Tim Hoffmann

    Tim Hoffmann - 2014-01-12

    Thanks. I've added the cwl to the repository.

     
  • Tim Hoffmann

    Tim Hoffmann - 2014-01-12
    • status: open --> closed
    • Group: -->
     
  • basseur

    basseur - 2018-02-01

    I have custom .cwl files. But even with this code, new commands from \NewDocumentCommand have to be manually added to it to not be highlighted as unknown. Am I missing something?

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB