Page MenuHomePhabricator

Bracket matching: Highlight bracket errors
Closed, DeclinedPublic

Description

For instance, highlight brackets which have slipped into wiki links, and highlight unclosed brackets.

reported on https://de.wikipedia.org/wiki/Wikipedia_Diskussion:Technische_W%C3%BCnsche/Topw%C3%BCnsche/Zusammengeh%C3%B6rige_Klammerpaare_hervorheben

Event Timeline

Based on how I understand the discussion I think this ticket is mostly a duplicate of T292967: Syntax highlighting: Detect {{{!}} und {{!}}} as start/end of tables.

Any kind of error-detection is really dangerous. It can easily trick users into fixing "errors" that aren't errors. At it's core the problem is that wikitext can't be parsed into a syntax tree like actual programming languages can. Our little bracket matching algorithm makes a guess based on assumptions that might or might not be true in a particular case. If it can't figure out what's going on it gives up. But there is no way to know which bracket (or missing bracket?) caused this.

What the user currently sees is that the bracket matching stops working in extreme situations. The fact that no brackets are highlighted in such a case effectively acts as an error message. But that's all we can say for sure.

@JStrodt_WMDE I'm declining this ticket as we will not be able to make improvements in this area. As explained by Thiemo, we looked into this early on in the project and realised that it is too difficult to predict what is an error and what is not, given the complexity of template syntax.