Page MenuHomePhabricator

Warning about syntax errors upon saving should include line number
Open, LowPublic

Description

When editing a scribunto module, if there is a syntax error the message is "The document contains errors. Are you sure you want to save?". A number line could be usefull and efficient ! Thanks in advance.


Version: unspecified
Severity: minor

Details

Reference
bz71117

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:44 AM
bzimport added a project: CodeEditor.
bzimport set Reference to bz71117.
bzimport added a subscriber: Unknown Object (MLST).

That message box is actually from CodeEditor, not Scribunto. (You'll note the same thing happens on your user JS pages, etc.)

Seems reasonable, i'll see if I can add this.

TheDJ triaged this task as Low priority.Jan 6 2015, 10:51 AM

Alternate idea.. When this happens, after dismissing dialog, move cursor and focus to first line with an error.

Yes ! and easier to use. Also, after each correction a new syntax error is shown. Thanks in advance !!!

@Rical, that would likely be a bit annoying. you would jump around your document during editing, and that doesn't seem like a good user experience.

There is actually a 'hidden' feature that already sort of allows you to do this. If you click the 'error/warning/info' counters, it will actually take you the 'the next' indicator following your current cursor position. I added that while I was working on those counters, but I probably should add a Tooltip for it that allows people to discover this.

My Yes is for: After some changes in the edit box, the user launches PREVIEW, then a script check the syntax, move the first bad line at the height-center of the box, then display a dialog with the error message. The user can move this dialog if it is in front of the edit box. The user can edit the bad line (and even other lines). When the user dismisses the dialog, the script check the syntax, then all this process can loop, until the user valid the dialog box and the script do not find any syntax error. Then the script execute really a PREVIEW.
The dismiss button of the dialog can be named PREVIEW or RETRY. The user can save the page or quit the page at any time (with or without the dialog).

Now I get an error message "Erreur Lua : attempt to call a string value", when 1 module call another.

The error message is without line number nor module name.
The comment of the error is "Aucun autre détail n’est disponible." = "No other detail is available."

To try to locate it I compare versions (Ok / Error) in my PC, in local JEdit editor with the JDiff plugin, but I don't find any reason for this error.
The size of my 2 modules are near 400 ko on 4000 lines each. There are only 10 lines with minor differences.
How to find where is the error, in which module ? in which line ? In which interaction between the 2 modules ?

I dont know if the error come from my coding or from a bug in compile time or in execution time ?

It is so easy, in the error detector to detect the line number and to display it !

mw.wikibase.getEntity : This function is expensive, I use it twice for test only, not in normal use. And it works fine in the called module used alone.

Données d’optimisation de l’analyseur :
Temps CPU d’utilisation 0.906 seconde
Temps réel d’utilisation 1.476 seconde
Nombre de nœuds de préprocesseur visités 279/1000000
Nombre de nœuds de préprocesseur générés 0/1500000
Taille d’inclusion après expansion 72155/2097152 octets
Taille de l’argument du modèle 25/2097152 octets
Plus grande profondeur d’expansion 4/40
Nombre de fonctions d’analyse coûteuses 2/500
Temps d’utilisation de Lua 0.783/10.000 secondes
Utilisation mémoire de Lua 6,99 Mio/50 Mio

I just found the error cause. The change is from pcall to xpcall which mask errors.
I must use them in case any simple user "kill" whole the page only because a small error in a detail part.

I use pcall or xpcall for missing sub-modules and for missing or not right named wikidata pages.

Then the question become: pcall and xpcall mask errors at run time for the parser and the resulting wikitext.
But the error could be displayed for the developper, in edit mode, transmitting it "across" the pcall or the xpcall.

My modules are also able to detect errors and display it for simple users or for admins in edit mode, and to generate error categories to easily locate pages containing errors to help the admins to correct them. This is the reason of my use of pcall and xpcall, they are parts of the normal process.

The normal use is to not display some detail in an infobox if a wikidata page do not exist and to alert admins in catégories.

If we display the stack under pcall or xpcall, we must clearly alert the developper, displaying in red the text of the stack from pcall and all the called levels inside.

TheDJ removed TheDJ as the assignee of this task.Nov 8 2017, 1:06 PM

Unassigning, as I do not have plans to work on this right now.