-
Notifications
You must be signed in to change notification settings - Fork 14
Syntax Errors
CodeMirror provides the lint feature to display syntax errors. CodeMirror-XQuery uses this feature to implement a remoting lint (the XQuery is validated on server side which is called with an Ajax request (jQuery)).
When errors occurs, they appear like this :

To know the detail of the error, go on the error gutter and tooltip appears with the error message :

CodeMirror-XQuery hosts the statusline addon to display the number of errors. If you click on this status, it select the code where there is the first error :

When there are none errors, status displays a green icon :

Because it exists a lot of XQuery processor which implements XQuery by adding some build-in, the syntax errors must to do on server side with the well XQuery processor implmentation.
For instance, the demo uses Saxon to compile the XQuery content comming from the editor and returns a JSON array with the errors. Each time you type content in the editor, an Ajax request is created (with timeout) to collect from the server side the errors.
So the XML Databases (MarkLogic, Zorba, etc) which wish to implement the syntax errors, must create a service which parse an xquery and returns a JSON array with the errors.