Syntax highlighting for PostgreSQL


#1

Unfortunately there is no good/proper/nice/correct syntax highlighting for PostgreSQL, but I have installed language-sql as community package and changed its sql.cson file.

To do the same, download language-sql, extract and move the whole folder to ~/.atom/packages. (You now have a folder called language-sql inside ~/.atom/packages.)

In there is a file called ~/.atom/packages/language-sql/grammars/sql.cson. Replace this file with this version. Probably a lot can still be improved, but it knows all of Postgres’ built-in functions, SQL commands and keywords like lateral, return, returns, returning, function, etc. It also recognises quoted identifiers. In my opinion there should be an installable package, but I’m failing to put one together as all this is not necessarily self-explaining. But what I have written is very readable, so perhaps someone else is interested in doing this… (That’s why I posted it here!)

Instead of this:

We now have this (and the first example doesn’t show all the other SQL keywords core language-sql doesn’t know…):