texstudio-org / texstudio-org/texstudio

Feature Request: support xparse-style declarations when auto-generating cwl

Open
#712 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C++
Stars
3.6k
Forks
403
Avg merge
3h 14m
Merged PRs (30d)
12

Description

Currently, only latex2e-style declarations like \newcommand and \newenvironment are analysed in the process of auto-generating cwl files.

Nowadays, more and more new packages are (re)written using new declaration commands provided by xparse pacakge (which is based on latex3). Before the related cwl files are manually added into txs, maybe it is better to support xparse-style declarations at code level first.

A bnf-like description of these new declaration could be found here), and the first part is as follow

xparse-declare ::= cmd-declare <cmd name> arg-spec <definition code>
                 | env-declare <env name> arg-spec <begin code> <end code>

cmd-declare    ::= "\\" prefix ["Expandable"] "DocumentCommand"
env-declare    ::= "\\" prefix "DocumentEnvironment"
prefix         ::= "New" | "Renew" | "Provide" | "Declare"

arg-spec       ::= argument*
argument       ::= processor* [modifier] arg-type

Parsing <cmd namd> is not a problem, but counting the exact number of arguments may take some effort.

PS: I wonder if regex can parse > {\SplitList{,}} m to m, since it seems need a stack (to skip paired braces).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the code that auto-generates cwl files and handles existing LaTeX2e declarations such as \newcommand and \newenvironment. Compare that entry point with the supplied xparse grammar, including nested brace handling and argument counting; done means xparse-style commands and environments are analysed correctly during cwl generation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, latex
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.