Question T4088
Visible to All Users

Syntax highlighting in JSON editor

created 5 years ago (modified 5 years ago)

The Ace editor spots nice syntax highlighting capabilities. Is there any reason why that is not enabled in the Survey Cloud Service?

Just compare this (SurveyJS):
SurveyJS.png
to this (same editor component, but used in Kibana):
Kibana.png

I think everyone will agree that the second pic not only looks much better, but also makes spotting problems easier and editing JSON in general more comfortable.

Answers approved by surveyjs Support

created 5 years ago

Hello,

Ace Editor needs to have set the basePath in order to load modes and workers:
ace["config"].set('basePath', SurveyJSONEditor.aceBasePath);

You can set the base path via the following code:
SurveyCreator.SurveyJSONEditor.aceBasePath = "https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.10/";

This enhancement will be available in the nearest update - v1.7.8.

Thanks, Serge
SurveyJS Team

    Comments (3)

      I suppose the part about editing config applies to self-hosters only, not the Service/Survey Cloud product?

        Hello,

        The SurveyCreator.SurveyJSONEditor.aceBasePath property will be available in the v1.7.8. It hasn't been included in the v1.7.7.

        Thanks, Serge
        SurveyJS Team

          I can confirm that syntax highlight works in 1.7.8. Thanks!