Page MenuHomePhabricator

Incorrect syntax highlighting for: *#*:#
Closed, ResolvedPublic

Description

Steps to reproduce

  1. Enable Wikitext syntax highlighting
  2. Open Wikipedia:Sandbox
  3. Edit it as source
  4. Type *#*:#

Actual results

The last # is not highlighted though it represents a list item.

Expected results

As the preview would show the last # does represent an ordered list and thus should be highlighted.

Screenshot

incorrect syntax highlight.png (768×1 px, 346 KB)

You can see how it looks in the rendering here.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 991613 had a related patch set uploaded (by Bhsd; author: Bhsd):

[mediawiki/extensions/CodeMirror@master] improve treatment of lists at start of line

https://gerrit.wikimedia.org/r/991613

Change 991613 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] improve treatment of lists at start of line

https://gerrit.wikimedia.org/r/991613

Bhsd moved this task from Bugs to Done on the MediaWiki-extensions-CodeMirror board.

@Bhsd I suspect this came at the cost of degraded performance for this syntax.

A user is reporting that for a very long list, they now suddenly cannot load the edit page. I'm able to reproduce, have not bisect'ed this yet though.

https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)#c-StefenTower-20240129203700-PrimeHunter-20240129202700

@TheDJ Did they explicitly enable CodeMirror 6 in the URL (cm6enable=1)? I am unable to reproduce the issue. Besides, my patch does not seem to add any expensive RegExp to the stream parser.

Here is the URL for anyone to test: https://en.wikipedia.org/wiki/Wikipedia:WikiProject_Louisville/Watchall?action=edit&cm6enable=1

Just a quick note: My patch has nothing to do with CodeMirror 5.

It takes well over 15 seconds for me to activate syntax highlighting on that page. That is with CM5 (CM6 is considerably faster). If your patch only affects CM6, then it might be something else. I just did a quick scan in the git log and this change seemed like a likely candidate for any potential regressions in highlighting a list. Will have to look deeper at a later time then.