Multi line syntax highlighting


#1

Hi everyone, I am new to the community, want to write a PostgreSQL syntax highlighting package, but was wondering if Atom allows multi line highlighting…Sublime 3 has this but I wasn’t able to figure out how to do it, hopefully I have better luck with Atom


#2

Naive as the question may be, but isn’t the SQL syntax highlighting enough?


#3

Hi there, umm it could be, but the current SQL syntax is not highlighting words like CREATE TEMP TABLE, DISTRIBUTED BY, and I want to highlight table names in the future as well, so the SQL package currently does not do these things…


#4

Ah, gotcha.
Sounds like maybe this would be a good candidate for a PR or feature request on the language-sql repository, actually.
I could imagine this being helpful for other SQL variants, and adding their specific reserved words?


#5

Sometimes the differences in SQL can be big enough that you can’t realistically use one language file. I know that language-tsql was created recently and I contributed a fix to it for string syntax highlighting. T-SQL doesn’t use \ as an escape character. It also doesn’t use # for comments. language-sql is a good basic SQL package, but trying to handle advanced highlighting for specific versions of SQL under one project would easily become unmanageable.


#6

That makes sense.
The last time I wrote any functional SQL was many years ago in Oracle, since then I am happy just writing queries.


#7

Hi Nalin, do you know if we could do multi line highlighting?


#8

I do not know enough about .tmLanguage files to answer that, sorry. Maybe once .sublime-syntax is finished Atom could add support for it.


#9

@kevinzzz007 I might be able to answer your question if you can be a little more description in what you mean by “multi-line syntax highlighting”? If you mean a single rule that stretches across multiple lines, yes, the Atom grammar system (like the Sublime and TextMate grammar systems it mimics) supports creating some kinds of multi-line rules. Syntax highlighting of multi-line comments is just one example.