SQL syntax highlighting is not working "with"

When I have a string (regular or raw) with SQL code in it, the syntax is highlighted and even SQL Intellisense works.

It works, when the string starts with SELECT, UPDATE, INSERT and maybe a few other words.

But when the string starts with WITH it doesn't work like this anymore. My case concerns SQLite to be precise.

1
3 comments
Hi Lukasz,

If you are referring to the recursive With in SQLite, we have not received any reports regarding the highlighting within the recursive expression. We tested some examples taken from https://www.sqlite.org/lang_with.html in 2024.3.2 and couldn't indicate an issue. Please specify your current IDE version and provide an example where you are observing an issue with highlighting.
0

All it takes is to add empty UPDATE before and voilla.

    internal static List<Category> GetCategories()
    {
        return Connections.GetDataTableMmex("""
            with recursive Categories(CATEGID, CATEGNAME, PARENTID) as
               (select a.CATEGID, a.CATEGNAME, a.PARENTID
                from CATEGORY_V1 a
                where PARENTID = '-1'
                union all
                select c.CATEGID, r.CATEGNAME || ':' || c.CATEGNAME, c.PARENTID
                from CATEGORIES r
                join CATEGORY_V1 c on c.PARENTID = r.CATEGID)
            select c.CATEGID Id, c.CATEGNAME Name
            from CATEGORIES c
            where not exists (select 1 from CATEGORIES c2 where c2.PARENTID = c.CATEGID)
            union
            select 0, ''
            order by Name
            """).ToObjectList<Category>();
    }

I updated to 2024.3.2 yesterday and didn't get any improvement.

0

Reproduced the problem as you mentioned in the latest Rider version.

I filed a new issue ticket on YouTrack to investigate the problem further.
RIDER-121177 "with" clause in SQL string could not be recognized (Sqlite)

The issue is handled by a dedicated developer there. Please upvote it to indicate your interest and subscribe to further status updates. 

If you have any similar problems, please feel free to comment on the ticket.

1

Please sign in to leave a comment.