Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\begin and \end in \newcommand: math highlighting and folding #3546

Open
jojo2357 opened this issue May 6, 2024 · 1 comment
Open

\begin and \end in \newcommand: math highlighting and folding #3546

jojo2357 opened this issue May 6, 2024 · 1 comment
Labels
enhancement New feature or (non bug related) change to the program. parser Issues for which significant changes in the parser are needed

Comments

@jojo2357
Copy link
Contributor

jojo2357 commented May 6, 2024

Not sure if it is intentional, but given a command definition we do not have folding of environments or syntax highlighting.

\newcommand{\balign}[0]{
	\begin{align}
		Miss aligned
	\end{align}
}

I understand that you do not need to close every environ that you open, but if we detect a complete environ, I dont see why we cant treat it as such?

If the amount of false-positive errors would be too large, then I'll close this and be sad. Maybe a magic comment is in order?

image

@jojo2357 jojo2357 added enhancement New feature or (non bug related) change to the program. untriaged Issue type still needs to be triaged or verified. labels May 6, 2024
@PHPirates
Copy link
Collaborator

This is indeed on purpose, see #3101 . Unfortunately we have to decide at lexer level whether they are \begin and \end commands or not, if they are then the parser will break if they are unmatched.
What we could maybe still do, is make them a special 'weak \begin' token type and 'optionally' match them just like [...] brackets , I'm not sure though if we can then get the math highlighting and folding back.

@PHPirates PHPirates changed the title \newcommand definition missing features \begin and \end in \newcommand: math highlighting and folding May 8, 2024
@PHPirates PHPirates added parser Issues for which significant changes in the parser are needed and removed untriaged Issue type still needs to be triaged or verified. labels Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or (non bug related) change to the program. parser Issues for which significant changes in the parser are needed
Projects
None yet
Development

No branches or pull requests

2 participants