Code inside DO $$ block treated as string - PostgreSQL dialect


The code inside DO $$ block is treated as string. Because of which, syntax highlighting doesn’t work. This used to work in CM5. Screenshot from CM5:

Screenshot from CM6:

That’s because those are string tokens. The fact that it doesn’t do the same for $BODY$ was a bug (addressed here).

1 Like

Oh I see. Thank you for the response.

Hi @marijn,

I revisited this and want to know why $x$ tagged(with name in between dollars) are not treated as strings?
Secondly, if there is a single quote in between then highlighting looks incorrect.

Probably because the new patch hadn’t been published yet. Try again with @codemirror/lang-sql 6.6.2

1 Like

Works with 6.6.2. Thanks.

Hi @marijn,

I understand the code is implemented based on PostgreSQL docs. But it is not helpful in many cases for example a PostgreSQL function. A lot of pgAdmin users are raising this issue of syntax highlighting.
I’m wondering if there is a way to disable it?

Hi @marijn,
Will you accept a PR to make this optional?
People are not liking that a complete code is treated as string with no syntax highlighting.

You can already turn that off without a PR (see this example). But there was a bug that broke that, so you’ll have to upgrade to @codemirror/lang-sql 6.6.3.

Awesome! Thank you so much.