Page MenuHomePhabricator

Scribunto error messages still use CodeEditor line number anchors
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue:

What happens?:

Clicking the link won't bring the user to the exact line of source code, because the editor has been Extension:CodeMirror after T419332: Replacing CodeEditor with CodeMirror by MW 1.46, which does not honour those anchors.

(Though this feature appears to have not worked well before the switch, per T234729#5552196.)

What should have happened instead?:

Not sure. Extension:SyntaxHighlight also provides numbered links, but it has a size limit and does not work on large pages. Or the CodeMirror editor may choose to support this kind of links.

Software version: 1.47.0-wmf.21

Event Timeline

SD0001 subscribed.

CodeMirror doesn't appear to have a way to navigate to a line through a URL hash.

I think the link should bring users to action=view pages instead of action=edit.

Change #1351008 had a related patch set uploaded (by SD0001; author: SD0001):

[mediawiki/extensions/Scribunto@master] Fix line anchor in error links to use SyntaxHighlight

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

Fair; historically it linked to action=edit since at that time SyntaxHighlight didn't offer line linking. I'll just change it to point to action=view.

However, there's another use case: when you try to save a module with a syntax error, Scribunto currently tries to navigate to the buggy line within action=edit.

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

[mediawiki/extensions/CodeMirror@master] CodeMirror: hashchange event handler

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

Bhsd changed the task status from Open to In Progress.Oct 5 2026, 6:53 AM
Bhsd moved this task from Backlog to Improvement on the MediaWiki-extensions-CodeMirror board.

My concern with action=view is that SyntaxHighlight just returns a plain <pre> when the page exceeds SyntaxHighlightMaxLines or SyntaxHighlightMaxBytes. Though those modules are usually protected, and editors should know the reason.

action=edit feels more right to me… akin to how Special:LintErrors works. As a module maintainer, I would want to fix the error. It could be annoying to have to first load the action=view, then have to re-find it when I go to edit. For users who can't edit the module, they'd still get a readonly editor.

Change #1351033 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] CodeMirror: hashchange event handler

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

Change #1351008 merged by jenkins-bot:

[mediawiki/extensions/Scribunto@master] Fix line anchor in error links

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

Bhsd updated Other Assignee, added: SD0001.

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

[mediawiki/extensions/CodeMirror@master] CodeMirror: schedule hashchange handler at next frame

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

Change #1354128 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] CodeMirror: schedule hashchange handler at next frame

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