This code:
CREATE OR REPLACE TRIGGER some_trigger
BEFORE INSERT OR DELETE OR UPDATE
ON some.table
FOR EACH ROW
EXECUTE FUNCTION some_trigger_function();
is highlighted like this:
See the yellow instead of blue REPLACE
or the white instead of blue FOR EACH
? I suppose this is some standard sql syntax highlighting. But for PostgreSQL this is good.
I tried installing extensions like "Better PostgreSQL Syntax" or "PostgreSQL" but nothing changed.
How can I get good syntax highlighting for PostgreSQL in VS code?
The extension PostgreSQL
by Chris Kolkman did the trick for me in the end.
In its feature list under "Programming Languages" there are file extension *.pgsql
and *.psql
listed.
What I did then:
Better PostgreSQL Syntax
, SQLTools
and the dependent PostgreSQL driverPostgreSQL
by Chris Kolkman*.sql
files to *.pgsql
After that VS Code recognised the new file extensions and used the correct syntax highlighting (Language Mode "Postgres").