Do we have a special highlighting version for QGIS expressions?
Most of the expressions used are simple and therefore do not necessarily need to be highlighted, but if they become more complex, it can increase readability a lot.
I found this Syntax highlighting needed for expression tag? question about. But I think SQL only highlights comments well as for example:
array_to_string( array_foreach( array_foreach( string_to_array("idTargetLayer"), -- idTargetLayer is a string so we need to convert it to an array first to_int(@element)), -- idTargetLayer is a string field, so we need to convert the numbers to integer before we can look it up attributes(get_feature_by_id('myTargetLayer',@element+1))['myField'] -- get the attribute of ['myfield'] of the layer 'myTargetLayer' for the featureID '@element+1', where @element+1 is the extracted integer of 'idTargetLayer' array ) ,',') -- convert the gathered array back to a string
So I was searching for another language, like java, which gets a little messy. I also tried some others, but I was not really satisfied.
Which existing language do you recommend to highlight QGIS expressions?
Here a few examples:
Of course there are more available...
If you want to test it yourself, you need go to main GIS SE and type a test-question (without actually asking of course) with the expression above or an example of your own to get a preview. Simply use ```lang-sql as start and ``` as end for the code block and replace
sql by the language.
Related: Syntax highlighting language hints